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 | 18 |
19 // Times out on debug builders and may time out on memory bots because | 19 // Times out on debug builders and may time out on memory bots because |
20 // the Settings page can take several seconds to load in a Release build | 20 // the Settings page can take several seconds to load in a Release build |
21 // and several times that in a Debug build. See https://crbug.com/558434. | 21 // and several times that in a Debug build. See https://crbug.com/558434. |
22 GEN('#if defined(MEMORY_SANITIZER) || !defined(NDEBUG)'); | 22 GEN('#if defined(MEMORY_SANITIZER) || !defined(NDEBUG)'); |
23 GEN('#define MAYBE_Load DISABLED_Main'); | 23 GEN('#define MAYBE_Load DISABLED_Load'); |
24 GEN('#else'); | 24 GEN('#else'); |
25 GEN('#define MAYBE_Load Main'); | 25 GEN('#define MAYBE_Load Load'); |
26 GEN('#endif'); | 26 GEN('#endif'); |
27 | 27 |
28 TEST_F('SettingsBasicPageBrowserTest', 'MAYBE_Load', function() { | 28 TEST_F('SettingsBasicPageBrowserTest', 'MAYBE_Load', function() { |
29 // Assign |self| to |this| instead of binding since 'this' in suite() | 29 // Assign |self| to |this| instead of binding since 'this' in suite() |
30 // and test() will be a Mocha 'Suite' or 'Test' instance. | 30 // and test() will be a Mocha 'Suite' or 'Test' instance. |
31 var self = this; | 31 var self = this; |
32 | 32 |
33 // Register mocha tests. | 33 // Register mocha tests. |
34 suite('SettingsPage', function() { | 34 suite('SettingsPage', function() { |
35 test('load page', function() { | 35 test('load page', function() { |
36 // This will fail if there are any asserts or errors in the Settings page. | 36 // This will fail if there are any asserts or errors in the Settings page. |
37 }); | 37 }); |
38 | 38 |
39 test('basic pages', function() { | 39 test('basic pages', function() { |
40 var page = self.getPage('basic'); | 40 var page = self.getPage('basic'); |
| 41 var sections = ['appearance', 'onStartup', 'people', 'search']; |
41 expectTrue(!!self.getSection(page, 'appearance')); | 42 expectTrue(!!self.getSection(page, 'appearance')); |
42 expectTrue(!!self.getSection(page, 'onStartup')); | 43 if (!cr.isChromeOS) |
43 expectTrue(!!self.getSection(page, 'people')); | 44 sections.push('defaultBrowser'); |
44 expectTrue(!!self.getSection(page, 'search')); | 45 else |
45 if (!cr.isChromeOS) { | 46 sections = sections.concat(['internet', 'device']); |
46 expectTrue(!!self.getSection(page, 'defaultBrowser')); | 47 |
47 } else { | 48 for (var i = 0; i < sections.length; i++) { |
48 expectTrue(!!self.getSection(page, 'internet')); | 49 var section = self.getSection(page, sections[i]); |
49 expectTrue(!!self.getSection(page, 'device')); | 50 expectTrue(!!section); |
| 51 self.verifySubpagesHidden(section); |
50 } | 52 } |
51 }); | 53 }); |
52 }); | 54 }); |
53 | 55 |
54 // Run all registered tests. | 56 // Run all registered tests. |
55 mocha.run(); | 57 mocha.run(); |
56 }); | 58 }); |
OLD | NEW |