Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 function WebUIAssertionsTest() {} | 5 function WebUIAssertionsTest() {} |
| 6 | 6 |
| 7 WebUIAssertionsTest.prototype = { | 7 WebUIAssertionsTest.prototype = { |
| 8 __proto__: testing.Test.prototype, | 8 __proto__: testing.Test.prototype, |
| 9 browsePreload: DUMMY_URL, | 9 browsePreload: DUMMY_URL, |
| 10 }; | 10 }; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 TEST_F('WebUIAssertionsTest', 'testConstructedMessage', function() { | 52 TEST_F('WebUIAssertionsTest', 'testConstructedMessage', function() { |
| 53 var result = runTestFunction( | 53 var result = runTestFunction( |
| 54 'testConstructMessage', testConstructMessage, []); | 54 'testConstructMessage', testConstructMessage, []); |
| 55 resetTestState(); | 55 resetTestState(); |
| 56 | 56 |
| 57 expectEquals( | 57 expectEquals( |
| 58 1, result[1].match(/assertTrue\(false, message\): 1 2: false/g).length); | 58 1, result[1].match(/assertTrue\(false, message\): 1 2: false/g).length); |
| 59 }); | 59 }); |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * Async version of WebUIAssertionsTest. | 62 * Failing version of WebUIAssertionsTest. |
| 63 * @extends WebUIAssertionsTest | |
| 64 * @constructor | |
| 65 */ | |
| 66 function WebUIAssertionsTestFail() {} | |
| 67 | |
| 68 WebUIAssertionsTestFail.prototype = { | |
| 69 __proto__: WebUIAssertionsTest.prototype, | |
| 70 | |
| 71 /** @inheritDoc */ | |
| 72 testShouldFail: true, | |
| 73 }; | |
| 74 | |
| 75 // Test that an assertion failure fails test. | |
| 76 TEST_F('WebUIAssertionsTestFail', 'testAssertFailFails', function() { | |
| 77 assertNotReached(); | |
| 78 }); | |
| 79 | |
| 80 // Test that an expect failure fails test. | |
|
Sheridan Rawlins
2011/10/28 20:51:20
FYI, this is the <new> test, which failed before t
| |
| 81 TEST_F('WebUIAssertionsTestFail', 'testExpectFailFails', function() { | |
| 82 expectNotReached(); | |
| 83 }); | |
| 84 | |
| 85 /** | |
| 86 * Async version of WebUIAssertionsTestFail. | |
| 63 * @extends WebUIAssertionsTest | 87 * @extends WebUIAssertionsTest |
| 64 * @constructor | 88 * @constructor |
| 65 */ | 89 */ |
| 66 function WebUIAssertionsTestAsyncFail() {} | 90 function WebUIAssertionsTestAsyncFail() {} |
| 67 | 91 |
| 68 WebUIAssertionsTestAsyncFail.prototype = { | 92 WebUIAssertionsTestAsyncFail.prototype = { |
| 69 __proto__: WebUIAssertionsTest.prototype, | 93 __proto__: WebUIAssertionsTestFail.prototype, |
| 70 | 94 |
| 71 /** @inheritDoc */ | 95 /** @inheritDoc */ |
| 72 isAsync: true, | 96 isAsync: true, |
| 73 | |
| 74 /** @inheritDoc */ | |
| 75 testShouldFail: true, | |
| 76 }; | 97 }; |
| 77 | 98 |
| 78 // Test that an assertion failure doesn't hang forever. | 99 // Test that an assertion failure doesn't hang forever. |
| 79 TEST_F('WebUIAssertionsTestAsyncFail', 'testAsyncFailCallsDone', function() { | 100 TEST_F('WebUIAssertionsTestAsyncFail', 'testAsyncFailCallsDone', function() { |
| 80 assertNotReached(); | 101 assertNotReached(); |
| 81 }); | 102 }); |
| OLD | NEW |