Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/guest_mode_options_browsertest.js

Issue 1760313003: Make GuestModeOptionsUIBrowserTest inherit from OptionsBrowsertestBase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 GEN_INCLUDE(['../options_browsertest_base.js']);
5 GEN('#include "chrome/browser/ui/webui/options/chromeos/' + 6 GEN('#include "chrome/browser/ui/webui/options/chromeos/' +
6 'guest_mode_options_browsertest.h"'); 7 'guest_mode_options_browsertest.h"');
7 8
8 /** 9 /**
9 * TestFixture for guest mode options WebUI testing. 10 * TestFixture for guest mode options WebUI testing.
10 * @extends {testing.Test} 11 * @extends {OptionsBrowsertestBase}
11 * @constructor 12 * @constructor
12 */ 13 */
13 function GuestModeOptionsUIBrowserTest() {} 14 function GuestModeOptionsUIBrowserTest() {}
14 15
15 GuestModeOptionsUIBrowserTest.prototype = { 16 GuestModeOptionsUIBrowserTest.prototype = {
16 __proto__: testing.Test.prototype, 17 __proto__: OptionsBrowsertestBase.prototype,
17 18
18 /** @override */ 19 /** @override */
19 browsePreload: 'chrome://settings-frame', 20 browsePreload: 'chrome://settings-frame',
20 21
21 /** @override */ 22 /** @override */
22 typedefCppFixture: 'GuestModeOptionsUIBrowserTest', 23 typedefCppFixture: 'GuestModeOptionsUIBrowserTest',
23 24
24 /** 25 /**
25 * Returns the element that sets a given preference, failing if no such 26 * Returns the element that sets a given preference, failing if no such
26 * element is found. 27 * element is found.
27 * @param {string} pref Name of the preference. 28 * @param {string} pref Name of the preference.
28 * @return {!HTMLElement} The element controlling the preference. 29 * @return {!HTMLElement} The element controlling the preference.
29 */ 30 */
30 getControlForPref: function(pref) { 31 getControlForPref: function(pref) {
31 var control = document.querySelector('[pref="' + pref + '"]'); 32 var control = document.querySelector('[pref="' + pref + '"]');
32 assertTrue(!!control); 33 assertTrue(!!control);
33 return control; 34 return control;
34 }, 35 },
35 36
36 /** @param {!HTMLElement} el */ 37 /** @param {!HTMLElement} el */
37 expectHidden: function(el) { 38 expectHidden: function(el) {
38 expectFalse(el.offsetHeight > 0 && el.offsetWidth > 0); 39 expectFalse(el.offsetHeight > 0 && el.offsetWidth > 0);
39 }, 40 },
40 }; 41 };
41 42
42 /** 43 /** Test sections that should be hidden in guest mode. */
43 * Test sections that should be hidden in guest mode. 44 TEST_F('GuestModeOptionsUIBrowserTest', 'testSections', function() {
44 * TODO(michaelpg): Debug flakiness: crbug.com/591154.
45 */
46 TEST_F('GuestModeOptionsUIBrowserTest', 'DISABLED_testSections', function() {
47 this.expectHidden($('startup-section')); 45 this.expectHidden($('startup-section'));
48 this.expectHidden($('appearance-section')); 46 this.expectHidden($('appearance-section'));
49 this.expectHidden($('andorid-apps-section')); 47 this.expectHidden($('andorid-apps-section'));
50 this.expectHidden($('sync-users-section')); 48 this.expectHidden($('sync-users-section'));
51 this.expectHidden($('easy-unlock-section')); 49 this.expectHidden($('easy-unlock-section'));
52 this.expectHidden($('reset-profile-settings-section')); 50 this.expectHidden($('reset-profile-settings-section'));
53 }); 51 });
54 52
55 /** 53 /** Test controls that should be disabled in guest mode. */
56 * Test controls that should be disabled in guest mode. 54 TEST_F('GuestModeOptionsUIBrowserTest', 'testControls', function() {
57 * TODO(michaelpg): Debug flakiness: crbug.com/591154.
58 */
59 TEST_F('GuestModeOptionsUIBrowserTest', 'DISABLED_testControls', function() {
60 // Appearance section. 55 // Appearance section.
61 var setWallpaper = $('set-wallpaper'); 56 var setWallpaper = $('set-wallpaper');
62 expectTrue(setWallpaper.disabled); 57 expectTrue(setWallpaper.disabled);
63 58
64 // Passwords and autofill section. 59 // Passwords and autofill section.
65 expectTrue($('autofill-enabled').disabled); 60 expectTrue($('autofill-enabled').disabled);
66 61
67 // Date and time section. 62 // Date and time section.
68 expectTrue($('timezone-value-select').disabled); 63 expectTrue($('timezone-value-select').disabled);
69 expectFalse($('resolve-timezone-by-geolocation').disabled); 64 expectFalse($('resolve-timezone-by-geolocation').disabled);
70 expectFalse($('use-24hour-clock').disabled); 65 expectFalse($('use-24hour-clock').disabled);
71 66
72 // Privacy section. 67 // Privacy section.
73 expectTrue(this.getControlForPref('search.suggest_enabled').disabled); 68 expectTrue(this.getControlForPref('search.suggest_enabled').disabled);
74 expectTrue($('networkPredictionOptions').disabled); 69 expectTrue($('networkPredictionOptions').disabled);
75 70
76 // Web content section. 71 // Web content section.
77 expectTrue($('defaultZoomFactor').disabled); 72 expectTrue($('defaultZoomFactor').disabled);
78 73
79 // Downloads section. 74 // Downloads section.
80 expectTrue(this.getControlForPref('gdata.disabled').disabled); 75 expectTrue(this.getControlForPref('gdata.disabled').disabled);
81 76
82 // Content settings overlay. 77 // Content settings overlay.
83 expectTrue(this.getControlForPref('settings.privacy.drm_enabled').disabled); 78 expectTrue(this.getControlForPref('settings.privacy.drm_enabled').disabled);
84 expectTrue($('protected-content-exceptions').disabled); 79 expectTrue($('protected-content-exceptions').disabled);
85 }); 80 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698