OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** @fileoverview Suite of tests for the Settings basic page. */ | 5 /** @fileoverview Suite of tests for the Settings basic page. */ |
6 | 6 |
7 GEN_INCLUDE(['settings_page_browsertest.js']); | 7 GEN_INCLUDE(['settings_page_browsertest.js']); |
8 | 8 |
9 /** | 9 /** |
10 * @constructor | 10 * @constructor |
11 * @extends {SettingsPageBrowserTest} | 11 * @extends {SettingsPageBrowserTest} |
12 */ | 12 */ |
13 function SettingsBasicPageBrowserTest() {} | 13 function SettingsBasicPageBrowserTest() {} |
14 | 14 |
15 SettingsBasicPageBrowserTest.prototype = { | 15 SettingsBasicPageBrowserTest.prototype = { |
16 __proto__: SettingsPageBrowserTest.prototype, | 16 __proto__: SettingsPageBrowserTest.prototype, |
17 | 17 |
18 /** @override */ | 18 /** @override */ |
19 extraLibraries: SettingsPageBrowserTest.prototype.extraLibraries.concat([ | 19 extraLibraries: SettingsPageBrowserTest.prototype.extraLibraries.concat([ |
20 'test_browser_proxy.js', | 20 '../test_browser_proxy.js', |
21 ]), | 21 ]), |
22 }; | 22 }; |
23 | 23 |
24 // Times out on debug builders because the Settings page can take several | 24 // Times out on debug builders because the Settings page can take several |
25 // seconds to load in a Release build and several times that in a Debug build. | 25 // seconds to load in a Release build and several times that in a Debug build. |
26 // See https://crbug.com/558434. | 26 // See https://crbug.com/558434. |
27 GEN('#if !defined(NDEBUG)'); | 27 GEN('#if !defined(NDEBUG)'); |
28 GEN('#define MAYBE_Load DISABLED_Load'); | 28 GEN('#define MAYBE_Load DISABLED_Load'); |
29 GEN('#else'); | 29 GEN('#else'); |
30 GEN('#define MAYBE_Load Load'); | 30 GEN('#define MAYBE_Load Load'); |
31 GEN('#endif'); | 31 GEN('#endif'); |
32 | 32 |
33 TEST_F('SettingsBasicPageBrowserTest', 'MAYBE_Load', function() { | 33 TEST_F('SettingsBasicPageBrowserTest', 'MAYBE_Load', function() { |
34 // Assign |self| to |this| instead of binding since 'this' in suite() | 34 // Assign |self| to |this| instead of binding since 'this' in suite() |
35 // and test() will be a Mocha 'Suite' or 'Test' instance. | 35 // and test() will be a Mocha 'Suite' or 'Test' instance. |
36 var self = this; | 36 var self = this; |
37 | 37 |
38 /** | 38 /** |
39 * This fake SearchManager just hides and re-displays the sections on search. | 39 * This fake SearchManager just hides and re-displays the sections on search. |
40 * | 40 * |
41 * @implements {SearchManager} | 41 * @implements {SearchManager} |
42 * @extends {settings.TestBrowserProxy} | 42 * @extends {TestBrowserProxy} |
43 */ | 43 */ |
44 var TestSearchManager = function() { | 44 var TestSearchManager = function() { |
45 settings.TestBrowserProxy.call(this, [ | 45 TestBrowserProxy.call(this, [ |
46 'search', | 46 'search', |
47 ]); | 47 ]); |
48 | 48 |
49 /** @private {?settings.SearchRequest} */ | 49 /** @private {?settings.SearchRequest} */ |
50 this.searchRequest_ = null; | 50 this.searchRequest_ = null; |
51 } | 51 } |
52 | 52 |
53 TestSearchManager.prototype = { | 53 TestSearchManager.prototype = { |
54 __proto__: settings.TestBrowserProxy.prototype, | 54 __proto__: TestBrowserProxy.prototype, |
55 | 55 |
56 /** @override */ | 56 /** @override */ |
57 search: function(text, page) { | 57 search: function(text, page) { |
58 if (this.searchRequest_ == null || !this.searchRequest_.isSame(text)) { | 58 if (this.searchRequest_ == null || !this.searchRequest_.isSame(text)) { |
59 this.searchRequest_ = new settings.SearchRequest( | 59 this.searchRequest_ = new settings.SearchRequest( |
60 text, document.createElement('div')); | 60 text, document.createElement('div')); |
61 this.searchRequest_.finished = true; | 61 this.searchRequest_.finished = true; |
62 this.searchRequest_.updateMatches(false); | 62 this.searchRequest_.updateMatches(false); |
63 | 63 |
64 // The search much be resolved asynchronously just like the real | 64 // The search much be resolved asynchronously just like the real |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 assertNotEquals(0, page.scroller.scrollTop); | 173 assertNotEquals(0, page.scroller.scrollTop); |
174 | 174 |
175 settings.navigateTo(settings.Route.ABOUT); | 175 settings.navigateTo(settings.Route.ABOUT); |
176 assertEquals(0, page.scroller.scrollTop); | 176 assertEquals(0, page.scroller.scrollTop); |
177 }); | 177 }); |
178 }); | 178 }); |
179 | 179 |
180 // Run all registered tests. | 180 // Run all registered tests. |
181 mocha.run(); | 181 mocha.run(); |
182 }); | 182 }); |
OLD | NEW |