Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 if (window.layoutTestController) | 1 if (window.layoutTestController) |
| 2 layoutTestController.dumpAsText(); | 2 layoutTestController.dumpAsText(); |
| 3 | 3 |
| 4 function description(msg) | 4 function description(msg) |
| 5 { | 5 { |
| 6 // For MSIE 6 compatibility | 6 // For MSIE 6 compatibility |
| 7 var span = document.createElement("span"); | 7 var span = document.createElement("span"); |
| 8 span.innerHTML = '<p>' + msg + '</p><p>On success, you will see a series of "<span class="pass">PASS</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>'; | 8 span.innerHTML = '<p>' + msg + '</p><p>On success, you will see a series of "<span class="pass">PASS</span>" messages, followed by "<span class="pass">TEST COMPLETE</span>".</p>'; |
| 9 var description = document.getElementById("description"); | 9 var description = document.getElementById("description"); |
| 10 if (description.firstChild) | 10 if (description.firstChild) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 else if (typeof(_av) == typeof(_bv)) | 76 else if (typeof(_av) == typeof(_bv)) |
| 77 testFailed(_a + " should be " + _bv + ". Was " + _av + "."); | 77 testFailed(_a + " should be " + _bv + ". Was " + _av + "."); |
| 78 else | 78 else |
| 79 testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ")."); | 79 testFailed(_a + " should be " + _bv + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ")."); |
| 80 } | 80 } |
| 81 | 81 |
| 82 function shouldBeTrue(_a) { shouldBe(_a, "true"); } | 82 function shouldBeTrue(_a) { shouldBe(_a, "true"); } |
| 83 function shouldBeFalse(_a) { shouldBe(_a, "false"); } | 83 function shouldBeFalse(_a) { shouldBe(_a, "false"); } |
| 84 function shouldBeNaN(_a) { shouldBe(_a, "NaN"); } | 84 function shouldBeNaN(_a) { shouldBe(_a, "NaN"); } |
| 85 | 85 |
| 86 function shouldBeNull(_a) | |
| 87 { | |
| 88 var exception; | |
| 89 var _av; | |
| 90 try { | |
| 91 _av = eval(_a); | |
| 92 } catch (e) { | |
| 93 exception = e; | |
| 94 } | |
| 95 | |
| 96 if (exception) | |
| 97 testFailed(_a + " should be null. Threw exception " + exception); | |
| 98 else if (_av == null) | |
| 99 testPassed(_a + " is null."); | |
| 100 else | |
| 101 testFailed(_a + " should be null. was " + _av); | |
| 102 } | |
|
Pam (message me for reviews)
2009/04/16 21:59:31
function shouldBeNull() already exists in the real
| |
| 103 | |
| 86 function shouldBeUndefined(_a) | 104 function shouldBeUndefined(_a) |
| 87 { | 105 { |
| 88 var exception; | 106 var exception; |
| 89 var _av; | 107 var _av; |
| 90 try { | 108 try { |
| 91 _av = eval(_a); | 109 _av = eval(_a); |
| 92 } catch (e) { | 110 } catch (e) { |
| 93 exception = e; | 111 exception = e; |
| 94 } | 112 } |
| 95 | 113 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 exception = e; | 157 exception = e; |
| 140 } | 158 } |
| 141 | 159 |
| 142 var exceptionType = exception ? exception.toString().split(":")[0] : undefined ; | 160 var exceptionType = exception ? exception.toString().split(":")[0] : undefined ; |
| 143 | 161 |
| 144 if (exception instanceof _e) | 162 if (exception instanceof _e) |
| 145 testPassed(_a + " threw exception " + exceptionType + "."); | 163 testPassed(_a + " threw exception " + exceptionType + "."); |
| 146 else | 164 else |
| 147 testFailed(_a + " should throw exception " + _e + ". Threw exception " + exc eptionType + "."); | 165 testFailed(_a + " should throw exception " + _e + ". Threw exception " + exc eptionType + "."); |
| 148 } | 166 } |
| OLD | NEW |