define the EventTarget as an untested interface
authorAnssi Kostiainen <anssi.kostiainen@nokia.com>
Mon, 25 Feb 2013 13:06:28 +0200
changeset 396 1375b4c4b759
parent 395 eb6f23519b41
child 397 7d43f1efc56f
define the EventTarget as an untested interface
battery/tests/submissions/anssik/battery-interface-idlharness.html
--- a/battery/tests/submissions/anssik/battery-interface-idlharness.html	Fri Feb 22 16:31:00 2013 +0200
+++ b/battery/tests/submissions/anssik/battery-interface-idlharness.html	Mon Feb 25 13:06:28 2013 +0200
@@ -6,6 +6,20 @@
     <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;
@@ -23,13 +37,15 @@
     };
     </script>
     <script>
+    "use strict";
     var idl_array = new IdlArray();
-    idl_array.add_untested_idls('interface Navigator { };');
-    var idls = document.querySelector('script[type=text\\/plain]').textContent;
-    // replace 'EventHandler' and 'unrestricted double' unrecognized by idlharness.js
-    idls = idls.replace('EventHandler', 'Function?', 'g').replace('unrestricted double', 'double', 'g');
-    idl_array.add_idls(idls);
-    idl_array.add_objects({Navigator: ["navigator"], BatteryManager: ["navigator.battery"]});
+    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>