Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1781)

Unified Diff: android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java

Issue 2741943003: Fix KeySystemTests on Android (Closed)
Patch Set: changes (+rebase) Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | android_webview/test/shell/assets/key-system-test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java
index d9f61fae2dfdaf4f1446cf1a5c357a161ec445d1..f746c14841745631d0ceb3ff8a8fd61bd3257ab0 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java
@@ -4,7 +4,6 @@
package org.chromium.android_webview.test;
-import android.os.Build;
import android.support.test.filters.SmallTest;
import org.chromium.android_webview.AwContents;
@@ -70,8 +69,8 @@ public class KeySystemTest extends AwTestBase {
}
private boolean areProprietaryCodecsSupported() throws Exception {
- String result = executeJavaScriptAndWaitForResult(
- mAwContents, mContentsClient, "areProprietaryCodecsSupported()");
+ String result = maybeStripDoubleQuotes(executeJavaScriptAndWaitForResult(
+ mAwContents, mContentsClient, "areProprietaryCodecsSupported()"));
return !result.isEmpty();
}
@@ -87,21 +86,23 @@ public class KeySystemTest extends AwTestBase {
}
private String getPlatformKeySystemExpectations() throws Exception {
- // Android key systems only support non-proprietary codecs on Lollipop+.
- // When neither is true isKeySystemSupported() will return an error for
- // all key systems except ClearKey (which is handled by Chrome itself).
- if (!areProprietaryCodecsSupported()
- && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
- return "\"NotSupportedError\"";
+ // isKeySystemSupported() calls navigator.requestMediaKeySystemAccess()
+ // with a video/mp4 configuration. mp4 is only supported if
+ // areProprietaryCodecsSupported().
+ if (areProprietaryCodecsSupported()) {
+ return "\"supported\"";
}
- return "\"supported\"";
+ return "\"NotSupportedError\"";
}
@Feature({"AndroidWebView"})
@SmallTest
public void testSupportClearKeySystem() throws Throwable {
- assertEquals("\"supported\"", isKeySystemSupported("org.w3.clearkey"));
+ // Clear Key is always supported. However, isKeySystemSupported()
+ // specifies a video/mp4 configuration, so it only succeeds if
+ // proprietary codecs are supported.
+ assertEquals(getPlatformKeySystemExpectations(), isKeySystemSupported("org.w3.clearkey"));
}
@Feature({"AndroidWebView"})
« no previous file with comments | « no previous file | android_webview/test/shell/assets/key-system-test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698