Reviewers: MikeSamuel,

Description:
1. one of the tests wants popup blockers to be disabled,
and tries to tell you that.  on safari, when window.open
is blocked, it returns undefined instead of null, so the
test was failing without a useful diagnostic.

2. at the moment, the test summary in the title relies on
explicit calls to jsunit.pass().  two tests were missing
that call, so a successful result was "0/11 fail, 9/11 pass".

Please review this at http://codereview.appspot.com/125053

Affected files:
  M     tests/com/google/caja/browser-expectations.html


Index: tests/com/google/caja/browser-expectations.html
===================================================================
--- tests/com/google/caja/browser-expectations.html     (revision 3761)
+++ tests/com/google/caja/browser-expectations.html     (working copy)
@@ -298,9 +298,14 @@
     });
     jsunitRegister('testIdsAsTargets',
                    function testIdsAsTargets() {
+      function note(msg) {
+        var el = document.getElementById('test-ids-as-targets');
+        el.innerHTML = 'testIdsAsTargets: ' + msg;
+        return msg;
+      }
       var w = window.open();
-      if (w === null) {
-        fail('Popup blocker must be disabled for this test.');
+      if (w === null || w === undefined) {
+        fail(note('FAIL: Popup blocker must be disabled for this test.'));
       }
       w.close();
       document.getElementById('test-ids-as-targets-1-form').submit();
@@ -310,10 +315,10 @@
         var loc = document.
             getElementById('test-ids-as-targets-1').contentWindow.location;
       } catch (e) {
-        fail('This browser allows ids as targets');
+        fail(note('FAIL: This browser allows ids as targets'));
       }
-      document.getElementById('test-ids-as-targets').
-          innerHTML = 'testIdsAsTargets passed.';
+      note('Passed.');
+      jsunit.pass();
     });
     </script>

@@ -391,6 +396,7 @@
       assertThrows(function () { return ({}) instanceof {}; });
       assertThrows(function () { return ({}) instanceof null; });
       assertThrows(function () { return ({}) instanceof undefined; });
+      jsunit.pass();
     });
     </script>



Reply via email to