merge in lollipop-mr1-cts-release history after reset to lollipop-mr1-cts-dev
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index b49f600..87959c9 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -18,7 +18,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.cts.verifier"
android:versionCode="5"
- android:versionName="5.1_r14">
+ android:versionName="5.1_r15">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="21"/>
@@ -373,6 +373,8 @@
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
<meta-data android:name="test_category" android:value="@string/test_category_security" />
+ <meta-data android:name="test_required_features"
+ android:value="android.software.app_widgets" />
</activity>
<activity android:name=".security.WidgetConfigActivity" android:exported="true" />
<receiver android:name=".security.AppWidget" >
diff --git a/hostsidetests/theme/assets/22/hdpi.zip b/hostsidetests/theme/assets/22/hdpi.zip
index 0fa67b7..2b23d67 100644
--- a/hostsidetests/theme/assets/22/hdpi.zip
+++ b/hostsidetests/theme/assets/22/hdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/22/xhdpi.zip b/hostsidetests/theme/assets/22/xhdpi.zip
index de6e2e1..fbde98a 100644
--- a/hostsidetests/theme/assets/22/xhdpi.zip
+++ b/hostsidetests/theme/assets/22/xhdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/22/xxhdpi.zip b/hostsidetests/theme/assets/22/xxhdpi.zip
index 9f0d778..ed7036e 100644
--- a/hostsidetests/theme/assets/22/xxhdpi.zip
+++ b/hostsidetests/theme/assets/22/xxhdpi.zip
Binary files differ
diff --git a/tests/tests/app/src/android/app/cts/SystemFeaturesTest.java b/tests/tests/app/src/android/app/cts/SystemFeaturesTest.java
index 4e57d31..6b52236 100644
--- a/tests/tests/app/src/android/app/cts/SystemFeaturesTest.java
+++ b/tests/tests/app/src/android/app/cts/SystemFeaturesTest.java
@@ -466,16 +466,11 @@
}
boolean enabled = mWifiManager.isWifiEnabled();
try {
- // WifiManager is hard-coded to return true,
- // the case without WiFi is already handled,
- // so this case MUST have WiFi.
- if (mWifiManager.setWifiEnabled(true)) {
- assertAvailable(PackageManager.FEATURE_WIFI);
- }
+ // assert wifimanager can toggle wifi from current sate
+ assertTrue(mWifiManager.setWifiEnabled(!enabled));
+
} finally {
- if (!enabled) {
- mWifiManager.setWifiEnabled(false);
- }
+ mWifiManager.setWifiEnabled(enabled);
}
}
diff --git a/tests/tests/webkit/assets/webkit/test_loginForm.html b/tests/tests/webkit/assets/webkit/test_loginForm.html
new file mode 100644
index 0000000..0935cf1
--- /dev/null
+++ b/tests/tests/webkit/assets/webkit/test_loginForm.html
@@ -0,0 +1,23 @@
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<html>
+ <body>
+ <form>
+ <input type='text' name='username' value='Cts Test'/>
+ <input type='submit' name='submit' value='Submit'/>
+ </form>
+ </body>
+</html>
diff --git a/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java b/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java
index 30b8210..4ca33b8 100644
--- a/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java
+++ b/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java
@@ -55,6 +55,8 @@
public static final String BLANK_PAGE_URL = "webkit/test_blankPage.html";
public static final String ADD_JAVA_SCRIPT_INTERFACE_URL = "webkit/test_jsInterface.html";
+ public static final String LOGIN_FORM_URL = "webkit/test_loginForm.html";
+
public static final String EXT_WEB_URL1 = "http://www.example.com/";
public static final String LOCAL_FILESYSTEM_URL = "file:///etc/hosts";
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java
index 5b906ba..98d175f 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java
@@ -33,11 +33,14 @@
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.cts.WebViewOnUiThread.WaitForLoadedClient;
+import android.util.Pair;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
+import java.util.List;
+import java.util.ArrayList;
public class WebViewClientTest extends ActivityInstrumentationTestCase2<WebViewCtsActivity> {
private static final long TEST_TIMEOUT = 5000;
@@ -209,6 +212,41 @@
}.run();
}
+ public void testOnReceivedLoginRequest() throws Exception {
+ if (!NullWebViewUtils.isWebViewAvailable()) {
+ return;
+ }
+ final MockWebViewClient webViewClient = new MockWebViewClient();
+ mOnUiThread.setWebViewClient(webViewClient);
+ TestWebServer testServer = null;
+ //set the url and html
+ final String path = "/main";
+ final String page = "<head></head><body>test onReceivedLoginRequest</body>";
+ final String headerName = "x-auto-login";
+ final String headerValue = "realm=com.google&account=foo%40bar.com&args=random_string";
+ List<Pair<String, String>> headers = new ArrayList<Pair<String, String>>();
+ headers.add(Pair.create(headerName, headerValue));
+
+ try {
+ testServer = new TestWebServer(false);
+ String url = testServer.setResponse(path, page, headers);
+ assertFalse(webViewClient.hasOnReceivedLoginRequest());
+ mOnUiThread.loadUrlAndWaitForCompletion(url);
+ assertTrue(webViewClient.hasOnReceivedLoginRequest());
+ new PollingCheck(TEST_TIMEOUT) {
+ @Override
+ protected boolean check() {
+ return webViewClient.hasOnReceivedLoginRequest();
+ }
+ }.run();
+ assertEquals("com.google", webViewClient.getLoginRequestRealm());
+ assertEquals("foo@bar.com", webViewClient.getLoginRequestAccount());
+ assertEquals("random_string", webViewClient.getLoginRequestArgs());
+ } finally {
+ testServer.shutdown();
+ }
+ }
+
public void testOnReceivedError() throws Exception {
if (!NullWebViewUtils.isWebViewAvailable()) {
return;
@@ -507,6 +545,10 @@
private boolean mOnFormResubmissionCalled;
private boolean mDoUpdateVisitedHistoryCalled;
private boolean mOnReceivedHttpAuthRequestCalled;
+ private boolean mOnReceivedLoginRequest;
+ private String mOnReceivedLoginAccount;
+ private String mOnReceivedLoginArgs;
+ private String mOnReceivedLoginRealm;
private boolean mOnUnhandledKeyEventCalled;
private boolean mOnScaleChangedCalled;
private int mShouldOverrideUrlLoadingCallCount;
@@ -532,6 +574,10 @@
return mOnReceivedErrorCode;
}
+ public boolean hasOnReceivedLoginRequest() {
+ return mOnReceivedLoginRequest;
+ }
+
public boolean hasOnFormResubmissionCalled() {
return mOnFormResubmissionCalled;
}
@@ -560,6 +606,18 @@
return mLastShouldOverrideUrl;
}
+ public String getLoginRequestRealm() {
+ return mOnReceivedLoginRealm;
+ }
+
+ public String getLoginRequestAccount() {
+ return mOnReceivedLoginAccount;
+ }
+
+ public String getLoginRequestArgs() {
+ return mOnReceivedLoginArgs;
+ }
+
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
index c3fdb49..919add2 100755
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
@@ -1151,6 +1151,39 @@
}.run();
}
+ public void testClearFormData() throws Throwable {
+ if (!NullWebViewUtils.isWebViewAvailable()) {
+ return;
+ }
+ try {
+ startWebServer(false);
+ WebSettings settings = mOnUiThread.getSettings();
+ settings.setDatabaseEnabled(true);
+ settings.setJavaScriptEnabled(true);
+ WebViewDatabase webViewDatabase = WebViewDatabase.getInstance(getActivity());
+ webViewDatabase.clearFormData();
+ final String url = mWebServer.getAssetUrl(TestHtmlConstants.LOGIN_FORM_URL);
+ mOnUiThread.loadUrlAndWaitForCompletion(url);
+ new PollingCheck(TEST_TIMEOUT) {
+ @Override
+ public boolean check() {
+ return !WebViewDatabase.getInstance(getActivity()).hasFormData();
+ }
+ }.run();
+ // Click submit (using JS, rather than simulated key presses, to avoid IME
+ // inconsistencies).
+ mOnUiThread.evaluateJavascript("document.getElementsByName('submit')[0].click()", null);
+ new PollingCheck(TEST_TIMEOUT) {
+ @Override
+ public boolean check() {
+ return WebViewDatabase.getInstance(getActivity()).hasFormData();
+ }
+ }.run();
+ } finally {
+ WebViewDatabase.getInstance(getActivity()).clearFormData();
+ }
+ }
+
@UiThreadTest
public void testAccessHttpAuthUsernamePassword() {
if (!NullWebViewUtils.isWebViewAvailable()) {
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java b/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
index 729c16e..b9d376a 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java
@@ -31,7 +31,7 @@
@Option(name="cts-install-path", description="the path to the cts installation to use")
private String mCtsRootDirPath = System.getProperty("CTS_ROOT");
- public static final String CTS_BUILD_VERSION = "5.1_r14";
+ public static final String CTS_BUILD_VERSION = "5.1_r15";
/**
* {@inheritDoc}