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