summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-prod (mdb) <android-build-team-robot@google.com>2018-02-15 23:26:09 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-02-15 23:26:09 +0000
commitf97b3996950820bf8a78d0fd8772fcf501978932 (patch)
tree566a9ca0e966cf41c236126c2bb0ef60475145c6
parenta89d7737d3189402d9ba7457a42158d10e8bb58d (diff)
parent8d9037508b9e4e354bb26a6e587d3d9b3a56ea70 (diff)
downloadcts-lollipop-mr1-cts-release.tar.gz
Merge "Snap for 4607260 from 6ebd08b079ba3f75b78c99c4fab7e89e7e4a5c13 to lollipop-mr1-cts-release" into lollipop-mr1-cts-releaseandroid-cts-5.1_r28lollipop-mr1-cts-release
-rw-r--r--apps/CtsVerifier/AndroidManifest.xml2
-rw-r--r--tests/tests/security/res/raw/bug_65483665.mp4bin0 -> 23606882 bytes
-rw-r--r--tests/tests/security/src/android/security/cts/StagefrightTest.java4
-rw-r--r--tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java80
-rw-r--r--tools/tradefed-host/src/com/android/cts/tradefed/build/CtsBuildProvider.java2
5 files changed, 57 insertions, 31 deletions
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 1470d4b8389..1567400dbe6 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_r27">
+ android:versionName="5.1_r28">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="21"/>
diff --git a/tests/tests/security/res/raw/bug_65483665.mp4 b/tests/tests/security/res/raw/bug_65483665.mp4
new file mode 100644
index 00000000000..105e274be75
--- /dev/null
+++ b/tests/tests/security/res/raw/bug_65483665.mp4
Binary files differ
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index a38528e9553..85b2a3ae644 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -232,6 +232,10 @@ public class StagefrightTest extends InstrumentationTestCase {
before any existing test methods
***********************************************************/
+ public void testStagefright_bug_65483665() throws Exception {
+ doStagefrightTest(R.raw.bug_65483665);
+ }
+
public void testStagefright_cve_2017_0852_b_62815506() throws Exception {
doStagefrightTest(R.raw.cve_2017_0852_b_62815506);
}
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
index e9ff48fa2fb..96a680d4b8a 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
@@ -22,10 +22,13 @@ import android.graphics.Bitmap;
import android.net.http.SslError;
import android.os.Build;
import android.test.ActivityInstrumentationTestCase2;
+import android.util.Base64;
import android.util.Log;
import android.webkit.ConsoleMessage;
import android.webkit.SslErrorHandler;
import android.webkit.WebIconDatabase;
+import android.webkit.WebResourceResponse;
+import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebSettings.TextSize;
import android.webkit.WebStorage;
@@ -33,7 +36,10 @@ import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.cts.WebViewOnUiThread.WaitForLoadedClient;
import android.webkit.cts.WebViewOnUiThread.WaitForProgressClient;
+
+import java.io.ByteArrayInputStream;
import java.io.FileOutputStream;
+import java.nio.charset.StandardCharsets;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -943,61 +949,77 @@ public class WebSettingsTest extends ActivityInstrumentationTestCase2<WebViewCts
if (!NullWebViewUtils.isWebViewAvailable()) {
return;
}
- final class SslWebViewClient extends WaitForLoadedClient {
- public SslWebViewClient() {
+
+ final String INSECURE_BASE_URL = "http://www.example.com/";
+ final String INSECURE_JS_URL = INSECURE_BASE_URL + "insecure.js";
+ final String INSECURE_IMG_URL = INSECURE_BASE_URL + "insecure.png";
+ final String SECURE_URL = "/secure.html";
+ final String JS_HTML = "<script src=\"" + INSECURE_JS_URL + "\"></script>";
+ final String IMG_HTML = "<img src=\"" + INSECURE_IMG_URL + "\" />";
+ final String SECURE_HTML = "<body>" + IMG_HTML + " " + JS_HTML + "</body>";
+ final String JS_CONTENT = "window.loaded_js = 42;";
+ final String IMG_CONTENT = "R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
+
+ final class InterceptClient extends WaitForLoadedClient {
+ public int mInsecureJsCounter;
+ public int mInsecureImgCounter;
+
+ public InterceptClient() {
super(mOnUiThread);
}
+
@Override
- public void onReceivedSslError(WebView view,
- SslErrorHandler handler, SslError error) {
+ public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed();
}
+
+ @Override
+ public WebResourceResponse shouldInterceptRequest(
+ WebView view, WebResourceRequest request) {
+ if (request.getUrl().toString().equals(INSECURE_JS_URL)) {
+ mInsecureJsCounter++;
+ return new WebResourceResponse("text/javascript", "utf-8",
+ new ByteArrayInputStream(JS_CONTENT.getBytes(StandardCharsets.UTF_8)));
+ } else if (request.getUrl().toString().equals(INSECURE_IMG_URL)) {
+ mInsecureImgCounter++;
+ return new WebResourceResponse("image/gif", "utf-8",
+ new ByteArrayInputStream(Base64.decode(IMG_CONTENT, Base64.DEFAULT)));
+ }
+
+ if (request.getUrl().toString().startsWith(INSECURE_BASE_URL)) {
+ return new WebResourceResponse("text/html", "UTF-8", null);
+ }
+ return null;
+ }
}
+ InterceptClient interceptClient = new InterceptClient();
+ mOnUiThread.setWebViewClient(interceptClient);
mSettings.setJavaScriptEnabled(true);
TestWebServer httpsServer = null;
- TestWebServer httpServer = null;
try {
httpsServer = new TestWebServer(true);
- httpServer = new TestWebServer(false);
- final String JS_URL = "/insecure.js";
- final String IMG_URL = "/insecure.png";
- final String SECURE_URL = "/secure.html";
- final String JS_HTML = "<script src=\"" + httpServer.getResponseUrl(JS_URL) +
- "\"></script>";
- final String IMG_HTML = "<img src=\"" + httpServer.getResponseUrl(IMG_URL) + "\" />";
- final String SECURE_HTML = "<body>" + IMG_HTML + " " + JS_HTML + "</body>";
- httpServer.setResponse(JS_URL, "window.loaded_js = 42;", null);
- httpServer.setResponseBase64(IMG_URL,
- "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
- null);
String secureUrl = httpsServer.setResponse(SECURE_URL, SECURE_HTML, null);
-
mOnUiThread.clearSslPreferences();
- mOnUiThread.setWebViewClient(new SslWebViewClient());
-
mSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_NEVER_ALLOW);
mOnUiThread.loadUrlAndWaitForCompletion(secureUrl);
assertEquals(1, httpsServer.getRequestCount(SECURE_URL));
- assertEquals(0, httpServer.getRequestCount(JS_URL));
- assertEquals(0, httpServer.getRequestCount(IMG_URL));
+ assertEquals(0, interceptClient.mInsecureJsCounter);
+ assertEquals(0, interceptClient.mInsecureImgCounter);
mSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
mOnUiThread.loadUrlAndWaitForCompletion(secureUrl);
assertEquals(2, httpsServer.getRequestCount(SECURE_URL));
- assertEquals(1, httpServer.getRequestCount(JS_URL));
- assertEquals(1, httpServer.getRequestCount(IMG_URL));
+ assertEquals(1, interceptClient.mInsecureJsCounter);
+ assertEquals(1, interceptClient.mInsecureImgCounter);
mSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
mOnUiThread.loadUrlAndWaitForCompletion(secureUrl);
assertEquals(3, httpsServer.getRequestCount(SECURE_URL));
- assertEquals(1, httpServer.getRequestCount(JS_URL));
- assertEquals(2, httpServer.getRequestCount(IMG_URL));
+ assertEquals(1, interceptClient.mInsecureJsCounter);
+ assertEquals(2, interceptClient.mInsecureImgCounter);
} finally {
- if (httpServer != null) {
- httpServer.shutdown();
- }
if (httpsServer != null) {
httpsServer.shutdown();
}
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 a395ff2b4e5..8379053be8f 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 @@ public class CtsBuildProvider implements IBuildProvider {
@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_r27";
+ public static final String CTS_BUILD_VERSION = "5.1_r28";
/**
* {@inheritDoc}