added idl test for mediastreamtrack object
authorDominique Hazael-Massieux <dom@w3.org>
Thu, 30 May 2013 15:50:04 +0200
changeset 38 76c7d79886ac
parent 37 bb87c0d0d7e6
child 39 1491f380b3b5
added idl test for mediastreamtrack object
submitted/W3C/mediastreamtrack-init.html
--- a/submitted/W3C/mediastreamtrack-init.html	Thu May 30 15:48:54 2013 +0200
+++ b/submitted/W3C/mediastreamtrack-init.html	Thu May 30 15:50:04 2013 +0200
@@ -14,21 +14,59 @@
 <div id='log'></div>
 <script src=/resources/testharness.js></script>
 <script src=/resources/testharnessreport.js></script>
+<script src=/resources/webidl2/lib/webidl2.js></script>
+<script src=/resources/idlharness.js></script>
 <script src=featuredetection.js></script>
 <script src=prefix.js></script>
 <script>
-var t = async_test("Tests that the video MediaStreamTrack objects are properly initialized");
+var t = async_test("Tests that the video MediaStreamTrack objects are properly initialized", {timeout:10000});
+var track = null
+var idl_array = new IdlArray();
+idl_array.add_idls("interface EventTarget {\
+  void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false);\
+  void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false);\
+  boolean dispatchEvent(Event event);\
+};");
+
+/*idl_array.add_idls("callback interface EventListener {\
+  void handleEvent(Event event);\
+};");*/
+idl_array.add_idls("interface MediaStreamTrack : EventTarget {\
+    readonly    attribute DOMString             kind;\
+    readonly    attribute DOMString             id;\
+    readonly    attribute DOMString             label;\
+                attribute boolean               enabled;\
+    readonly    attribute boolean               muted;\
+                attribute EventHandler          onmute;\
+                attribute EventHandler          onunmute;\
+    readonly    attribute boolean               _readonly;\
+    readonly    attribute boolean               remote;\
+    readonly    attribute MediaStreamTrackState readyState;\
+                attribute EventHandler          onstarted;\
+                attribute EventHandler          onended;\
+    static sequence<SourceInfo>                    getSourceInfos ();\
+    MediaTrackConstraints?                         constraints ();\
+    MediaSourceStates                              states ();\
+    (AllVideoCapabilities or AllAudioCapabilities) capabilities ();\
+    void                                           applyConstraints (MediaTrackConstraints constraints);\
+                attribute EventHandler          onoverconstrained;\
+    MediaStreamTrack                               clone ();\
+    void                                           stop ();\
+};");
+
 t.step(function () {
   navigator.getUserMedia({video: true}, t.step_func(function (stream) {
     var videoTracks = stream.getVideoTracks();
     assert_equals(videoTracks.length, 1, "There is exactly one video track in the media stream");
-    var track = videoTracks[0];
-    assert_true(track instanceof MediaStreamTrack, "The track object is an instance of MediaStreamTrack");
+    track = videoTracks[0];
     assert_equals(track.readyState, "live", "The track object is in live state");
-      assert_equals(track.kind, "video", "The track object is of video kind");
-      assert_true(track.enabled, "The track object is enabed"); // Not clear that this is required by the spec, see https://www.w3.org/Bugs/Public/show_bug.cgi?id=22212
+    assert_equals(track.kind, "video", "The track object is of video kind");
+    assert_true(track.enabled, "The track object is enabed"); // Not clear that this is required by the spec, see https://www.w3.org/Bugs/Public/show_bug.cgi?id=22212
+    idl_array.add_objects({MediaStreamTrack: ["track"]});
+    idl_array.test();
+
     t.done();
-  }));
+  }), function (error) {});
 });
 </script>
 </body>