OLD | NEW |
| (Empty) |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * TestFixture for App Launcher's Settings App testing. | |
7 * @extends {testing.Test} | |
8 * @constructor | |
9 */ | |
10 function SettingsAppWebUITest() {} | |
11 | |
12 SettingsAppWebUITest.prototype = { | |
13 __proto__: testing.Test.prototype, | |
14 | |
15 /** | |
16 * Browse to Settings App page, in a browser. | |
17 */ | |
18 browsePreload: 'chrome://settings-frame/options_settings_app.html', | |
19 }; | |
20 | |
21 GEN('#if defined(ENABLE_SETTINGS_APP)'); | |
22 | |
23 // This test is flaky on Linux and Windows bots. See crbug.com/579666 | |
24 GEN('#if defined(OS_LINUX) || defined(OS_WIN)'); | |
25 GEN('#define MAYBE_testOpenSettingsApp DISABLED_testOpenSettingsApp'); | |
26 GEN('#else'); | |
27 GEN('#define MAYBE_testOpenSettingsApp testOpenSettingsApp'); | |
28 GEN('#endif // defined(OS_LINUX) || defined(OS_WIN)'); | |
29 // Test opening Settings App, and do some checks on section visibility. | |
30 TEST_F('SettingsAppWebUITest', 'MAYBE_testOpenSettingsApp', function() { | |
31 // Note there is no location bar in the Settings App. | |
32 | |
33 // Some things are hidden via a parent, so make a helper function. | |
34 function isVisible(elementId) { | |
35 var elem = $(elementId); | |
36 return elem.offsetWidth > 0 || elem.offsetHeight > 0; | |
37 } | |
38 assertTrue(OptionsPage.isSettingsApp()); | |
39 assertTrue(isVisible('sync-users-section')); | |
40 assertTrue(isVisible('sync-section')); | |
41 | |
42 // Spot-check some regular settings items that should be hidden. | |
43 assertFalse(isVisible('change-home-page-section')); | |
44 assertFalse(isVisible('default-search-engine')); | |
45 assertFalse(isVisible('hotword-search')); | |
46 assertFalse(isVisible('privacy-section')); | |
47 assertFalse(isVisible('startup-section')); | |
48 }); | |
49 | |
50 // This test is flaky on Linux and Windows bot. See crbug.com/579666 | |
51 GEN('#if defined(OS_LINUX) || defined(OS_WIN)'); | |
52 GEN('#define MAYBE_testStrings DISABLED_testStrings'); | |
53 GEN('#else'); | |
54 GEN('#define MAYBE_testStrings testStrings'); | |
55 GEN('#endif // defined(OS_LINUX) || defined(OS_WIN)'); | |
56 // Check functionality of LoadTimeData.overrideValues(), which the Settings App | |
57 // uses. Do spot checks, so the test is not too fragile. Some of the content | |
58 // strings rely on waiting for sync sign-in status, or platform-specifics. | |
59 TEST_F('SettingsAppWebUITest', 'MAYBE_testStrings', function() { | |
60 // Ensure we check against the override values. | |
61 assertTrue(!!loadTimeData.getValue('settingsApp')); | |
62 | |
63 // Check a product-specific label, to ensure it uses "App Launcher", and not | |
64 // Chrome / Chromium. | |
65 var languagesLabelElement = | |
66 document.querySelector('[i18n-content="languageSectionLabel"]'); | |
67 assertNotEquals(-1, languagesLabelElement.innerHTML.indexOf('App Launcher')); | |
68 }); | |
69 | |
70 GEN('#endif // defined(ENABLE_SETTINGS_APP)'); | |
OLD | NEW |