- From: Mercurial notifier <cvsmail@w3.org>
- Date: Fri, 23 Nov 2012 12:55:36 +0000
- To: public-dap-commits@w3.org
changeset: 281:12484e4ad7c6 user: Anssi Kostiainen <anssi.kostiainen@nokia.com> date: Fri Nov 23 14:18:01 2012 +0200 files: battery/tests/submissions/anssik/battery-discharging.html battery/tests/submissions/anssik/battery-plugged-in.html battery/tests/submissions/anssik/battery-unplugged.html description: rework battery-plugged-in and battery-unplugged to not to depend on alert(); terminate worker in battery-unplugged and batter-discharging immediately after the async tests are finished diff -r f4caa3f58581 -r 12484e4ad7c6 battery/tests/submissions/anssik/battery-discharging.html --- a/battery/tests/submissions/anssik/battery-discharging.html Thu Nov 22 15:26:01 2012 +0200 +++ b/battery/tests/submissions/anssik/battery-discharging.html Fri Nov 23 14:18:01 2012 +0200 @@ -61,6 +61,7 @@ navigator.battery.onlevelchange = onlevelchange_test.step_func(function (e) { assert_true(navigator.battery.level < battery_level, 'The value of the level attribute must decrease.'); onlevelchange_test.done(); + w.terminate(); }); add_completion_callback(function () { diff -r f4caa3f58581 -r 12484e4ad7c6 battery/tests/submissions/anssik/battery-plugged-in.html --- a/battery/tests/submissions/anssik/battery-plugged-in.html Thu Nov 22 15:26:01 2012 +0200 +++ b/battery/tests/submissions/anssik/battery-plugged-in.html Fri Nov 23 14:18:01 2012 +0200 @@ -5,6 +5,9 @@ <script src="/resources/testharness.js"></script> <script src="countdown.js"></script> <link rel="stylesheet" href="/resources/testharness.css" media="all"/> + <style> + #note { background-color: #fef1b5; border: solid 1px #cdab2d; padding: 5px; margin: 15px; display: none; } + </style> <meta name="flags" content="interact"> </head> <body> @@ -21,6 +24,9 @@ The battery must not be full or reach full capacity during the time the test is run. </li> </ol> + <div id="note"> + Plug in the charger and wait for all the tests to complete. + </div> <div id="log"></div> <script> (function() { @@ -29,9 +35,7 @@ setup({ timeout: t }); countdown({ timeout: t }); - alert('Unplug the device from its charger (if not already unplugged), and click OK.'); - - var onchargingchange_test = async_test('When the device is plugged in and its charging state is updated, must set the level attribute\'s value to true and fire a chargingchange event.'); + var onchargingchange_test = async_test('When the device is plugged in and its charging state is updated, must set the charging attribute\'s value to true and fire a chargingchange event.'); navigator.battery.onchargingchange = onchargingchange_test.step_func(function (e) { assert_true(navigator.battery.charging, 'The charging attribute must be set to true.') onchargingchange_test.done(); @@ -57,9 +61,17 @@ assert_true(navigator.battery.level > 0 && navigator.battery.level < 1.0, 'The level attribute must be set to the current battery level scaled from 0 to 1.0. If the reported battery level ' + navigator.battery.level + ' is not correct, please indicate that the test has failed.'); onlevelchange_test.done(); }); - - alert('Plug in the charger, and click OK.'); - + + setTimeout(function() { + var note = document.querySelector('#note'); + note.style.display = 'block'; + navigator.battery.onchargingchange = function (e) { + if (navigator.battery.charging) { + note.style.display = 'none'; + } + }; + }, 4000); + })(); </script> </body> diff -r f4caa3f58581 -r 12484e4ad7c6 battery/tests/submissions/anssik/battery-unplugged.html --- a/battery/tests/submissions/anssik/battery-unplugged.html Thu Nov 22 15:26:01 2012 +0200 +++ b/battery/tests/submissions/anssik/battery-unplugged.html Fri Nov 23 14:18:01 2012 +0200 @@ -5,6 +5,9 @@ <script src="/resources/testharness.js"></script> <script src="countdown.js"></script> <link rel="stylesheet" href="/resources/testharness.css" media="all"/> + <style> + #note { background-color: #fef1b5; border: solid 1px #cdab2d; padding: 5px; margin: 15px; display: none; } + </style> <meta name="flags" content="interact"> </head> <body> @@ -24,6 +27,9 @@ <p> The highest prime number discovered so far is: <output id="prime"></output> </p> + <div id="note"> + Unplug the charger and wait for all the tests to complete. + </div> <div id="log"></div> <script> (function() { @@ -32,9 +38,7 @@ setup({ timeout: t }); countdown({ timeout: t }); - alert('Plug the device into its charger (if not already plugged in), and click OK.'); - - var onchargingchange_test = async_test('When the device is unplugged in and its charging state is updated, must set the level attribute\'s value to false and fire a chargingchange event.'); + var onchargingchange_test = async_test('When the device is unplugged in and its charging state is updated, must set the charging attribute\'s value to false and fire a chargingchange event.'); navigator.battery.onchargingchange = onchargingchange_test.step_func(function (e) { assert_false(navigator.battery.charging, 'The charging attribute must be set to false.') onchargingchange_test.done(); @@ -67,14 +71,23 @@ navigator.battery.onlevelchange = onlevelchange_test.step_func(function (e) { assert_true(navigator.battery.level > 0 && navigator.battery.level < 1.0, 'The level attribute must be set to the current battery level scaled from 0 to 1.0.'); onlevelchange_test.done(); + w.terminate(); }); add_completion_callback(function () { w.terminate(); }); - alert('Unplug the charger, and click OK.'); - + setTimeout(function() { + var note = document.querySelector('#note'); + note.style.display = 'block'; + navigator.battery.onchargingchange = function (e) { + if (!navigator.battery.charging) { + note.style.display = 'none'; + } + }; + }, 4000); + })(); </script> </body>
Received on Friday, 23 November 2012 12:55:42 UTC