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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/wake_lock/wakelock-in-nested-frame.html
diff --git a/LayoutTests/wake_lock/wakelock-in-nested-frame.html b/LayoutTests/wake_lock/wakelock-in-nested-frame.html
new file mode 100644
index 0000000000000000000000000000000000000000..7286a43ea188ea66a7d83923ddfdd59698720e0c
--- /dev/null
+++ b/LayoutTests/wake_lock/wakelock-in-nested-frame.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script>
+
+var nestedFrameTest = async_test(
+ 'Test that keepAwake state is independent in main and nested frames');
+
+var nextStep;
+
+function onMessageReceived(e) {
+ nextStep(e.data.keepAwake);
+}
+
+function setNestedWakeLock(state) {
+ document.getElementById('subframe').contentWindow.postMessage(
+ {'tag': 'setKeepAwake', 'keepAwake': state}, '*');
+}
+
+function getNestedWakeLock(callback) {
+ document.getElementById('subframe').contentWindow.postMessage(
+ {'tag': 'getKeepAwake'}, '*');
+ nextStep = callback;
+}
+
+window.addEventListener('message', onMessageReceived);
+
+window.onload = nestedFrameTest.step_func(function() {
+ screen.keepAwake = true;
+ getNestedWakeLock(nestedFrameTest.step_func(function(nestedKeepAwake) {
+ assert_false(nestedKeepAwake);
+ screen.keepAwake = false;
+ setNestedWakeLock(true);
+ getNestedWakeLock(nestedFrameTest.step_func(function(nestedKeepAwake) {
+ assert_true(nestedKeepAwake);
+ assert_false(screen.keepAwake);
+ nestedFrameTest.done();
+ }));
+ }));
+});
+
+</script>
+<iframe src="resources/subframe.html" id="subframe"/>
+</body>
+</html>
« 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