Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: LayoutTests/wake_lock/wakelock-in-nested-frame.html

Issue 1084923002: Wake Lock API implementation (Blink part) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../resources/testharness.js"></script>
5 <script src="../resources/testharnessreport.js"></script>
6 <script>
7
8 var nestedFrameTest = async_test(
9 'Test that keepAwake state is independent in main and nested frames');
10
11 var nextStep;
12
13 function onMessageReceived(e) {
14 nextStep(e.data.keepAwake);
15 }
16
17 function setNestedWakeLock(state) {
18 document.getElementById('subframe').contentWindow.postMessage(
19 {'tag': 'setKeepAwake', 'keepAwake': state}, '*');
20 }
21
22 function getNestedWakeLock(callback) {
23 document.getElementById('subframe').contentWindow.postMessage(
24 {'tag': 'getKeepAwake'}, '*');
25 nextStep = callback;
26 }
27
28 window.addEventListener('message', onMessageReceived);
29
30 window.onload = nestedFrameTest.step_func(function() {
31 screen.keepAwake = true;
32 getNestedWakeLock(nestedFrameTest.step_func(function(nestedKeepAwake) {
33 assert_false(nestedKeepAwake);
34 screen.keepAwake = false;
35 setNestedWakeLock(true);
36 getNestedWakeLock(nestedFrameTest.step_func(function(nestedKeepAwake) {
37 assert_true(nestedKeepAwake);
38 assert_false(screen.keepAwake);
39 nestedFrameTest.done();
40 }));
41 }));
42 });
43
44 </script>
45 <iframe src="resources/subframe.html" id="subframe"/>
46 </body>
47 </html>
OLDNEW
« no previous file with comments | « LayoutTests/wake_lock/wakelock-api.html ('k') | LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698