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