Chromium Code Reviews| Index: chrome/test/data/extensions/platform_apps/web_view_media_access/media_access_guest.html |
| diff --git a/chrome/test/data/extensions/platform_apps/web_view_media_access/media_access_guest.html b/chrome/test/data/extensions/platform_apps/web_view_media_access/media_access_guest.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..153dda07522a07e74c8c1bb9c08137441899733c |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/platform_apps/web_view_media_access/media_access_guest.html |
| @@ -0,0 +1,39 @@ |
| +<html> |
| + <head> |
| + <script type="text/javascript"> |
| + // A guest that requests for media access. |
| + // Notifies the embedder about the result of the request (success/fail) |
| + // 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 onUserMediaSuccess = function(stream) { |
| + // Should not happen. |
|
Charlie Reis
2012/12/07 19:16:25
This file gets used for both tests, right? So it
lazyboy
2012/12/07 22:50:44
Right. Fixed.
|
| + notifyEmbedder('access-granted'); |
| + }; |
| + var onUserMediaFailure = function(err) { |
| + notifyEmbedder('access-denied'); |
| + }; |
| + var startTest = function() { |
| + navigator.webkitGetUserMedia( |
| + {audio: true}, onUserMediaSuccess, onUserMediaFailure); |
| + }; |
| + var onPostMessageReceived = function(e) { |
| + embedderWindowChannel = e.source; |
| + |
| + // Start the test once we have |embedderWindowChannel|. |
| + startTest(); |
| + }; |
| + window.addEventListener('message', onPostMessageReceived, false); |
| + </script> |
| + </head> |
| + <body> |
| + <div>This is guest that requests audio media.</div> |
| + </body> |
| +</html> |