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

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

Issue 2913343002: Start removing deprecated Options UI code (Closed)
Patch Set: thestig@ review Created 3 years, 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 GEN_INCLUDE(['../options_browsertest_base.js']);
6 GEN('#include "chrome/browser/ui/webui/options/chromeos/' +
7 'guest_mode_options_browsertest.h"');
8
9 /**
10 * TestFixture for guest mode options WebUI testing.
11 * @extends {OptionsBrowsertestBase}
12 * @constructor
13 */
14 function GuestModeOptionsUIBrowserTest() {}
15
16 GuestModeOptionsUIBrowserTest.prototype = {
17 __proto__: OptionsBrowsertestBase.prototype,
18
19 /** @override */
20 browsePreload: 'chrome://settings-frame',
21
22 /** @override */
23 typedefCppFixture: 'GuestModeOptionsUIBrowserTest',
24
25 /**
26 * Returns the element that sets a given preference, failing if no such
27 * element is found.
28 * @param {string} pref Name of the preference.
29 * @return {!HTMLElement} The element controlling the preference.
30 */
31 getControlForPref: function(pref) {
32 var control = document.querySelector('[pref="' + pref + '"]');
33 assertTrue(!!control);
34 return control;
35 },
36
37 /** @param {!HTMLElement} el */
38 expectHidden: function(el) {
39 expectFalse(el.offsetHeight > 0 && el.offsetWidth > 0);
40 },
41 };
42
43 /** Test sections that should be hidden in guest mode. */
44 TEST_F('GuestModeOptionsUIBrowserTest', 'testSections', function() {
45 this.expectHidden($('startup-section'));
46 this.expectHidden($('appearance-section'));
47 this.expectHidden($('android-apps-section'));
48 this.expectHidden($('sync-users-section'));
49 this.expectHidden($('easy-unlock-section'));
50 this.expectHidden($('reset-profile-settings-section'));
51 });
52
53 /** Test controls that should be disabled in guest mode. */
54 TEST_F('GuestModeOptionsUIBrowserTest', 'testControls', function() {
55 // Appearance section.
56 var setWallpaper = $('set-wallpaper');
57 expectTrue(setWallpaper.disabled);
58
59 // Passwords and autofill section.
60 expectTrue($('autofill-enabled').disabled);
61
62 // Date and time section.
63 expectTrue($('timezone-value-select').disabled);
64 expectFalse($('resolve-timezone-by-geolocation').disabled);
65 expectFalse($('use-24hour-clock').disabled);
66
67 // Privacy section.
68 expectTrue(this.getControlForPref('search.suggest_enabled').disabled);
69 expectTrue($('networkPredictionOptions').disabled);
70
71 // Web content section.
72 expectTrue($('defaultZoomFactor').disabled);
73
74 // Downloads section.
75 expectTrue(this.getControlForPref('gdata.disabled').disabled);
76
77 // Content settings overlay.
78 expectTrue(this.getControlForPref('settings.privacy.drm_enabled').disabled);
79 expectTrue($('protected-content-exceptions').disabled);
80 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698