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

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

Issue 403343002: Rename "managed (mode|user)" to "supervised user" (part 8) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/options/options_browsertest.h"'); 5 GEN('#include "chrome/browser/ui/webui/options/options_browsertest.h"');
6 6
7 /** @const */ var MANAGED_USERS_PREF = 'profile.managed_users'; 7 /** @const */ var SUPERVISED_USERS_PREF = 'profile.managed_users';
8 8
9 /** 9 /**
10 * Wait for the method specified by |methodName|, on the |object| object, to be 10 * Wait for the method specified by |methodName|, on the |object| object, to be
11 * called, then execute |afterFunction|. 11 * called, then execute |afterFunction|.
12 * @param {*} object Object with callable property named |methodName|. 12 * @param {*} object Object with callable property named |methodName|.
13 * @param {string} methodName The name of the property on |object| to use as a 13 * @param {string} methodName The name of the property on |object| to use as a
14 * callback. 14 * callback.
15 * @param {!Function} afterFunction A function to call after object.methodName() 15 * @param {!Function} afterFunction A function to call after object.methodName()
16 * is called. 16 * is called.
17 */ 17 */
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 window.setTimeout(function() { 236 window.setTimeout(function() {
237 assertFalse(dntOverlay.visible); 237 assertFalse(dntOverlay.visible);
238 assertTrue(dntCheckbox.checked); 238 assertTrue(dntCheckbox.checked);
239 dntOverlay.removeEventListener(visibleChangeHandler); 239 dntOverlay.removeEventListener(visibleChangeHandler);
240 dntCheckbox.click(); 240 dntCheckbox.click();
241 }, 0); 241 }, 0);
242 break; 242 break;
243 default: 243 default:
244 assertNotReached(); 244 assertNotReached();
245 } 245 }
246 } 246 };
247 dntOverlay.addEventListener('visibleChange', visibleChangeHandler); 247 dntOverlay.addEventListener('visibleChange', visibleChangeHandler);
248 248
249 this.mockHandler.expects(once()).setBooleanPref( 249 this.mockHandler.expects(once()).setBooleanPref(
250 eq(['enable_do_not_track', true, 'Options_DoNotTrackCheckbox'])); 250 eq(['enable_do_not_track', true, 'Options_DoNotTrackCheckbox']));
251 251
252 var verifyCorrectEndState = function() { 252 var verifyCorrectEndState = function() {
253 window.setTimeout(function() { 253 window.setTimeout(function() {
254 assertFalse(dntOverlay.visible); 254 assertFalse(dntOverlay.visible);
255 assertFalse(dntCheckbox.checked); 255 assertFalse(dntCheckbox.checked);
256 testDone(); 256 testDone();
257 }, 0); 257 }, 0);
258 } 258 };
259 this.mockHandler.expects(once()).setBooleanPref( 259 this.mockHandler.expects(once()).setBooleanPref(
260 eq(['enable_do_not_track', false, 'Options_DoNotTrackCheckbox'])).will( 260 eq(['enable_do_not_track', false, 'Options_DoNotTrackCheckbox'])).will(
261 callFunction(verifyCorrectEndState)); 261 callFunction(verifyCorrectEndState));
262 262
263 dntCheckbox.click(); 263 dntCheckbox.click();
264 }); 264 });
265 265
266 // Verify that preventDefault() is called on 'Enter' keydown events that trigger 266 // Verify that preventDefault() is called on 'Enter' keydown events that trigger
267 // the default button. If this doesn't happen, other elements that may get 267 // the default button. If this doesn't happen, other elements that may get
268 // focus (by the overlay closing for instance), will execute in addition to the 268 // focus (by the overlay closing for instance), will execute in addition to the
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 __proto__: testing.Test.prototype, 365 __proto__: testing.Test.prototype,
366 366
367 /** @override */ 367 /** @override */
368 browsePreload: 'chrome://settings-frame', 368 browsePreload: 'chrome://settings-frame',
369 369
370 /** @override */ 370 /** @override */
371 typedefCppFixture: 'OptionsBrowserTest', 371 typedefCppFixture: 'OptionsBrowserTest',
372 372
373 testGenPreamble: function() { 373 testGenPreamble: function() {
374 // Start with no supervised users managed by this profile. 374 // Start with no supervised users managed by this profile.
375 GEN(' ClearPref("' + MANAGED_USERS_PREF + '");'); 375 GEN(' ClearPref("' + SUPERVISED_USERS_PREF + '");');
376 }, 376 },
377 377
378 /** @override */ 378 /** @override */
379 isAsync: true, 379 isAsync: true,
380 380
381 /** @override */ 381 /** @override */
382 setUp: function() { 382 setUp: function() {
383 // user-image-stream is a streaming video element used for capturing a 383 // user-image-stream is a streaming video element used for capturing a
384 // user image during OOBE. 384 // user image during OOBE.
385 this.accessibilityAuditConfig.ignoreSelectors('videoWithoutCaptions', 385 this.accessibilityAuditConfig.ignoreSelectors('videoWithoutCaptions',
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 802
803 // A tip should be shown or hidden depending on whether this profile manages any 803 // A tip should be shown or hidden depending on whether this profile manages any
804 // supervised users. 804 // supervised users.
805 TEST_F('OptionsWebUIExtendedTest', 'SupervisingUsers', function() { 805 TEST_F('OptionsWebUIExtendedTest', 'SupervisingUsers', function() {
806 // We start managing no supervised users. 806 // We start managing no supervised users.
807 assertTrue($('profiles-supervised-dashboard-tip').hidden); 807 assertTrue($('profiles-supervised-dashboard-tip').hidden);
808 808
809 // Remove all supervised users, then add some, watching for the pref change 809 // Remove all supervised users, then add some, watching for the pref change
810 // notifications and UI updates in each case. Any non-empty pref dictionary 810 // notifications and UI updates in each case. Any non-empty pref dictionary
811 // is interpreted as having supervised users. 811 // is interpreted as having supervised users.
812 chrome.send('optionsTestSetPref', [MANAGED_USERS_PREF, {key: 'value'}]); 812 chrome.send('optionsTestSetPref', [SUPERVISED_USERS_PREF, {key: 'value'}]);
813 waitForResponse(BrowserOptions, 'updateManagesSupervisedUsers', function() { 813 waitForResponse(BrowserOptions, 'updateManagesSupervisedUsers', function() {
814 assertFalse($('profiles-supervised-dashboard-tip').hidden); 814 assertFalse($('profiles-supervised-dashboard-tip').hidden);
815 chrome.send('optionsTestSetPref', [MANAGED_USERS_PREF, {}]); 815 chrome.send('optionsTestSetPref', [SUPERVISED_USERS_PREF, {}]);
816 waitForResponse(BrowserOptions, 'updateManagesSupervisedUsers', function() { 816 waitForResponse(BrowserOptions, 'updateManagesSupervisedUsers', function() {
817 assertTrue($('profiles-supervised-dashboard-tip').hidden); 817 assertTrue($('profiles-supervised-dashboard-tip').hidden);
818 testDone(); 818 testDone();
819 }); 819 });
820 }); 820 });
821 }); 821 });
822 822
823 /** 823 /**
824 * TestFixture that loads the options page at a bogus URL. 824 * TestFixture that loads the options page at a bogus URL.
825 * @extends {OptionsWebUIExtendedTest} 825 * @extends {OptionsWebUIExtendedTest}
826 * @constructor 826 * @constructor
827 */ 827 */
828 function OptionsWebUIRedirectTest() { 828 function OptionsWebUIRedirectTest() {
829 OptionsWebUIExtendedTest.call(this); 829 OptionsWebUIExtendedTest.call(this);
830 } 830 }
831 831
832 OptionsWebUIRedirectTest.prototype = { 832 OptionsWebUIRedirectTest.prototype = {
833 __proto__: OptionsWebUIExtendedTest.prototype, 833 __proto__: OptionsWebUIExtendedTest.prototype,
834 834
835 /** @override */ 835 /** @override */
836 browsePreload: 'chrome://settings-frame/nonexistantPage', 836 browsePreload: 'chrome://settings-frame/nonexistantPage',
837 }; 837 };
838 838
839 TEST_F('OptionsWebUIRedirectTest', 'TestURL', function() { 839 TEST_F('OptionsWebUIRedirectTest', 'TestURL', function() {
840 assertEquals('chrome://settings-frame/', document.location.href); 840 assertEquals('chrome://settings-frame/', document.location.href);
841 this.verifyHistory_([''], testDone); 841 this.verifyHistory_([''], testDone);
842 }); 842 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698