Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / test / data / web_view / media_access / check / media_check_guest.html
blob07164c0df4b991302d9dbd2a0cd18df8000b150b
1 <!--
2 * Copyright 2014 The Chromium Authors. All rights reserved. Use of this
3 * source code is governed by a BSD-style license that can be found in the
4 * LICENSE file.
5 -->
6 <html>
7 <head>
8 <script type="text/javascript">
9 // A guest that requests media sources, which in turn checks for media
10 // access permission.
11 // Notifies the embedder when done via post message. Note that the
12 // embedder has to initiate a postMessage first so that guest has a
13 // reference to the embedder's window.
15 // The window reference of the embedder to send post message reply.
16 var embedderWindowChannel = null;
18 var notifyEmbedder = function(msg) {
19 embedderWindowChannel.postMessage(msg, '*');
22 var onSourceInfo = function(sources) {
23 notifyEmbedder(JSON.stringify(['got-sources']));
25 var startTest = function() {
26 MediaStreamTrack.getSources(onSourceInfo);
28 var onPostMessageReceived = function(e) {
29 var data = JSON.parse(e.data);
30 var testName = data[0];
31 if (testName == 'get-sources-permission') {
32 embedderWindowChannel = e.source;
34 // Start the test once we have |embedderWindowChannel|.
35 startTest();
38 window.addEventListener('message', onPostMessageReceived, false);
39 </script>
40 </head>
41 <body>
42 <div>
43 This is a guest requests media sources, which will check for media
44 access permission.
45 </div>
46 </body>
47 </html>