| 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 /** | 5 /** |
| 6 * Test fixture for generated async tests. | 6 * Test fixture for generated async tests. |
| 7 * @extends {testing.Test} | 7 * @extends {testing.Test} |
| 8 */ | 8 */ |
| 9 function WebUIBrowserAsyncGenTest() {} | 9 function WebUIBrowserAsyncGenTest() {} |
| 10 | 10 |
| 11 WebUIBrowserAsyncGenTest.prototype = { | 11 WebUIBrowserAsyncGenTest.prototype = { |
| 12 __proto__: testing.Test.prototype, | 12 __proto__: testing.Test.prototype, |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Define the C++ class and include it. | 15 * Define the C++ class and include it. |
| 16 * @type {?string} | 16 * @type {?string} |
| 17 * @override | 17 * @override |
| 18 */ | 18 */ |
| 19 typedefCppFixture: null, | 19 typedefCppFixture: null, |
| 20 | 20 |
| 21 /** @inheritDoc */ | 21 /** @inheritDoc */ |
| 22 tearDown: function() { | 22 tearDown: function() { |
| 23 expectFalse(this.tornDown); | 23 expectFalse(this.tornDown); |
| 24 expectFalse(this.running); | 24 expectFalse(this.running); |
| 25 this.tornDown = true; | 25 this.tornDown = true; |
| 26 chrome.send('tornDown'); | 26 chrome.send('tearDown'); |
| 27 testing.Test.prototype.tearDown.call(this); | 27 testing.Test.prototype.tearDown.call(this); |
| 28 }, | 28 }, |
| 29 | 29 |
| 30 /** @inheritDoc */ | 30 /** @inheritDoc */ |
| 31 browsePreload: DUMMY_URL, | 31 browsePreload: DUMMY_URL, |
| 32 | 32 |
| 33 /** @inheritDoc */ | 33 /** @inheritDoc */ |
| 34 isAsync: true, | 34 isAsync: true, |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * True when the tearDown method is called. | 37 * True when the tearDown method is called. |
| 38 * @type {boolean} | 38 * @type {boolean} |
| 39 */ | 39 */ |
| 40 tornDown: false, | 40 tornDown: false, |
| 41 | 41 |
| 42 /** | 42 /** |
| 43 * True when running sync portion of test. | 43 * True when running sync portion of test. |
| 44 * @type {boolean} | 44 * @type {boolean} |
| 45 */ | 45 */ |
| 46 running: false, | 46 running: false, |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // Include the bulk of c++ code. | 49 // Include the c++ test fixture. |
| 50 GEN('#include "chrome/test/data/webui/async_gen-inl.h"'); | 50 GEN('#include "chrome/test/data/webui/async_gen.h"'); |
| 51 GEN(''); | |
| 52 | |
| 53 // Constructors and destructors must be provided in .cc to prevent clang errors. | |
| 54 GEN('WebUIBrowserAsyncGenTest::WebUIBrowserAsyncGenTest() {}'); | |
| 55 GEN('WebUIBrowserAsyncGenTest::~WebUIBrowserAsyncGenTest() {}'); | |
| 56 GEN('WebUIBrowserAsyncGenTest::AsyncWebUIMessageHandler::'); | |
| 57 GEN(' AsyncWebUIMessageHandler() {}'); | |
| 58 GEN('WebUIBrowserAsyncGenTest::AsyncWebUIMessageHandler::'); | |
| 59 GEN(' ~AsyncWebUIMessageHandler() {}'); | |
| 60 GEN(''); | |
| 61 | 51 |
| 62 /** | 52 /** |
| 63 * Will be set to continuation test #1. | 53 * Will be set to continuation test #1. |
| 64 * @type {Function} | 54 * @type {Function} |
| 65 * @this {WebUIBrowserAsyncGenTest} | 55 * @this {WebUIBrowserAsyncGenTest} |
| 66 */ | 56 */ |
| 67 var continueTest; | 57 var continueTest; |
| 68 | 58 |
| 69 /** | 59 /** |
| 70 * Will be set to continuation test #2. | 60 * Will be set to continuation test #2. |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // Cause setTestRanTrue to be invoked asynchronously. | 266 // Cause setTestRanTrue to be invoked asynchronously. |
| 277 chrome.send('callJS', ['setTestRanTrue']); | 267 chrome.send('callJS', ['setTestRanTrue']); |
| 278 }, | 268 }, |
| 279 }; | 269 }; |
| 280 | 270 |
| 281 TEST_F('WebUIBrowserAsyncGenDeferredToGlobalTest', 'TestDeferRunTestToGlobal', | 271 TEST_F('WebUIBrowserAsyncGenDeferredToGlobalTest', 'TestDeferRunTestToGlobal', |
| 282 function() { | 272 function() { |
| 283 this.ranTest_ = true; | 273 this.ranTest_ = true; |
| 284 assertTrue(testRan); | 274 assertTrue(testRan); |
| 285 }); | 275 }); |
| OLD | NEW |