dap commit: moved test cases to github, see https://github.com/w3c/web-platform-tests/pull/124

changeset:   426:de8e511256c2
user:        Dominique Hazael-Massieux <dom@w3.org>
date:        Thu May 30 14:47:07 2013 +0200
files:       battery/tests/submissions/anssik/TODO.txt battery/tests/submissions/anssik/battery-charging.html battery/tests/submissions/anssik/battery-created.html battery/tests/submissions/anssik/battery-discharging.html battery/tests/submissions/anssik/battery-full.html battery/tests/submissions/anssik/battery-interface-idlharness.html battery/tests/submissions/anssik/battery-interface.html battery/tests/submissions/anssik/battery-interface.js battery/tests/submissions/anssik/battery-plugged-in.html battery/tests/submissions/anssik/battery-unplugged.html battery/tests/submissions/anssik/countdown.js battery/tests/submissions/anssik/manifest.txt battery/tests/submissions/anssik/prime.js
description:
moved test cases to github, see https://github.com/w3c/web-platform-tests/pull/124


diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/TODO.txt
--- a/battery/tests/submissions/anssik/TODO.txt	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
----+ TODO
-  
-   * proper {level | chargingtime | dischargingtime}change tests
-   * validate tests on a real device and tweak timeouts for async tests
\ No newline at end of file
diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/battery-charging.html
--- a/battery/tests/submissions/anssik/battery-charging.html	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Battery Status API Test Suite</title>
-    <script src="/resources/testharness.js"></script>
-    <script src="countdown.js"></script>
-    <link rel="stylesheet" href="/resources/testharness.css" media="all"/>
-    <meta name="flags" content="interact">
-  </head>
-  <body>
-    <h1>Description</h1>
-    <p>
-      This test validates that all of the navigator.battery attributes exist and are set to correct values, when the battery is charging.
-    </p>
-    <h2>Preconditions</h2>
-    <ol>
-      <li>
-        The device is plugged in to the charger before this test 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() {
-
-      var t = 5*60*1000;
-      setup({ timeout: t });
-      countdown({ timeout: t });
-
-      test(function() {
-        assert_true(navigator.battery.charging);
-      }, 'The charging attribute must be set to true.');
-      
-      test(function() {
-        assert_true(navigator.battery.chargingTime < Infinity);
-      }, 'The chargingTime attribute must be set to the time remaining in seconds until the system\'s battery is completely charged. If the reported charging time ' + navigator.battery.chargingTime + ' seconds or ' + Math.round(navigator.battery.chargingTime/60) + ' minutes is not correct, please indicate that the test has failed.');
-      
-      test(function() {
-        assert_true(navigator.battery.dischargingTime === Infinity);
-      }, 'The dischargingTime attribute must be set to the value positive Infinity.');
-      
-      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. If the reported battery level ' + navigator.battery.level + ' is not correct, please indicate that the test has failed.');
-      
-      var onlevelchange_test = async_test('When the battery level is updated, must increase the level attribute\'s value and fire a levelchange event.');
-      var battery_level = navigator.battery.level;
-      navigator.battery.onlevelchange = onlevelchange_test.step_func(function (e) {
-        assert_true(navigator.battery.level > battery_level, 'The value of the level attribute must increase.');
-        onlevelchange_test.done();
-      });
-      
-    })();
-    </script>
-  </body>
-</html>
diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/battery-created.html
--- a/battery/tests/submissions/anssik/battery-created.html	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Battery Status API Test Suite</title>
-    <script src="/resources/testharness.js"></script>
-    <link rel="stylesheet" href="/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>
-    <p>
-      This test validates that all of the navigator.battery attributes exist and are set to their default values.
-    </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 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/battery-discharging.html
--- a/battery/tests/submissions/anssik/battery-discharging.html	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Battery Status API Test Suite</title>
-    <script src="/resources/testharness.js"></script>
-    <script src="countdown.js"></script>
-    <link rel="stylesheet" href="/resources/testharness.css" media="all"/>
-    <meta name="flags" content="interact">
-  </head>
-  <body>
-    <h1>Description</h1>
-    <p>
-      This test validates that all of the navigator.battery attributes exist and are set to correct values, when the battery is discharging.
-    </p>
-    <h2>Preconditions</h2>
-    <ol>
-      <li>
-        The device is unplugged from the charger before this test is run.
-      </li>
-      <li>
-        The battery must neither be empty or full, nor reach empty or full capacity during the test.
-      </li>
-    </ol>
-    <p>
-      The highest prime number discovered so far is:  <output id="prime"></output>
-    </p>
-    <div id="log"></div>
-    <script>
-    (function() {
-
-      var t = 5*60*1000;
-      setup({ timeout: t });
-      countdown({ timeout: t });
-      
-      test(function() {
-        assert_false(navigator.battery.charging);
-      }, 'The charging attribute must be set to false.');
-      
-      test(function() {
-        assert_true(navigator.battery.chargingTime === Infinity);
-      }, 'The chargingTime attribute must be set to the value positive Infinity.');
-      
-      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. If the reported discharging time ' + navigator.battery.dischargingTime + ' seconds or ' + Math.round(navigator.battery.dischargingTime/60) + ' minutes is not correct, please indicate that the test has failed.');
-      
-      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');
-      
-      var onlevelchange_test = async_test('When the battery level is updated, must decrease the level attribute\'s value and fire a levelchange event. If the reported battery level ' + navigator.battery.level + ' is not correct, please indicate that the test has failed.');
-      var battery_level = navigator.battery.level;
-      
-      // compute primes to deplete the battery faster
-      var w = new Worker('prime.js');
-      w.postMessage('compute');
-      w.onmessage = function (e) {
-        document.querySelector('#prime').textContent = e.data;
-      };
-      
-      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 () {
-        w.terminate();
-      });
-      
-    })();
-    </script>
-  </body>
-</html>
diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/battery-full.html
--- a/battery/tests/submissions/anssik/battery-full.html	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Battery Status API Test Suite</title>
-    <script src="/resources/testharness.js"></script>
-    <link rel="stylesheet" href="/resources/testharness.css" media="all"/>
-    <meta name="flags" content="interact">
-  </head>
-  <body>
-    <h1>Description</h1>
-    <p>
-      This test validates that all of the navigator.battery attributes exist and are set to correct values, when the battery is full.
-    </p>
-    <h2>Preconditions</h2>
-    <ol>
-      <li>
-        The device is plugged in to the charger before this test 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 full (the "otherwise" condition).');
-      
-      test(function() {
-        assert_true(navigator.battery.chargingTime === 0);
-      }, 'The chargingTime attribute must be set to 0.');
-      
-      test(function() {
-        assert_true(navigator.battery.dischargingTime === Infinity);
-      }, 'The dischargingTime attribute must be set to the value positive Infinity (the "otherwise" condition).');
-      
-      test(function() {
-        assert_true(navigator.battery.level === 1.0);
-      }, 'The level attribute must be set to the value 1.0.');
-      
-    })();
-    </script>
-  </body>
-</html>
diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/battery-interface-idlharness.html
--- a/battery/tests/submissions/anssik/battery-interface-idlharness.html	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Battery Status API Test Suite</title>
-    <script src="/resources/testharness.js"></script>
-    <script src="/resources/testharnessreport.js"></script>
-    <script src="/resources/WebIDLParser.js"></script>
-    <script src="/resources/idlharness.js"></script>
-    <script type="text/plain" class="untested">
-    interface Navigator { };
-    
-    interface EventTarget {
-      void addEventListener(DOMString type, EventListener? callback, optional boolean capture);
-      void removeEventListener(DOMString type, EventListener? callback, optional boolean capture);
-      boolean dispatchEvent(Event event);
-    };
-    
-    [Callback]
-    interface EventListener {
-      void handleEvent(Event event);
-    };
-    </script>
-    <script type="text/plain">
-    partial interface Navigator {
-        readonly attribute BatteryManager battery;
-    };
-    
-    interface BatteryManager : EventTarget {
-        readonly attribute boolean             charging;
-        readonly attribute unrestricted double chargingTime;
-        readonly attribute unrestricted double dischargingTime;
-        readonly attribute double              level;
-                 attribute EventHandler        onchargingchange;
-                 attribute EventHandler        onchargingtimechange;
-                 attribute EventHandler        ondischargingtimechange;
-                 attribute EventHandler        onlevelchange;
-    };
-    </script>
-    <script>
-    "use strict";
-    var idl_array = new IdlArray();
-    var idls;
-    [].forEach.call(document.querySelectorAll('script[type=text\\/plain]'), function(node) {
-      // replace 'EventHandler' and 'unrestricted double' unrecognized by idlharness.js
-      idls = node.textContent.replace('EventHandler', 'Function?', 'g').replace('unrestricted double', 'double', 'g');
-      idl_array[(node.className === 'untested') ? 'add_untested_idls' : 'add_idls'](idls);
-    });
-    idl_array.add_objects({Navigator: ['navigator'], BatteryManager: ['navigator.battery']});
-    idl_array.test();
-    </script>
-  </head>
-  <body>
-    <h1>Description</h1>
-    <p>
-      This test validates the BatteryManager interface IDL.
-    </p>
-    <p>
-      This test uses <a href="/resources/idlharness.js">idlharness.js</a>, and
-      is complementary to the <a href="battery-interface.html">battery-interface.html</a>
-      test.
-    </p>
-    <div id="log"></div>
-    <p>
-      <small>
-        Distributed under both the
-        <a href="http://www.w3.org/Consortium/Legal/2008/04-testsuite-license">
-        W3C Test Suite License</a> and the
-        <a href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license">
-        W3C 3-clause BSD License</a>. To contribute to a W3C Test Suite, see the
-        <a href="http://www.w3.org/2004/10/27-testcases">policies and contribution
-        forms</a>.
-      </small>
-    </p>
-  </body>
-</html>
-
-
diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/battery-interface.html
--- a/battery/tests/submissions/anssik/battery-interface.html	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Battery Status API Test Suite</title>
-    <script src="/resources/testharness.js"></script>
-    <link rel="stylesheet" href="/resources/testharness.css" media="all"/>
-    <script src="battery-interface.js"></script>
-  </head>
-  <body>
-    <h1>Description</h1>
-    <p>
-      This test validates the BatteryManager interface IDL.
-    </p>
-
-    <div id="log"></div>
-    <p>
-      <small>
-        Distributed under both the
-        <a href="http://www.w3.org/Consortium/Legal/2008/04-testsuite-license">
-        W3C Test Suite License</a> and the
-        <a href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license">
-        W3C 3-clause BSD License</a>. To contribute to a W3C Test Suite, see the
-        <a href="http://www.w3.org/2004/10/27-testcases">policies and contribution
-        forms</a>.
-      </small>
-    </p>
-  </body>
-</html>
\ No newline at end of file
diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/battery-interface.js
--- a/battery/tests/submissions/anssik/battery-interface.js	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,393 +0,0 @@
-/**
-* W3C 3-clause BSD License
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are
-* met:
-* o Redistributions of works must retain the original copyright notice,
-*     this list of conditions and the following disclaimer.
-*
-* o Redistributions in binary form must reproduce the original copyright
-*     notice, this list of conditions and the following disclaimer in the
-*     documentation and/or other materials provided with the distribution.
-*
-* o Neither the name of the W3C nor the names of its contributors may be
-*     used to endorse or promote products derived from this work without
-*     specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-**/
-
-(function() {
-  
-  /**
-  *
-  * partial interface Navigator {
-  *     readonly attribute BatteryManager battery;
-  * };
-  *
-  */
-  
-  test(function() {
-    assert_idl_attribute(navigator, 'battery', 'navigator must have battery attribute');
-  }, 'battery is present on navigator');
-    
-  test(function() {
-    assert_readonly(navigator, 'battery', 'battery must be readonly');
-  }, 'battery is readonly');
-  
-  /**
-  *
-  * interface BatteryManager : EventTarget {
-  *     readonly attribute boolean             charging;
-  *     readonly attribute unrestricted double chargingTime;
-  *     readonly attribute unrestricted double dischargingTime;
-  *     readonly attribute double              level;
-  *              attribute EventHandler        onchargingchange;
-  *              attribute EventHandler        onchargingtimechange;
-  *              attribute EventHandler        ondischargingtimechange;
-  *              attribute EventHandler        onlevelchange;
-  * };
-  *
-  */
-
-  // interface BatteryManager : EventTarget {
-
-  test(function() {
-      assert_own_property(window, 'BatteryManager');
-  }, 'window has an own property BatteryManager');
-  
-  test(function() {
-      assert_true(navigator.battery instanceof EventTarget);
-  }, 'battery inherits from EventTarget');
-  
-  // readonly attribute boolean charging;
-  
-  test(function() {
-    assert_idl_attribute(navigator.battery, 'charging', 'battery must have charging attribute');
-  }, 'charging attribute exists');
-  
-  test(function() {
-    assert_readonly(navigator.battery, 'charging', 'charging must be readonly')
-  }, 'charging attribute is readonly');
-
-  // readonly attribute unrestricted double chargingTime;
-
-  test(function() {
-    assert_idl_attribute(navigator.battery, 'chargingTime', 'battery must have chargingTime attribute');
-  }, 'chargingTime attribute exists');
-
-  test(function() {
-    assert_readonly(navigator.battery, 'chargingTime', 'chargingTime must be readonly')
-  }, 'chargingTime attribute is readonly');
-
-  // readonly attribute unrestricted double dischargingTime;
-
-  test(function() {
-    assert_idl_attribute(navigator.battery, 'dischargingTime', 'battery must have dischargingTime attribute');
-  }, 'dischargingTime attribute exists');
-
-  test(function() {
-    assert_readonly(navigator.battery, 'dischargingTime', 'dischargingTime must be readonly')
-  }, 'dischargingTime attribute is readonly');
-  
-  // readonly attribute double level;
-  
-  test(function() {
-    assert_idl_attribute(navigator.battery, 'level', 'battery must have level attribute');
-  }, 'level attribute exists');
-
-  test(function() {
-    assert_readonly(navigator.battery, 'level', 'level must be readonly')
-  }, 'level attribute is readonly');
-  
-  // attribute EventHandler onchargingchange;
-  
-  test(function() {
-    assert_idl_attribute(navigator.battery, 'onchargingchange', 'battery must have onchargingchange attribute');
-  }, 'onchargingchange attribute exists');
-  
-  test(function() {
-    assert_equals(navigator.battery.onchargingchange, null, 'onchargingchange must be null')
-  }, 'onchargingchange is null');
-  
-  test(function() {
-      var desc = 'onchargingchange did not accept callable object',
-          func = function() {},
-          desc = 'Expected to find onchargingchange attribute on battery object';
-      assert_idl_attribute(navigator.battery, 'onchargingchange', desc);
-      window.onchargingchange = func;
-      assert_equals(window.onchargingchange, func, desc);
-  }, 'onchargingchange is set to function');
-  
-  test(function() {
-      var desc = 'onchargingchange did not treat noncallable as null';
-      navigator.battery.onchargingchange = function() {};
-      navigator.battery.onchargingchange = {};
-      assert_equals(navigator.battery.onchargingchange, null, desc);
-  }, 'onchargingchange: treat object as null');
-  
-  test(function() {
-      var desc = 'onchargingchange did not treat noncallable as null';
-      navigator.battery.onchargingchange = function() {};
-      navigator.battery.onchargingchange = {
-          call: 'test'
-      };
-      assert_equals(navigator.battery.onchargingchange, null, desc);
-  }, 'onchargingchange: treat object with non-callable call property as null');
-  
-  test(function() {
-      var desc = 'onchargingchange did not treat noncallable (string) as null';
-      navigator.battery.onchargingchange = function() {};
-      navigator.battery.onchargingchange = 'string';
-      assert_equals(navigator.battery.onchargingchange, null, desc);
-  }, 'onchargingchange: treat string as null');
-
-  test(function() {
-      var desc = 'onchargingchange did not treat noncallable (number) as null';
-      navigator.battery.onchargingchange = function() {};
-      navigator.battery.onchargingchange = 123;
-      assert_equals(navigator.battery.onchargingchange, null, desc);
-  }, 'onchargingchange: treat number as null');
-
-  test(function() {
-      var desc = 'onchargingchange did not treat noncallable (undefined) as null';
-      navigator.battery.onchargingchange = function() {};
-      navigator.battery.onchargingchange = undefined;
-      assert_equals(navigator.battery.onchargingchange, null, desc);
-  }, 'onchargingchange: treat undefined as null');
-
-  test(function() {
-      var desc = 'onchargingchange did not treat noncallable (array) as null';
-      navigator.battery.onchargingchange = function() {};
-      navigator.battery.onchargingchange = [];
-      assert_equals(navigator.battery.onchargingchange, null, desc);
-  }, 'onchargingchange: treat array as null');
-
-  test(function() {
-      var desc = 'onchargingchange did not treat noncallable host object as null';
-      navigator.battery.onchargingchange = function() {};
-      navigator.battery.onchargingchange = Node;
-      assert_equals(navigator.battery.onchargingchange, null, desc);
-  }, 'onchargingchange: treat non-callable host object as null');
-  
-  // attribute EventHandler onchargingtimechange;
-  
-  test(function() {
-    assert_idl_attribute(navigator.battery, 'onchargingtimechange', 'battery must have onchargingtimechange attribute');
-  }, 'onchargingtimechange attribute exists');
-  
-  test(function() {
-    assert_equals(navigator.battery.onchargingtimechange, null, 'onchargingtimechange must be null')
-  }, 'onchargingtimechange is null');
-
-  test(function() {
-      var desc = 'onchargingtimechange did not accept callable object',
-          func = function() {},
-          desc = 'Expected to find onchargingtimechange attribute on battery object';
-      assert_idl_attribute(navigator.battery, 'onchargingtimechange', desc);
-      window.onchargingtimechange = func;
-      assert_equals(window.onchargingtimechange, func, desc);
-  }, 'onchargingtimechange is set to function');
-
-  test(function() {
-      var desc = 'onchargingtimechange did not treat noncallable as null';
-      navigator.battery.onchargingtimechange = function() {};
-      navigator.battery.onchargingtimechange = {};
-      assert_equals(navigator.battery.onchargingtimechange, null, desc);
-  }, 'onchargingtimechange: treat object as null');
-
-  test(function() {
-      var desc = 'onchargingtimechange did not treat noncallable as null';
-      navigator.battery.onchargingtimechange = function() {};
-      navigator.battery.onchargingtimechange = {
-          call: 'test'
-      };
-      assert_equals(navigator.battery.onchargingtimechange, null, desc);
-  }, 'onchargingtimechange: treat object with non-callable call property as null');
-
-  test(function() {
-      var desc = 'onchargingtimechange did not treat noncallable (string) as null';
-      navigator.battery.onchargingtimechange = function() {};
-      navigator.battery.onchargingtimechange = 'string';
-      assert_equals(navigator.battery.onchargingtimechange, null, desc);
-  }, 'onchargingtimechange: treat string as null');
-
-  test(function() {
-      var desc = 'onchargingtimechange did not treat noncallable (number) as null';
-      navigator.battery.onchargingtimechange = function() {};
-      navigator.battery.onchargingtimechange = 123;
-      assert_equals(navigator.battery.onchargingtimechange, null, desc);
-  }, 'onchargingtimechange: treat number as null');
-
-  test(function() {
-      var desc = 'onchargingtimechange did not treat noncallable (undefined) as null';
-      navigator.battery.onchargingtimechange = function() {};
-      navigator.battery.onchargingtimechange = undefined;
-      assert_equals(navigator.battery.onchargingtimechange, null, desc);
-  }, 'onchargingtimechange: treat undefined as null');
-
-  test(function() {
-      var desc = 'onchargingtimechange did not treat noncallable (array) as null';
-      navigator.battery.onchargingtimechange = function() {};
-      navigator.battery.onchargingtimechange = [];
-      assert_equals(navigator.battery.onchargingtimechange, null, desc);
-  }, 'onchargingtimechange: treat array as null');
-
-  test(function() {
-      var desc = 'onchargingtimechange did not treat noncallable host object as null';
-      navigator.battery.onchargingtimechange = function() {};
-      navigator.battery.onchargingtimechange = Node;
-      assert_equals(navigator.battery.onchargingtimechange, null, desc);
-  }, 'onchargingtimechange: treat non-callable host object as null');
-    
-  // attribute EventHandler ondischargingtimechange;
-  
-  test(function() {
-    assert_idl_attribute(navigator.battery, 'ondischargingtimechange', 'battery must have ondischargingtimechange attribute');
-  }, 'ondischargingtimechange attribute exists');
-
-  test(function() {
-    assert_equals(navigator.battery.ondischargingtimechange, null, 'ondischargingtimechange must be null')
-  }, 'ondischargingtimechange is null');
-  
-  test(function() {
-      var desc = 'ondischargingtimechange did not accept callable object',
-          func = function() {},
-          desc = 'Expected to find ondischargingtimechange attribute on battery object';
-      assert_idl_attribute(navigator.battery, 'ondischargingtimechange', desc);
-      window.ondischargingtimechange = func;
-      assert_equals(window.ondischargingtimechange, func, desc);
-  }, 'ondischargingtimechange is set to function');
-
-  test(function() {
-      var desc = 'ondischargingtimechange did not treat noncallable as null';
-      navigator.battery.ondischargingtimechange = function() {};
-      navigator.battery.ondischargingtimechange = {};
-      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
-  }, 'ondischargingtimechange: treat object as null');
-
-  test(function() {
-      var desc = 'ondischargingtimechange did not treat noncallable as null';
-      navigator.battery.ondischargingtimechange = function() {};
-      navigator.battery.ondischargingtimechange = {
-          call: 'test'
-      };
-      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
-  }, 'ondischargingtimechange: treat object with non-callable call property as null');
-
-  test(function() {
-      var desc = 'ondischargingtimechange did not treat noncallable (string) as null';
-      navigator.battery.ondischargingtimechange = function() {};
-      navigator.battery.ondischargingtimechange = 'string';
-      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
-  }, 'ondischargingtimechange: treat string as null');
-
-  test(function() {
-      var desc = 'ondischargingtimechange did not treat noncallable (number) as null';
-      navigator.battery.ondischargingtimechange = function() {};
-      navigator.battery.ondischargingtimechange = 123;
-      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
-  }, 'ondischargingtimechange: treat number as null');
-
-  test(function() {
-      var desc = 'ondischargingtimechange did not treat noncallable (undefined) as null';
-      navigator.battery.ondischargingtimechange = function() {};
-      navigator.battery.ondischargingtimechange = undefined;
-      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
-  }, 'ondischargingtimechange: treat undefined as null');
-
-  test(function() {
-      var desc = 'ondischargingtimechange did not treat noncallable (array) as null';
-      navigator.battery.ondischargingtimechange = function() {};
-      navigator.battery.ondischargingtimechange = [];
-      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
-  }, 'ondischargingtimechange: treat array as null');
-
-  test(function() {
-      var desc = 'ondischargingtimechange did not treat noncallable host object as null';
-      navigator.battery.ondischargingtimechange = function() {};
-      navigator.battery.ondischargingtimechange = Node;
-      assert_equals(navigator.battery.ondischargingtimechange, null, desc);
-  }, 'ondischargingtimechange: treat non-callable host object as null');
-
-  // attribute EventHandler onlevelchange;
-
-  test(function() {
-    assert_idl_attribute(navigator.battery, 'onlevelchange', 'battery must have onlevelchange attribute');
-  }, 'onlevelchange attribute exists');
-  
-  test(function() {
-    assert_equals(navigator.battery.onlevelchange, null, 'onlevelchange must be null')
-  }, 'onlevelchange is null');
-  
-  test(function() {
-      var desc = 'onlevelchange did not accept callable object',
-          func = function() {},
-          desc = 'Expected to find onlevelchange attribute on battery object';
-      assert_idl_attribute(navigator.battery, 'onlevelchange', desc);
-      window.onlevelchange = func;
-      assert_equals(window.onlevelchange, func, desc);
-  }, 'onlevelchange is set to function');
-
-  test(function() {
-      var desc = 'onlevelchange did not treat noncallable as null';
-      navigator.battery.onlevelchange = function() {};
-      navigator.battery.onlevelchange = {};
-      assert_equals(navigator.battery.onlevelchange, null, desc);
-  }, 'onlevelchange: treat object as null');
-
-  test(function() {
-      var desc = 'onlevelchange did not treat noncallable as null';
-      navigator.battery.onlevelchange = function() {};
-      navigator.battery.onlevelchange = {
-          call: 'test'
-      };
-      assert_equals(navigator.battery.onlevelchange, null, desc);
-  }, 'onlevelchange: treat object with non-callable call property as null');
-
-  test(function() {
-      var desc = 'onlevelchange did not treat noncallable (string) as null';
-      navigator.battery.onlevelchange = function() {};
-      navigator.battery.onlevelchange = 'string';
-      assert_equals(navigator.battery.onlevelchange, null, desc);
-  }, 'onlevelchange: treat string as null');
-
-  test(function() {
-      var desc = 'onlevelchange did not treat noncallable (number) as null';
-      navigator.battery.onlevelchange = function() {};
-      navigator.battery.onlevelchange = 123;
-      assert_equals(navigator.battery.onlevelchange, null, desc);
-  }, 'onlevelchange: treat number as null');
-
-  test(function() {
-      var desc = 'onlevelchange did not treat noncallable (undefined) as null';
-      navigator.battery.onlevelchange = function() {};
-      navigator.battery.onlevelchange = undefined;
-      assert_equals(navigator.battery.onlevelchange, null, desc);
-  }, 'onlevelchange: treat undefined as null');
-
-  test(function() {
-      var desc = 'onlevelchange did not treat noncallable (array) as null';
-      navigator.battery.onlevelchange = function() {};
-      navigator.battery.onlevelchange = [];
-      assert_equals(navigator.battery.onlevelchange, null, desc);
-  }, 'onlevelchange: treat array as null');
-
-  test(function() {
-      var desc = 'onlevelchange did not treat noncallable host object as null';
-      navigator.battery.onlevelchange = function() {};
-      navigator.battery.onlevelchange = Node;
-      assert_equals(navigator.battery.onlevelchange, null, desc);
-  }, 'onlevelchange: treat non-callable host object as null');
-  
-})();
\ No newline at end of file
diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/battery-plugged-in.html
--- a/battery/tests/submissions/anssik/battery-plugged-in.html	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Battery Status API Test Suite</title>
-    <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>
-    <h1>Description</h1>
-    <p>
-      This test validates that all of the navigator.battery attributes exist and are set to correct values, with corresponding events fired, when the charger is plugged in.
-    </p>
-    <h2>Preconditions</h2>
-    <ol>
-      <li>
-        The device is unplugged from the charger before this test 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="note">
-      Plug in the charger and wait for all the tests to complete.
-    </div>
-    <div id="log"></div>
-    <script>
-    (function() {
-
-      var t = 5*60*1000;
-      setup({ timeout: t });
-      countdown({ timeout: t });
-      
-      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();
-      });
-      
-      var onchargingtimechange_test = async_test('When the device is plugged in and its charging time is updated, must set the chargingTime attribute\'s value and fire a chargingtimechange event. If the reported charging time ' + navigator.battery.chargingTime + ' seconds or ' + Math.round(navigator.battery.chargingTime/60) + ' minutes is not correct, please indicate that the test has failed.');
-      var battery_chargingtime = navigator.battery.chargingTime;
-      navigator.battery.onchargingtimechange = onchargingtimechange_test.step_func(function (e) {
-        assert_true(navigator.battery.chargingTime < battery_chargingtime, 'The value of the chargingTime attribute must decrease.');
-        onchargingtimechange_test.done();
-      });
-      
-      var ondischargingtimechange_test = async_test('When the device is plugged in and its discharging time is updated, must set the dischargingTime attribute\'s value to Infinity and fire a dischargingtimechange event.');
-      var battery_dischargingtime = navigator.battery.dischargingTime;
-      navigator.battery.ondischargingtimechange = ondischargingtimechange_test.step_func(function (e) {
-        assert_true(navigator.battery.dischargingTime === Infinity, 'The value of the dischargingTime attribute must be set to Infinity.');
-        ondischargingtimechange_test.done();
-      });
-      
-      var onlevelchange_test = async_test('When the device is plugged in and the battery level is updated, must set the level attribute\'s value and fire a levelchange event.');
-      var battery_level = navigator.battery.level;
-      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. If the reported battery level ' + navigator.battery.level + ' is not correct, please indicate that the test has failed.');
-        onlevelchange_test.done();
-      });
-      
-      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>
-</html>
diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/battery-unplugged.html
--- a/battery/tests/submissions/anssik/battery-unplugged.html	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>Battery Status API Test Suite</title>
-    <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>
-    <h1>Description</h1>
-    <p>
-      This test validates that all of the navigator.battery attributes exist and are set to correct values, with corresponding events fired, when the charger is unplugged.
-    </p>
-    <h2>Preconditions</h2>
-    <ol>
-      <li>
-        The device is plugged in to the charger before this test is run.
-      </li>
-      <li>
-        The battery must not be full or reach full capacity during the time the test is run.
-      </li>
-    </ol>
-    <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() {
-
-      var t = 5*60*1000;
-      setup({ timeout: t });
-      countdown({ timeout: t });
-      
-      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();
-      });
-      
-      var onchargingtimechange_test = async_test('When the device is unplugged in and its charging time is updated, must set the chargingTime attribute\'s value to Infinity and fire a chargingtimechange event.');
-      var battery_chargingtime = navigator.battery.chargingTime;
-      navigator.battery.onchargingtimechange = onchargingtimechange_test.step_func(function (e) {
-        assert_true(navigator.battery.chargingTime === Infinity, 'The value of the chargingTime attribute must be set to Infinity.');
-        onchargingtimechange_test.done();
-      });
-      
-      var ondischargingtimechange_test = async_test('When the device is unplugged in and its discharging time is updated, must set the dischargingTime attribute\'s value and fire a dischargingtimechange event.  If the reported discharging time ' + navigator.battery.dischargingTime + ' seconds or ' + Math.round(navigator.battery.dischargingTime/60) + ' minutes is not correct, please indicate that the test has failed.');
-      var battery_dischargingtime = navigator.battery.dischargingTime;
-      navigator.battery.ondischargingtimechange = ondischargingtimechange_test.step_func(function (e) {
-        assert_true(navigator.battery.dischargingTime < Infinity, 'The value of the dischargingTime attribute must be set to the remaining discharging time.');
-        ondischargingtimechange_test.done();
-      });
-      
-      var onlevelchange_test = async_test('When the device is plugged in and the battery level is updated, must set the level attribute\'s value and fire a levelchange event.');
-      var battery_level = navigator.battery.level;
-      
-      // compute primes to deplete the battery faster
-      var w = new Worker('prime.js');
-      w.postMessage('compute');
-      w.onmessage = function (e) {
-        document.querySelector('#prime').textContent = e.data;
-      };
-      
-      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();
-      });
-
-      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>
-</html>
diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/countdown.js
--- a/battery/tests/submissions/anssik/countdown.js	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-function countdown(prop) {
-  var seconds = !isNaN(parseInt(prop.timeout, 10)) ? (prop.timeout / 1000) : 0,
-      body = document.getElementsByTagName('body')[0],
-      div = document.createElement('div'),
-      timer, remaining_time, min, sec;
-
-  add_completion_callback(function () {
-    clearInterval(timer);
-    body.removeChild(div);
-  });
-  
-  div.innerHTML = 'This test will timeout in <span id="remaining_time">...</span>';
-  body.appendChild(div);
-    
-  remaining_time = document.querySelector('#remaining_time');
-  
-  timer = setInterval(function() {
-    function zeroPad(n) {
-      return (n < 10) ? '0' + n : n;
-    }
-  
-    if (seconds / 60 >= 1) {
-      min = Math.floor(seconds / 60);
-      sec = seconds % 60;
-    } else {
-      min = 0;
-      sec = seconds;
-    }
-    
-    if (seconds === 0) {
-      div.innerHTML = 'Timeout exceeded. Increase the timeout and re-run.';
-      clearInterval(timer);
-    }
-    
-    remaining_time.textContent = zeroPad(min) + ':' + zeroPad(sec);
-    seconds--;
-  }, 1000);
-}
diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/manifest.txt
--- a/battery/tests/submissions/anssik/manifest.txt	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-battery-interface.html		Battery Status API Test Suite					
-battery-charging.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					
-battery-plugged-in.html		Battery Status API Test Suite					
-battery-unplugged.html		Battery Status API Test Suite					
diff -r 6ff05ac6b442 -r de8e511256c2 battery/tests/submissions/anssik/prime.js
--- a/battery/tests/submissions/anssik/prime.js	Wed May 29 09:36:22 2013 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-// adapted from http://html5demos.com/worker
-
-var running = false;
-
-onmessage = function (event) {
-  // doesn't matter what the message is, just toggle the worker
-  if (running == false) {
-    running = true;
-    run(1);
-  } else {
-    running = false;
-  }
-};
-
-function run(n) {
-  // split the task into 20k chunks
-  var limit = n + 20000;
-  search: while (running && n < limit) {
-    n += 1;
-    for (var i = 2; i <= Math.sqrt(n); i += 1) {
-      if (n % i == 0) {
-        continue search;
-      }
-    }
-    // found a prime!
-    postMessage(n);
-  }
-  if (n === limit) {
-    // wait for the UI thread to update itself
-    setTimeout(function(start_time) {
-      // resume prime computation at n
-      run(n);
-    }, 150);
-  }
-}
\ No newline at end of file

Received on Thursday, 30 May 2013 12:48:15 UTC