W3C home > Mailing lists > Public > public-dap-commits@w3.org > August 2012

dap commit: merged heads

From: Mercurial notifier <cvsmail@w3.org>
Date: Thu, 30 Aug 2012 14:05:43 +0000
Message-Id: <E1T75NP-0007FZ-S8@mcbain.w3.org>
To: public-dap-commits@w3.org
changeset:   208:4e13a52e6b13
tag:         tip
parent:      207:04cff2e3778a
parent:      206:29bb831f8357
user:        Robin Berjon <robin@berjon.com>
date:        Thu Aug 30 16:05:39 2012 +0200
description:
merged heads


diff -r 04cff2e3778a -r 4e13a52e6b13 battery/tests/submissions/anssik/TODO.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/TODO.txt	Thu Aug 30 16:05:39 2012 +0200
@@ -0,0 +1,5 @@
+---+ TODO
+  
+   * proper {level | chargingtime | dischargingtime}change tests
+   * async tests for *change when plugged in
+   * validate tests on a real device and tweak timeouts for async tests
\ No newline at end of file
diff -r 04cff2e3778a -r 4e13a52e6b13 battery/tests/submissions/anssik/battery-charging.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/battery-charging.html	Thu Aug 30 16:05:39 2012 +0200
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+  <head>
+  <title>Battery Status API Test Suite</title>
+  <script src="http://www.w3c-test.org/resources/testharness.js"></script>
+  <link rel='stylesheet' href='http://w3c-test.org/resources/testharness.css' media='all'/>
+  </head>
+  <body>
+    <h1>Description</h1>
+    <p>
+      The battery is charging.
+    </p>
+    <h2>Preconditions</h2>
+    <ol>
+      <li>
+        The device is plugged in to the charger before this test case is run.
+      </li>
+      <li>
+        The battery must neither be empty or full, nor reach empty or full capacity during the test.
+      </li>
+    </ol>
+    <div id="log"></div>
+    <script>
+    (function() {
+
+      test(function() {
+        assert_true(navigator.battery.charging);
+      }, 'The charging attribute must be set to true if the battery is charging.');
+      
+      test(function() {
+        assert_true(navigator.battery.chargingTime < Infinity);
+      }, 'The chargingTime attribute must be set to the value positive Infinity if the battery is discharging');
+      
+      test(function() {
+        assert_true(navigator.battery.dischargingTime === Infinity);
+      }, 'The dischargingTime attribute must be set to the value positive Infinity, if the battery is charging.');
+      
+      test(function() {
+        assert_true(0 < navigator.battery.level && navigator.battery.level < 1.0);
+      }, 'The level attribute must be set to the current battery level scaled from 0 to 1.0.');
+      
+    })();
+    </script>
+  </body>
+</html>
diff -r 04cff2e3778a -r 4e13a52e6b13 battery/tests/submissions/anssik/battery-chargingchange.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/battery-chargingchange.html	Thu Aug 30 16:05:39 2012 +0200
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+  <head>
+  <title>Battery Status API Test Suite</title>
+  <script src="http://www.w3c-test.org/resources/testharness.js"></script>
+  <link rel='stylesheet' href='http://w3c-test.org/resources/testharness.css' media='all'/>
+  </head>
+  <body>
+    <h1>Description</h1>
+    <p>
+       The battery charging state is updated.
+    </p>
+    <h2>Preconditions</h2>
+    <ol>
+      <li>
+        The device is unplugged from the charger before this test case is run.
+      </li>
+      <li>
+        The battery must not be full or reach full capacity during the time the test is run.
+      </li>
+    </ol>
+    <div id="log"></div>
+    <script>
+    (function() {
+
+      // this is the pattern used for testing event handlers
+      
+      /*
+      var onclick_test = async_test('onclick on body');
+      document.querySelector('body').onclick = onclick_test.step_func(function (e) {
+        // assert_xxxx();
+        onclick_test.done();
+      });
+      
+      alert('click on body!');
+      */
+
+      // the tests below must be validated on a real implementation, to set proper timeouts etc.
+      
+      var onchargingchange_test = async_test('When the battery charging state is updated, must 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, if the battery is charging.')
+        onchargingchange_test.done();
+      });
+      
+      var onchargingtimechange_test = async_test('When the battery charging time is updated, must fire a chargingtimechange event.');
+      navigator.battery.onchargingtimechange = onchargingtimechange_test.step_func(function (e) {
+        assert_false(navigator.battery.chargingTime !== Infinity);
+        onchargingchange_test.done();
+      });
+      
+      alert('Plug in the charger, and click OK.');
+
+      })();
+    </script>
+  </body>
+</html>
diff -r 04cff2e3778a -r 4e13a52e6b13 battery/tests/submissions/anssik/battery-created.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/battery-created.html	Thu Aug 30 16:05:39 2012 +0200
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+  <head>
+  <title>Battery Status API Test Suite</title>
+  <script src="http://www.w3c-test.org/resources/testharness.js"></script>
+  <link rel='stylesheet' href='http://w3c-test.org/resources/testharness.css' media='all'/>
+  </head>
+  <body>
+    <h1>Description</h1>
+    <p>
+      <strong>
+        This test is only useful on devices that expose the BatteryManager interface,
+        but lack a backend implementation.
+      </strong>
+    </p>
+    <h2>Preconditions</h2>
+    <ol>
+      <li>
+        The implementation is unable to report the battery's charging state,
+        charging time, level or remaining time respectively.
+      </li>
+      <li>
+        The device is unplugged from the charger before this test case is run.
+      </li>
+    </ol>
+    <div id="log"></div>
+    <script>
+    (function() {
+      test(function() {
+        var b = navigator.battery;
+        assert_true(b.charging === true, 'charging must be set to true');
+        assert_true(b.chargingTime === 0, 'chargingTime must be set to 0');
+        assert_true(b.level === 1.0, 'level must be set to 1.0');
+        assert_true(b.dischargingTime === Infinity, 'dischargingTime must be set to Infinity');
+
+      }, 'When a BatteryManager object is created, charging must be set to true, ' +
+      'chargingTime to 0, level to 1.0 and dischargingTime to the value positive ' +
+      'Infinity, if the implementation is unable to report the battery\'s charging ' +
+      'state, charging time, level or remaining time respectively.');
+      })();
+    </script>
+  </body>
+</html>
diff -r 04cff2e3778a -r 4e13a52e6b13 battery/tests/submissions/anssik/battery-discharging.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/battery-discharging.html	Thu Aug 30 16:05:39 2012 +0200
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+  <head>
+  <title>Battery Status API Test Suite</title>
+  <script src="http://www.w3c-test.org/resources/testharness.js"></script>
+  <link rel='stylesheet' href='http://w3c-test.org/resources/testharness.css' media='all'/>
+  </head>
+  <body>
+    <h1>Description</h1>
+    <p>
+      The battery is discharging.
+    </p>
+    <h2>Preconditions</h2>
+    <ol>
+      <li>
+        The device is unplugged from the charger before this test case is run.
+      </li>
+      <li>
+        The battery must neither be empty or full, nor reach empty or full capacity during the test.
+      </li>
+    </ol>
+    <div id="log"></div>
+    <script>
+    (function() {
+
+      test(function() {
+        assert_false(navigator.battery.charging);
+      }, 'The charging attribute must be set to false if the battery is discharging.');
+      
+      test(function() {
+        assert_true(navigator.battery.chargingTime === Infinity);
+      }, 'The chargingTime attribute must be set to the value positive Infinity if the battery is discharging');
+      
+      test(function() {
+        assert_true(navigator.battery.dischargingTime < Infinity);
+      }, 'The dischargingTime attribute must be set to the time remaining in ' +
+      'seconds until the system\'s battery is completely discharged.');
+      
+      test(function() {
+        assert_true(0 <= navigator.battery.level && navigator.battery.level <= 1.0);
+      }, 'The level attribute must be set to the current battery level scaled from 0 to 1.0');
+      
+    })();
+    </script>
+  </body>
+</html>
diff -r 04cff2e3778a -r 4e13a52e6b13 battery/tests/submissions/anssik/battery-full.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/battery/tests/submissions/anssik/battery-full.html	Thu Aug 30 16:05:39 2012 +0200
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+  <head>
+  <title>Battery Status API Test Suite</title>
+  <script src="http://www.w3c-test.org/resources/testharness.js"></script>
+  <link rel='stylesheet' href='http://w3c-test.org/resources/testharness.css' media='all'/>
+  </head>
+  <body>
+    <h1>Description</h1>
+    <p>
+      The battery is full.
+    </p>
+    <h2>Preconditions</h2>
+    <ol>
+      <li>
+        The device is plugged in to the charger before this test case is run.
+      </li>
+      <li>
+        The battery is full.
+      </li>
+    </ol>
+    <div id="log"></div>
+    <script>
+    (function() {
+
+      test(function() {
+        assert_true(navigator.battery.charging);
+      }, 'The charging attribute must be set to true if the battery is charging ("or otherwise" condition).');
+      
+      test(function() {
+        assert_true(navigator.battery.chargingTime === 0);
+      }, 'The chargingTime attribute must be set to 0, if the battery is full.');
+      
+      test(function() {
+        assert_true(navigator.battery.dischargingTime === Infinity);
+      }, 'The dischargingTime attribute must be set to the value positive Infinity if the battery is charging ("or otherwise" condition).');
+      
+      test(function() {
+        assert_true(navigator.battery.level === 1.0);
+      }, 'The level attribute must be set to the current battery level scaled from 0 to 1.0.');
+      
+    })();
+    </script>
+  </body>
+</html>
diff -r 04cff2e3778a -r 4e13a52e6b13 battery/tests/submissions/anssik/manifest.txt
--- a/battery/tests/submissions/anssik/manifest.txt	Thu Aug 30 15:28:42 2012 +0200
+++ b/battery/tests/submissions/anssik/manifest.txt	Thu Aug 30 16:05:39 2012 +0200
@@ -1,1 +1,6 @@
-index.html		Battery Status API Test Suite					
\ No newline at end of file
+index.html		Battery Status API Test Suite					
+battery-charging.html		Battery Status API Test Suite					
+battery-chargingchange.html		Battery Status API Test Suite					
+battery-created.html		Battery Status API Test Suite					
+battery-discharging.html		Battery Status API Test Suite					
+battery-full.html		Battery Status API Test Suite					
Received on Thursday, 30 August 2012 14:05:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 30 August 2012 14:05:51 GMT