Bug 817643 - Separate the test for each iframe. r=hsivonen
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Thu, 06 Dec 2012 08:17:32 +0900
changeset 115523 ded1b2e2d6be59211de07a4b10aed4c97bc88a95
parent 115522 45907821616dcd910a2b07f9363c5cf985d16322
child 115524 a4c6ce2b95a19c4883a80ac6ad33d2a5c2b62b50
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewershsivonen
bugs817643
milestone20.0a1
Bug 817643 - Separate the test for each iframe. r=hsivonen
dom/encoding/test/test_utf16_files.html
--- a/dom/encoding/test/test_utf16_files.html
+++ b/dom/encoding/test/test_utf16_files.html
@@ -23,33 +23,31 @@ function runTest() {
   test(function() {
     assert_equals(document.styleSheets[0].cssRules[0].selectorText, ".css1", ".css1 should exist.");
     assert_equals(document.styleSheets[1].cssRules[0].selectorText, ".css2", ".css2 should exist.");
   }, "Test loading utf-16 css files");
   test(function() {
     assert_equals(js1, "Unicåde", "js1 should be defined.");
     assert_equals(js2, "Unicåde", "js2 should be defined.");
   }, "Test loading utf-16 javascript files");
-  var t = async_test("Test loading various utf-16 files");
-  var count = 3;
-  ifr1.onload = ifr1.onerror = ifr2.onload = ifr2.onerror = function() {
-    var ifr = this;
-    t.step(function() {
-      assert_true(ifr.document.body instanceof HTMLBodyElement, ifr.name + " should load.");
-    });
-    if (!--count) {
+  var tests = [
+    {ifr: ifr1, fails: false, name: "Test loading utf-16, big endian, with BOM"},
+    {ifr: ifr2, fails: false, name: "Test loading utf-16, little endian, with BOM"},
+    {ifr: ifr3, fails: true, name: "Test loading utf-16le xml fails"},
+  ];
+  tests.forEach(function(test) {
+    var t = async_test(test.name);
+    var fails = test.fails;
+    var ifr = test.ifr;
+    ifr.onload = ifr.onerror = function() {
+      t.step(fails ? function() {
+        assert_equals(ifr.document.body, null, ifr.name + " should NOT load.");
+      } : function() {
+        assert_true(ifr.document.body instanceof HTMLBodyElement, ifr.name + " should load.");
+      });
       t.done();
-    }
-  };
-  ifr3.onload = ifr3.onerror = function() {
-    var ifr = this;
-    t.step(function() {
-      assert_equals(ifr.document.body, null, ifr.name + " should NOT load.");
-    });
-    if (!--count) {
-      t.done();
-    }
-  };
+    };
+  });
 }
 
 </script>
 </body>
 </html>