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

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: Applied review comments Created 5 years, 7 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 nextStep;
9
10 function onMessageReceived(e) {
11 nextStep(e.data.keepScreenAwake);
12 }
13
14 function setNestedWakeLock(state) {
15 document.getElementById('subframe').contentWindow.postMessage(
16 {'tag': 'setKeepScreenAwake', 'keepScreenAwake': state}, '*');
17 }
18
19 function getNestedWakeLock(callback) {
20 document.getElementById('subframe').contentWindow.postMessage(
21 {'tag': 'getKeepScreenAwake'}, '*');
22 nextStep = callback;
23 }
24
25 window.addEventListener('message', onMessageReceived);
26
27 async_test(function(t) {
28 window.onload = function() {
29 document.keepScreenAwake = true;
mlamouri (slow - plz ping) 2015/05/05 13:45:43 Hmm, what about that: var nestedFrameTest = async
30 getNestedWakeLock(t.step_func(function(nestedKeepScreenAwake) {
31 assert_false(nestedKeepScreenAwake);
32 document.keepScreenAwake = false;
33 setNestedWakeLock(true);
34 getNestedWakeLock(t.step_func(function(nestedKeepScreenAwake) {
35 assert_true(nestedKeepScreenAwake);
36 assert_false(document.keepScreenAwake);
37 t.done();
38 }));
39 }));
40 };
41 }, 'Test that keepScreenAwake state is independent in main and nested frame');
42
43 </script>
44 <iframe src="resources/subframe.html" id="subframe"/>
45 </body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698