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

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

Issue 23875002: Correctly update enabled state of the "create managed user" checkbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 7 years, 3 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
« no previous file with comments | « chrome/browser/resources/options/manage_profile_overlay.js ('k') | 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 2013 The Chromium Authors. All rights reserved. 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 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 // None of these tests is relevant for Chrome OS. 5 // None of these tests is relevant for Chrome OS.
6 GEN('#if !defined(OS_CHROMEOS)'); 6 GEN('#if !defined(OS_CHROMEOS)');
7 7
8 GEN('#include "base/command_line.h"'); 8 GEN('#include "base/command_line.h"');
9 GEN('#include "chrome/common/chrome_switches.h"'); 9 GEN('#include "chrome/common/chrome_switches.h"');
10 10
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 assertEquals('policy', indicator.getAttribute('controlled-by')); 294 assertEquals('policy', indicator.getAttribute('controlled-by'));
295 295
296 CreateProfileOverlay.updateSignedInStatus(custodianEmail); 296 CreateProfileOverlay.updateSignedInStatus(custodianEmail);
297 CreateProfileOverlay.updateManagedUsersAllowed(true); 297 CreateProfileOverlay.updateManagedUsersAllowed(true);
298 assertFalse(checkbox.disabled, 're-allowed and signed in'); 298 assertFalse(checkbox.disabled, 're-allowed and signed in');
299 assertFalse(link.hidden, 're-allowed and signed in'); 299 assertFalse(link.hidden, 're-allowed and signed in');
300 assertEquals('none', window.getComputedStyle(indicator, null).display, 300 assertEquals('none', window.getComputedStyle(indicator, null).display,
301 're-allowed and signed in'); 301 're-allowed and signed in');
302 }); 302 });
303 303
304 // The managed user checkbox should correctly update its state during profile
305 // creation and afterwards.
306 TEST_F('ManageProfileUITest', 'CreateInProgress', function() {
307 ManageProfileOverlay.getInstance().initializePage();
308
309 var custodianEmail = 'chrome.playpen.test@gmail.com';
310 CreateProfileOverlay.updateSignedInStatus(custodianEmail);
311 CreateProfileOverlay.updateManagedUsersAllowed(true);
312 var checkbox = $('create-profile-managed');
313 var link = $('create-profile-managed-not-signed-in-link');
314 var indicator = $('create-profile-managed-indicator');
315
316 assertFalse(checkbox.disabled, 'allowed and signed in');
317 assertFalse(link.hidden, 'allowed and signed in');
318 assertEquals('none', window.getComputedStyle(indicator, null).display,
319 'allowed and signed in');
320 assertFalse(indicator.hasAttribute('controlled-by'));
321
322 CreateProfileOverlay.updateCreateInProgress(true);
323 assertTrue(checkbox.disabled, 'creation in progress');
324
325 // A no-op update to the sign-in status should not change the UI.
326 CreateProfileOverlay.updateSignedInStatus(custodianEmail);
327 CreateProfileOverlay.updateManagedUsersAllowed(true);
328 assertTrue(checkbox.disabled, 'creation in progress');
329
330 CreateProfileOverlay.updateCreateInProgress(false);
331 assertFalse(checkbox.disabled, 'creation finished');
332 });
333
304 // Managed users shouldn't be able to open the delete or create dialogs. 334 // Managed users shouldn't be able to open the delete or create dialogs.
305 TEST_F('ManageProfileUITest', 'ManagedShowDeleteAndCreate', function() { 335 TEST_F('ManageProfileUITest', 'ManagedShowDeleteAndCreate', function() {
306 this.setProfileManaged_(false); 336 this.setProfileManaged_(false);
307 337
308 ManageProfileOverlay.showCreateDialog(); 338 ManageProfileOverlay.showCreateDialog();
309 assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name); 339 assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name);
310 OptionsPage.closeOverlay(); 340 OptionsPage.closeOverlay();
311 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); 341 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
312 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false)); 342 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false));
313 assertEquals('manageProfile', OptionsPage.getTopmostVisiblePage().name); 343 assertEquals('manageProfile', OptionsPage.getTopmostVisiblePage().name);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); 379 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
350 380
351 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false)); 381 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false));
352 this.setProfileManaged_(true); 382 this.setProfileManaged_(true);
353 messages = clickAndListen(); 383 messages = clickAndListen();
354 assertEquals(0, messages.length); 384 assertEquals(0, messages.length);
355 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); 385 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
356 }); 386 });
357 387
358 GEN('#endif // OS_CHROMEOS'); 388 GEN('#endif // OS_CHROMEOS');
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/manage_profile_overlay.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698