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

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: . 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 CreateProfileOverlay.updateCreateInProgress(false);
Pam (message me for reviews) 2013/09/05 10:08:38 This test wouldn't have caught the bug. We must ha
Bernhard Bauer 2013/09/05 12:49:14 Good catch! Yeah, ProfileSyncService is quite libe
326 assertFalse(checkbox.disabled, 'creation finished');
327 });
328
304 // Managed users shouldn't be able to open the delete or create dialogs. 329 // Managed users shouldn't be able to open the delete or create dialogs.
305 TEST_F('ManageProfileUITest', 'ManagedShowDeleteAndCreate', function() { 330 TEST_F('ManageProfileUITest', 'ManagedShowDeleteAndCreate', function() {
306 this.setProfileManaged_(false); 331 this.setProfileManaged_(false);
307 332
308 ManageProfileOverlay.showCreateDialog(); 333 ManageProfileOverlay.showCreateDialog();
309 assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name); 334 assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name);
310 OptionsPage.closeOverlay(); 335 OptionsPage.closeOverlay();
311 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); 336 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
312 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false)); 337 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false));
313 assertEquals('manageProfile', OptionsPage.getTopmostVisiblePage().name); 338 assertEquals('manageProfile', OptionsPage.getTopmostVisiblePage().name);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); 374 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
350 375
351 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false)); 376 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false));
352 this.setProfileManaged_(true); 377 this.setProfileManaged_(true);
353 messages = clickAndListen(); 378 messages = clickAndListen();
354 assertEquals(0, messages.length); 379 assertEquals(0, messages.length);
355 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); 380 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
356 }); 381 });
357 382
358 GEN('#endif // OS_CHROMEOS'); 383 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