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

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

Issue 75363002: Set focus to the "OK" button when editing a supervised user profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 1 month 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // Override the BrowserOptions method to return the fake info. 59 // Override the BrowserOptions method to return the fake info.
60 BrowserOptions.getCurrentProfile = function() { 60 BrowserOptions.getCurrentProfile = function() {
61 return this.testProfileInfo_(managed); 61 return this.testProfileInfo_(managed);
62 }.bind(this); 62 }.bind(this);
63 // Set the profile info in the overlay. 63 // Set the profile info in the overlay.
64 ManageProfileOverlay.setProfileInfo(this.testProfileInfo_(managed), 64 ManageProfileOverlay.setProfileInfo(this.testProfileInfo_(managed),
65 'manage'); 65 'manage');
66 }, 66 },
67 }; 67 };
68 68
69 // Receiving the new profile defaults in the manage-user overlay shouldn't mess
70 // up the focus in a visible higher-level overlay.
69 TEST_F('ManageProfileUITest', 'NewProfileDefaultsFocus', function() { 71 TEST_F('ManageProfileUITest', 'NewProfileDefaultsFocus', function() {
70 var self = this; 72 var self = this;
71 73
72 function checkFocus(pageName, expectedFocus, initialFocus) { 74 function checkFocus(pageName, expectedFocus, initialFocus) {
73 OptionsPage.showPageByName(pageName); 75 OptionsPage.showPageByName(pageName);
74 initialFocus.focus(); 76 initialFocus.focus();
75 expectEquals(initialFocus, document.activeElement, pageName); 77 expectEquals(initialFocus, document.activeElement, pageName);
76 78
77 ManageProfileOverlay.receiveNewProfileDefaults( 79 ManageProfileOverlay.receiveNewProfileDefaults(
78 self.testProfileInfo_(false)); 80 self.testProfileInfo_(false));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 assertNotEquals(-1, signedInText.textContent.indexOf(custodianEmail)); 145 assertNotEquals(-1, signedInText.textContent.indexOf(custodianEmail));
144 146
145 CreateProfileOverlay.updateSignedInStatus(''); 147 CreateProfileOverlay.updateSignedInStatus('');
146 assertEquals('', CreateProfileOverlay.getInstance().signedInEmail_); 148 assertEquals('', CreateProfileOverlay.getInstance().signedInEmail_);
147 assertTrue(signedInText.hidden); 149 assertTrue(signedInText.hidden);
148 assertFalse(notSignedInText.hidden); 150 assertFalse(notSignedInText.hidden);
149 assertFalse($('create-profile-managed').checked); 151 assertFalse($('create-profile-managed').checked);
150 assertTrue($('create-profile-managed').disabled); 152 assertTrue($('create-profile-managed').disabled);
151 }); 153 });
152 154
153 // Managed users should not be able to edit their profile names. 155 // Managed users should not be able to edit their profile names, and the initial
156 // focus should be adjusted accordingly.
154 TEST_F('ManageProfileUITest', 'EditManagedUserNameAllowed', function() { 157 TEST_F('ManageProfileUITest', 'EditManagedUserNameAllowed', function() {
155 var nameField = $('manage-profile-name'); 158 var nameField = $('manage-profile-name');
156 159
157 this.setProfileManaged_(false); 160 this.setProfileManaged_(false);
158 ManageProfileOverlay.showManageDialog(); 161 ManageProfileOverlay.showManageDialog();
159 assertFalse(nameField.disabled); 162 expectFalse(nameField.disabled);
163 expectEquals(nameField, document.activeElement);
164
165 OptionsPage.closeOverlay();
160 166
161 this.setProfileManaged_(true); 167 this.setProfileManaged_(true);
162 ManageProfileOverlay.showManageDialog(); 168 ManageProfileOverlay.showManageDialog();
163 assertTrue(nameField.disabled); 169 expectTrue(nameField.disabled);
170 expectEquals($('manage-profile-ok'), document.activeElement);
164 }); 171 });
165 172
166 // Setting profile information should allow the confirmation to be shown. 173 // Setting profile information should allow the confirmation to be shown.
167 TEST_F('ManageProfileUITest', 'ShowCreateConfirmation', function() { 174 TEST_F('ManageProfileUITest', 'ShowCreateConfirmation', function() {
168 var testProfile = this.testProfileInfo_(true); 175 var testProfile = this.testProfileInfo_(true);
169 testProfile.custodianEmail = 'foo@bar.example.com'; 176 testProfile.custodianEmail = 'foo@bar.example.com';
170 ManagedUserCreateConfirmOverlay.setProfileInfo(testProfile); 177 ManagedUserCreateConfirmOverlay.setProfileInfo(testProfile);
171 assertTrue(ManagedUserCreateConfirmOverlay.getInstance().canShowPage()); 178 assertTrue(ManagedUserCreateConfirmOverlay.getInstance().canShowPage());
172 OptionsPage.showPageByName('managedUserCreateConfirm', false); 179 OptionsPage.showPageByName('managedUserCreateConfirm', false);
173 assertEquals('managedUserCreateConfirm', 180 assertEquals('managedUserCreateConfirm',
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); 416 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
410 417
411 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false)); 418 ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false));
412 this.setProfileManaged_(true); 419 this.setProfileManaged_(true);
413 messages = clickAndListen(); 420 messages = clickAndListen();
414 assertEquals(0, messages.length); 421 assertEquals(0, messages.length);
415 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name); 422 assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
416 }); 423 });
417 424
418 GEN('#endif // OS_CHROMEOS'); 425 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