Chromium Code Reviews| Index: LayoutTests/wake_lock/wakelock-api.html |
| diff --git a/LayoutTests/wake_lock/wakelock-api.html b/LayoutTests/wake_lock/wakelock-api.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7f0b3668a05aa6cc13d661258c5be26493640eef |
| --- /dev/null |
| +++ b/LayoutTests/wake_lock/wakelock-api.html |
| @@ -0,0 +1,37 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<body> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script> |
| + |
| +test(function() { |
| + assert_true('keepScreenAwake' in window.document); |
|
mlamouri (slow - plz ping)
2015/04/28 08:00:25
There are methods that are meant to check if somet
|
| + assert_true(typeof document.keepScreenAwake !== 'undefined'); |
| + assert_true(typeof document.keepScreenAwake === 'boolean'); |
|
mlamouri (slow - plz ping)
2015/04/28 08:00:25
No need to test !== undefined and === boolean.
|
| + assert_equals(typeof document.keepScreenAwake, 'boolean'); |
| +}, 'Test that the WakeLock API is present.') |
| + |
| +test(function() { |
| + var caught = false; |
| + try { |
| + document.keepScreenAwake = false; |
| + document.keepScreenAwake = true; |
| + } catch (e) { |
| + caught = true; |
| + } |
| + |
| + assert_false(caught); |
| +}, 'Test that document.keepScreenAwake doesn\'t throw when set the value'); |
|
mlamouri (slow - plz ping)
2015/04/28 08:00:25
You can remove that test. If it were to throw, the
|
| + |
| +test(function() { |
| + document.keepScreenAwake = true; |
| + assert_true(document.keepScreenAwake); |
| + |
| + document.keepScreenAwake = false; |
| + assert_false(document.keepScreenAwake); |
| +}, 'Test that document.keepScreenAwake save value'); |
| + |
| +</script> |
| +</body> |
| +</html> |