DevTools: kill codeschool extension from whitelist
[chromium-blink-merge.git] / extensions / test / data / web_view / media_access / deny / media_access_guest.html
blob8328a9912b616cd252224a123a1e4518b030a0b5
1 <!--
2 * Copyright 2013 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 access.
10 // Notifies the embedder about the result of the request (success/fail)
11 // via post message. Note that the embedder has to initiate a postMessage
12 // first so that guest has a reference to the embedder's window.
14 // The window reference of the embedder to send post message reply.
15 var embedderWindowChannel = null;
17 var notifyEmbedder = function(msg) {
18 embedderWindowChannel.postMessage(msg, '*');
21 var onUserMediaSuccess = function(stream, testCase) {
22 notifyEmbedder(JSON.stringify(['access-granted', testCase]));
24 var onUserMediaFailure = function(err, testCase) {
25 notifyEmbedder(JSON.stringify(['access-denied', testCase]));
27 var startTest = function(testCase) {
28 navigator.webkitGetUserMedia(
29 {audio: true},
30 function(stream) { onUserMediaSuccess(stream, testCase); },
31 function(err) { onUserMediaFailure(err, testCase); });
33 var onPostMessageReceived = function(e) {
34 var data = JSON.parse(e.data);
35 var testName = data[0];
36 var testCase = data[1];
37 if (testName == 'check-media-permission') {
38 embedderWindowChannel = e.source;
40 // Start the test once we have |embedderWindowChannel|.
41 startTest(testCase);
44 window.addEventListener('message', onPostMessageReceived, false);
45 </script>
46 </head>
47 <body>
48 <div>This is a guest that requests audio media.</div>
49 </body>
50 </html>