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

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

Issue 445003002: Supervised users: UI updates for new-profile-management launch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests 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 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 /** 8 /**
9 * TestFixture for ManageProfileOverlay and CreateProfileOverlay WebUI testing. 9 * TestFixture for ManageProfileOverlay and CreateProfileOverlay WebUI testing.
10 * @extends {testing.Test} 10 * @extends {testing.Test}
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 }); 422 });
423 423
424 // The policy prohibiting supervised users should update the UI dynamically. 424 // The policy prohibiting supervised users should update the UI dynamically.
425 TEST_F('ManageProfileUITest', 'PolicyDynamicRefresh', function() { 425 TEST_F('ManageProfileUITest', 'PolicyDynamicRefresh', function() {
426 ManageProfileOverlay.getInstance().initializePage(); 426 ManageProfileOverlay.getInstance().initializePage();
427 427
428 var custodianEmail = 'chrome.playpen.test@gmail.com'; 428 var custodianEmail = 'chrome.playpen.test@gmail.com';
429 CreateProfileOverlay.updateSignedInStatus(custodianEmail); 429 CreateProfileOverlay.updateSignedInStatus(custodianEmail);
430 CreateProfileOverlay.updateSupervisedUsersAllowed(true); 430 CreateProfileOverlay.updateSupervisedUsersAllowed(true);
431 var checkbox = $('create-profile-supervised'); 431 var checkbox = $('create-profile-supervised');
432 var link = $('create-profile-supervised-not-signed-in-link'); 432 var signInPromo = $('create-profile-supervised-not-signed-in');
433 var signInLink = $('create-profile-supervised-sign-in-link');
433 var indicator = $('create-profile-supervised-indicator'); 434 var indicator = $('create-profile-supervised-indicator');
434 435
435 assertFalse(checkbox.disabled, 'allowed and signed in'); 436 assertFalse(checkbox.disabled, 'allowed and signed in');
436 assertFalse(link.hidden, 'allowed and signed in'); 437 assertTrue(signInPromo.hidden, 'allowed and signed in');
437 assertEquals('none', window.getComputedStyle(indicator, null).display, 438 assertEquals('none', window.getComputedStyle(indicator, null).display,
438 'allowed and signed in'); 439 'allowed and signed in');
439 440
440 CreateProfileOverlay.updateSignedInStatus(''); 441 CreateProfileOverlay.updateSignedInStatus('');
441 CreateProfileOverlay.updateSupervisedUsersAllowed(true); 442 CreateProfileOverlay.updateSupervisedUsersAllowed(true);
442 assertTrue(checkbox.disabled, 'allowed, not signed in'); 443 assertTrue(checkbox.disabled, 'allowed, not signed in');
443 assertFalse(link.hidden, 'allowed, not signed in'); 444 assertFalse(signInPromo.hidden, 'allowed, not signed in');
445 assertTrue(signInLink.enabled, 'allowed, not signed in');
444 assertEquals('none', window.getComputedStyle(indicator, null).display, 446 assertEquals('none', window.getComputedStyle(indicator, null).display,
445 'allowed, not signed in'); 447 'allowed, not signed in');
446 448
447 CreateProfileOverlay.updateSignedInStatus(''); 449 CreateProfileOverlay.updateSignedInStatus('');
448 CreateProfileOverlay.updateSupervisedUsersAllowed(false); 450 CreateProfileOverlay.updateSupervisedUsersAllowed(false);
449 assertTrue(checkbox.disabled, 'disallowed, not signed in'); 451 assertTrue(checkbox.disabled, 'disallowed, not signed in');
450 assertTrue(link.hidden, 'disallowed, not signed in'); 452 assertFalse(signInPromo.hidden, 'disallowed, not signed in');
453 assertFalse(signInLink.enabled, 'disallowed, not signed in');
451 assertEquals('inline-block', window.getComputedStyle(indicator, null).display, 454 assertEquals('inline-block', window.getComputedStyle(indicator, null).display,
452 'disallowed, not signed in'); 455 'disallowed, not signed in');
453 assertEquals('policy', indicator.getAttribute('controlled-by')); 456 assertEquals('policy', indicator.getAttribute('controlled-by'));
454 457
455 CreateProfileOverlay.updateSignedInStatus(custodianEmail); 458 CreateProfileOverlay.updateSignedInStatus(custodianEmail);
456 CreateProfileOverlay.updateSupervisedUsersAllowed(false); 459 CreateProfileOverlay.updateSupervisedUsersAllowed(false);
457 assertTrue(checkbox.disabled, 'disallowed, signed in'); 460 assertTrue(checkbox.disabled, 'disallowed, signed in');
458 assertTrue(link.hidden, 'disallowed, signed in'); 461 assertTrue(signInPromo.hidden, 'disallowed, signed in');
459 assertEquals('inline-block', window.getComputedStyle(indicator, null).display, 462 assertEquals('inline-block', window.getComputedStyle(indicator, null).display,
460 'disallowed, signed in'); 463 'disallowed, signed in');
461 assertEquals('policy', indicator.getAttribute('controlled-by')); 464 assertEquals('policy', indicator.getAttribute('controlled-by'));
462 465
463 CreateProfileOverlay.updateSignedInStatus(custodianEmail); 466 CreateProfileOverlay.updateSignedInStatus(custodianEmail);
464 CreateProfileOverlay.updateSupervisedUsersAllowed(true); 467 CreateProfileOverlay.updateSupervisedUsersAllowed(true);
465 assertFalse(checkbox.disabled, 're-allowed and signed in'); 468 assertFalse(checkbox.disabled, 're-allowed and signed in');
466 assertFalse(link.hidden, 're-allowed and signed in'); 469 assertTrue(signInPromo.hidden, 're-allowed and signed in');
467 assertEquals('none', window.getComputedStyle(indicator, null).display, 470 assertEquals('none', window.getComputedStyle(indicator, null).display,
468 're-allowed and signed in'); 471 're-allowed and signed in');
469 }); 472 });
470 473
471 // The supervised user checkbox should correctly update its state during profile 474 // The supervised user checkbox should correctly update its state during profile
472 // creation and afterwards. 475 // creation and afterwards.
473 TEST_F('ManageProfileUITest', 'CreateInProgress', function() { 476 TEST_F('ManageProfileUITest', 'CreateInProgress', function() {
474 ManageProfileOverlay.getInstance().initializePage(); 477 ManageProfileOverlay.getInstance().initializePage();
475 478
476 var custodianEmail = 'chrome.playpen.test@gmail.com'; 479 var custodianEmail = 'chrome.playpen.test@gmail.com';
477 CreateProfileOverlay.updateSignedInStatus(custodianEmail); 480 CreateProfileOverlay.updateSignedInStatus(custodianEmail);
478 CreateProfileOverlay.updateSupervisedUsersAllowed(true); 481 CreateProfileOverlay.updateSupervisedUsersAllowed(true);
479 var checkbox = $('create-profile-supervised'); 482 var checkbox = $('create-profile-supervised');
480 var link = $('create-profile-supervised-not-signed-in-link'); 483 var signInPromo = $('create-profile-supervised-not-signed-in');
481 var indicator = $('create-profile-supervised-indicator'); 484 var indicator = $('create-profile-supervised-indicator');
482 485
483 assertFalse(checkbox.disabled, 'allowed and signed in'); 486 assertFalse(checkbox.disabled, 'allowed and signed in');
484 assertFalse(link.hidden, 'allowed and signed in'); 487 assertTrue(signInPromo.hidden, 'allowed and signed in');
485 assertEquals('none', window.getComputedStyle(indicator, null).display, 488 assertEquals('none', window.getComputedStyle(indicator, null).display,
486 'allowed and signed in'); 489 'allowed and signed in');
487 assertFalse(indicator.hasAttribute('controlled-by')); 490 assertFalse(indicator.hasAttribute('controlled-by'));
488 491
489 CreateProfileOverlay.updateCreateInProgress(true); 492 CreateProfileOverlay.updateCreateInProgress(true);
490 assertTrue(checkbox.disabled, 'creation in progress'); 493 assertTrue(checkbox.disabled, 'creation in progress');
491 494
492 // A no-op update to the sign-in status should not change the UI. 495 // A no-op update to the sign-in status should not change the UI.
493 CreateProfileOverlay.updateSignedInStatus(custodianEmail); 496 CreateProfileOverlay.updateSignedInStatus(custodianEmail);
494 CreateProfileOverlay.updateSupervisedUsersAllowed(true); 497 CreateProfileOverlay.updateSupervisedUsersAllowed(true);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 646
644 // Select another icon and check if the profile name was updated. 647 // Select another icon and check if the profile name was updated.
645 var oldName = nameEl.value; 648 var oldName = nameEl.value;
646 gridEl.selectedItem = iconURLs[1]; 649 gridEl.selectedItem = iconURLs[1];
647 expectEquals(oldName, nameEl.value); 650 expectEquals(oldName, nameEl.value);
648 651
649 PageManager.closeOverlay(); 652 PageManager.closeOverlay();
650 }); 653 });
651 654
652 GEN('#endif // OS_CHROMEOS'); 655 GEN('#endif // OS_CHROMEOS');
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/browser_options_handler.cc ('k') | chrome/browser/ui/webui/options/manage_profile_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698