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

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

Issue 2678433003: media: Require SecureContext for EME APIs (Closed)
Patch Set: Created 3 years, 10 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
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 69e1ce416fd7a642bb954a7347a7c4ecbafcc148..f93933dd11b5f5711fd47a28c94a6875c976737a 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
@@ -50,28 +50,11 @@ public class KeySystemTest extends AwTestBase {
mAwContents = testContainerView.getAwContents();
enableJavaScriptOnUiThread(mAwContents);
- loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
- getKeySystemTestPage(), "text/html", false);
- }
+ // Treat file:/// as secure context, which is required by EME APIs.
+ allowFileAccessFromFileURLs(mAwContents);
- private String getKeySystemTestPage() {
- return "<html> <script>"
- + "var result;"
- + "function success(keySystemAccess) {"
- + " result = 'supported';"
- + "}"
- + "function failure(error){"
- + " result = error.name;"
- + "}"
- + "function isKeySystemSupported(keySystem) {"
- + " navigator.requestMediaKeySystemAccess(keySystem, [{}]).then("
- + " success, failure);"
- + "}"
- + "function areProprietaryCodecsSupported() {"
- + " var video = document.createElement('video');"
- + " return video.canPlayType('video/mp4; codecs=\"avc1\"');"
- + "}"
- + "</script> </html>";
+ loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(),
+ "file:///android_asset/key-system-test.html");
}
private String isKeySystemSupported(String keySystem) throws Exception {

Powered by Google App Engine
This is Rietveld 408576698