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

Side by Side Diff: LayoutTests/batterystatus/script-tests/updates.js

Issue 16298005: Remove Battery Status API support code from Blink (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 description('Tests that updates to the battery event causes new events to fire.' );
2
3 var charging = false;
4 var chargingTime = Number.POSITIVE_INFINITY;
5 var dischargingTime = 6000;
6 var level = 0.7;
7
8 var battery = navigator.webkitBattery;
9
10 function checkBatteryStatus() {
11 shouldBe("battery.charging", "false");
12 shouldBe("battery.chargingTime", "Infinity");
13 shouldBe("battery.dischargingTime", "6000");
14 shouldBe("battery.level", "0.7");
15 }
16
17 function setBatteryStatus() {
18 internals.setBatteryStatus(document, 'chargingchange', charging, chargingTim e, dischargingTime, level);
19 }
20
21 function firstListener() {
22 checkBatteryStatus();
23 battery.removeEventListener('chargingchange', firstListener);
24 battery.addEventListener('chargingchange', updateListener);
25 charging = true;
26 chargingTime = 7000;
27 dischargingTime = Number.POSITIVE_INFINITY;
28 level = 0.3;
29 setBatteryStatus();
30 }
31
32 function updateListener(event) {
33 shouldBe("battery.charging", "true");
34 shouldBe("battery.chargingTime", "7000");
35 shouldBe("battery.dischargingTime", "Infinity");
36 shouldBe("battery.level", "0.3");
37 finishJSTest();
38 }
39
40 battery.addEventListener('chargingchange', firstListener);
41 setBatteryStatus();
42 window.jsTestIsAsync = true;
OLDNEW
« no previous file with comments | « LayoutTests/batterystatus/script-tests/multiple-frames.js ('k') | LayoutTests/batterystatus/script-tests/window-property.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698