Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / tab_capture / fullscreen_test.js
blob20a45e0cb08ebede433bb77cf3a080b0f03b7143
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 window.addEventListener('load', function() {
6   document.body.onclick = function toggleBodyFullscreen() {
7     if (document.fullscreenElement || document.webkitFullscreenElement) {
8       if (document.exitFullscreen)
9         document.exitFullscreen();
10       else if (document.webkitExitFullscreen)
11         document.webkitExitFullscreen();
12       else
13         chrome.test.assertTrue(!"HTML5 Fullscreen API missing");
14     } else {
15       if (document.body.requestFullscreen)
16         document.body.requestFullscreen();
17       else if (document.body.webkitRequestFullscreen)
18         document.body.webkitRequestFullscreen();
19       else
20         chrome.test.assertTrue(!"HTML5 Fullscreen API missing");
21     }
22   };
23 });
25 var mediaStream = null;
26 var events = [];
28 chrome.tabCapture.onStatusChanged.addListener(function(info) {
29   if (info.status == 'active') {
30     events.push(info.fullscreen);
31     if (events.length == 3) {
32       chrome.test.assertFalse(events[0]);
33       chrome.test.assertTrue(events[1]);
34       chrome.test.assertFalse(events[2]);
35       mediaStream.stop();
36       chrome.test.succeed();
37     }
39     if (info.fullscreen)
40       chrome.test.sendMessage('entered_fullscreen');
41   }
42 });
44 chrome.tabCapture.capture({audio: true, video: true}, function(stream) {
45   chrome.test.assertTrue(!!stream);
46   mediaStream = stream;
47   chrome.test.notifyPass();
48   chrome.test.sendMessage('tab_capture_started');
49 });