summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/battery-status/battery-interface-idlharness.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/battery-status/battery-interface-idlharness.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/battery-status/battery-interface-idlharness.html')
-rw-r--r--testing/web-platform/tests/battery-status/battery-interface-idlharness.html74
1 files changed, 74 insertions, 0 deletions
diff --git a/testing/web-platform/tests/battery-status/battery-interface-idlharness.html b/testing/web-platform/tests/battery-status/battery-interface-idlharness.html
new file mode 100644
index 000000000..4e9b209d4
--- /dev/null
+++ b/testing/web-platform/tests/battery-status/battery-interface-idlharness.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Battery test: IDL</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);
+};
+[TreatNonObjectAsNull]
+callback EventHandlerNonNull = any (Event event);
+typedef EventHandlerNonNull? EventHandler;
+</script>
+<script type="text/plain">
+partial interface Navigator {
+ Promise<BatteryManager> getBattery ();
+};
+
+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 t = async_test();
+var idl_array = new IdlArray();
+var idls;
+var manager;
+[].forEach.call(document.querySelectorAll('script[type=text\\/plain]'), function(node) {
+ idls = node.textContent;
+ idl_array[(node.className === 'untested') ? 'add_untested_idls' : 'add_idls'](idls);
+});
+t.step(function() {
+ assert_idl_attribute(navigator, 'getBattery', 'navigator must have getBattery attribute');
+ navigator.getBattery().then(function(bm) {
+ manager = bm;
+ idl_array.add_objects({Navigator: ['navigator'], BatteryManager: ['manager']});
+ idl_array.test();
+ t.done();
+ }).catch(function(err) {
+ t.assert_unreached("navigator.getBattery failed");
+ });
+});
+</script>
+
+<h2>Description</h2>
+<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>