Index: chrome/test/data/extensions/platform_apps/web_view/media_access/media_check_guest.html |
diff --git a/chrome/test/data/extensions/platform_apps/web_view/media_access/media_check_guest.html b/chrome/test/data/extensions/platform_apps/web_view/media_access/media_check_guest.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..07164c0df4b991302d9dbd2a0cd18df8000b150b |
--- /dev/null |
+++ b/chrome/test/data/extensions/platform_apps/web_view/media_access/media_check_guest.html |
@@ -0,0 +1,47 @@ |
+<!-- |
+ * Copyright 2014 The Chromium Authors. All rights reserved. Use of this |
+ * source code is governed by a BSD-style license that can be found in the |
+ * LICENSE file. |
+--> |
+<html> |
+ <head> |
+ <script type="text/javascript"> |
+ // A guest that requests media sources, which in turn checks for media |
+ // access permission. |
+ // Notifies the embedder when done via post message. Note that the |
+ // embedder has to initiate a postMessage first so that guest has a |
+ // reference to the embedder's window. |
+ |
+ // The window reference of the embedder to send post message reply. |
+ var embedderWindowChannel = null; |
+ |
+ var notifyEmbedder = function(msg) { |
+ embedderWindowChannel.postMessage(msg, '*'); |
+ }; |
+ |
+ var onSourceInfo = function(sources) { |
+ notifyEmbedder(JSON.stringify(['got-sources'])); |
+ }; |
+ var startTest = function() { |
+ MediaStreamTrack.getSources(onSourceInfo); |
+ }; |
+ var onPostMessageReceived = function(e) { |
+ var data = JSON.parse(e.data); |
+ var testName = data[0]; |
+ if (testName == 'get-sources-permission') { |
+ embedderWindowChannel = e.source; |
+ |
+ // Start the test once we have |embedderWindowChannel|. |
+ startTest(); |
+ } |
+ }; |
+ window.addEventListener('message', onPostMessageReceived, false); |
+ </script> |
+ </head> |
+ <body> |
+ <div> |
+ This is a guest requests media sources, which will check for media |
+ access permission. |
+ </div> |
+ </body> |
+</html> |