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

Unified Diff: chrome/browser/ui/webui/options/manage_profile_browsertest.js

Issue 410293004: Split OptionsPage into Page and PageManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/PageTree/PageManager/, s/pageHelper/pageManager/ Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/manage_profile_browsertest.js
diff --git a/chrome/browser/ui/webui/options/manage_profile_browsertest.js b/chrome/browser/ui/webui/options/manage_profile_browsertest.js
index 83e4008eba8b336f2a875f0ffd2270c56531d7bc..0b53bcc3f27164726b9b43eaa7f5d4b6da7197f9 100644
--- a/chrome/browser/ui/webui/options/manage_profile_browsertest.js
+++ b/chrome/browser/ui/webui/options/manage_profile_browsertest.js
@@ -68,7 +68,7 @@ ManageProfileUITest.prototype = {
* @param {string} mode The mode of the overlay (either 'manage' or 'create').
*/
initDefaultProfiles_: function(mode) {
- OptionsPage.showPageByName(mode + 'Profile');
+ PageManager.showPageByName(mode + 'Profile');
var defaultProfile = {
name: 'Default Name',
@@ -95,14 +95,14 @@ TEST_F('ManageProfileUITest', 'NewProfileDefaultsFocus', function() {
var self = this;
function checkFocus(pageName, expectedFocus, initialFocus) {
- OptionsPage.showPageByName(pageName);
+ PageManager.showPageByName(pageName);
initialFocus.focus();
expectEquals(initialFocus, document.activeElement, pageName);
ManageProfileOverlay.receiveNewProfileDefaults(
self.testProfileInfo_(false));
expectEquals(expectedFocus, document.activeElement, pageName);
- OptionsPage.closeOverlay();
+ PageManager.closeOverlay();
}
// Receiving new profile defaults sets focus to the name field if the create
@@ -123,7 +123,7 @@ TEST_F('ManageProfileUITest', 'NewProfileDefaultsFocus', function() {
// The default options should be reset each time the creation overlay is shown.
TEST_F('ManageProfileUITest', 'DefaultCreateOptions', function() {
- OptionsPage.showPageByName('createProfile');
+ PageManager.showPageByName('createProfile');
var shortcutsAllowed = loadTimeData.getBoolean('profileShortcutsEnabled');
var createShortcut = $('create-shortcut');
var createManaged = $('create-profile-managed');
@@ -132,8 +132,8 @@ TEST_F('ManageProfileUITest', 'DefaultCreateOptions', function() {
createShortcut.checked = !shortcutsAllowed;
createManaged.checked = true;
- OptionsPage.closeOverlay();
- OptionsPage.showPageByName('createProfile');
+ PageManager.closeOverlay();
+ PageManager.showPageByName('createProfile');
assertEquals(shortcutsAllowed, createShortcut.checked);
assertFalse(createManaged.checked);
});
@@ -282,7 +282,7 @@ TEST_F('ManageProfileUITest', 'EditManagedUserNameAllowed', function() {
expectFalse(nameField.disabled);
expectEquals(nameField, document.activeElement);
- OptionsPage.closeOverlay();
+ PageManager.closeOverlay();
this.setProfileManaged_(true, 'manage');
ManageProfileOverlay.showManageDialog();
@@ -296,44 +296,44 @@ TEST_F('ManageProfileUITest', 'ShowCreateConfirmation', function() {
testProfile.custodianEmail = 'foo@bar.example.com';
ManagedUserCreateConfirmOverlay.setProfileInfo(testProfile);
assertTrue(ManagedUserCreateConfirmOverlay.getInstance().canShowPage());
- OptionsPage.showPageByName('managedUserCreateConfirm', false);
+ PageManager.showPageByName('managedUserCreateConfirm', false);
assertEquals('managedUserCreateConfirm',
- OptionsPage.getTopmostVisiblePage().name);
+ PageManager.getTopmostVisiblePage().name);
});
// Trying to show a confirmation dialog with no profile information should fall
// back to the default (main) settings page.
TEST_F('ManageProfileUITest', 'NoEmptyConfirmation', function() {
- assertEquals('manageProfile', OptionsPage.getTopmostVisiblePage().name);
+ assertEquals('manageProfile', PageManager.getTopmostVisiblePage().name);
assertFalse(ManagedUserCreateConfirmOverlay.getInstance().canShowPage());
- OptionsPage.showPageByName('managedUserCreateConfirm', true);
- assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
+ PageManager.showPageByName('managedUserCreateConfirm', true);
+ assertEquals('settings', PageManager.getTopmostVisiblePage().name);
});
// A confirmation dialog should be shown after creating a new managed user.
TEST_F('ManageProfileUITest', 'ShowCreateConfirmationOnSuccess', function() {
- OptionsPage.showPageByName('createProfile');
- assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name);
+ PageManager.showPageByName('createProfile');
+ assertEquals('createProfile', PageManager.getTopmostVisiblePage().name);
CreateProfileOverlay.onSuccess(this.testProfileInfo_(false));
- assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
+ assertEquals('settings', PageManager.getTopmostVisiblePage().name);
- OptionsPage.showPageByName('createProfile');
- assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name);
+ PageManager.showPageByName('createProfile');
+ assertEquals('createProfile', PageManager.getTopmostVisiblePage().name);
CreateProfileOverlay.onSuccess(this.testProfileInfo_(true));
assertEquals('managedUserCreateConfirm',
- OptionsPage.getTopmostVisiblePage().name);
+ PageManager.getTopmostVisiblePage().name);
expectEquals($('managed-user-created-switch'), document.activeElement);
});
// An error should be shown if creating a new managed user fails.
TEST_F('ManageProfileUITest', 'NoCreateConfirmationOnError', function() {
- OptionsPage.showPageByName('createProfile');
- assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name);
+ PageManager.showPageByName('createProfile');
+ assertEquals('createProfile', PageManager.getTopmostVisiblePage().name);
var errorBubble = $('create-profile-error-bubble');
assertTrue(errorBubble.hidden);
CreateProfileOverlay.onError('An Error Message!');
- assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name);
+ assertEquals('createProfile', PageManager.getTopmostVisiblePage().name);
assertFalse(errorBubble.hidden);
});
@@ -356,7 +356,7 @@ TEST_F('ManageProfileUITest', 'CreateConfirmationText', function() {
testProfile.name = name;
CreateProfileOverlay.onSuccess(testProfile);
assertEquals('managedUserCreateConfirm',
- OptionsPage.getTopmostVisiblePage().name);
+ PageManager.getTopmostVisiblePage().name);
// Check for the presence of the name and email in the UI, without depending
// on the details of the messsages.
@@ -371,14 +371,14 @@ TEST_F('ManageProfileUITest', 'CreateConfirmationText', function() {
// The name should be properly HTML-escaped.
assertNotEquals(-1, message.innerHTML.indexOf(expectedHtml));
- OptionsPage.closeOverlay();
- assertEquals('settings', OptionsPage.getTopmostVisiblePage().name, name);
+ PageManager.closeOverlay();
+ assertEquals('settings', PageManager.getTopmostVisiblePage().name, name);
}
// Show and configure the create-profile dialog.
- OptionsPage.showPageByName('createProfile');
+ PageManager.showPageByName('createProfile');
CreateProfileOverlay.updateSignedInStatus(custodianEmail);
- assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name);
+ assertEquals('createProfile', PageManager.getTopmostVisiblePage().name);
checkDialog('OneWord');
checkDialog('Multiple Words');
@@ -500,26 +500,26 @@ TEST_F('ManageProfileUITest', 'ManagedShowDeleteAndCreate', function() {
this.setProfileManaged_(false, 'create');
ManageProfileOverlay.showCreateDialog();
- assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name);
- OptionsPage.closeOverlay();
- assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
+ assertEquals('createProfile', PageManager.getTopmostVisiblePage().name);
+ PageManager.closeOverlay();
+ assertEquals('settings', PageManager.getTopmostVisiblePage().name);
ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false));
- assertEquals('manageProfile', OptionsPage.getTopmostVisiblePage().name);
+ assertEquals('manageProfile', PageManager.getTopmostVisiblePage().name);
assertFalse($('manage-profile-overlay-delete').hidden);
- OptionsPage.closeOverlay();
- assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
+ PageManager.closeOverlay();
+ assertEquals('settings', PageManager.getTopmostVisiblePage().name);
this.setProfileManaged_(true, 'create');
ManageProfileOverlay.showCreateDialog();
- assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
+ assertEquals('settings', PageManager.getTopmostVisiblePage().name);
ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false));
- assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
+ assertEquals('settings', PageManager.getTopmostVisiblePage().name);
});
// Only non-managed users should be able to delete profiles.
TEST_F('ManageProfileUITest', 'ManagedDelete', function() {
ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false));
- assertEquals('manageProfile', OptionsPage.getTopmostVisiblePage().name);
+ assertEquals('manageProfile', PageManager.getTopmostVisiblePage().name);
assertFalse($('manage-profile-overlay-delete').hidden);
// Clicks the "Delete" button, after overriding chrome.send to record what
@@ -540,13 +540,13 @@ TEST_F('ManageProfileUITest', 'ManagedDelete', function() {
var messages = clickAndListen();
assertEquals(1, messages.length);
assertEquals('deleteProfile', messages[0]);
- assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
+ assertEquals('settings', PageManager.getTopmostVisiblePage().name);
ManageProfileOverlay.showDeleteDialog(this.testProfileInfo_(false));
this.setProfileManaged_(true, 'manage');
messages = clickAndListen();
assertEquals(0, messages.length);
- assertEquals('settings', OptionsPage.getTopmostVisiblePage().name);
+ assertEquals('settings', PageManager.getTopmostVisiblePage().name);
});
// Selecting a different avatar image should update the suggested profile name.
@@ -573,7 +573,7 @@ TEST_F('ManageProfileUITest', 'Create_NameUpdateOnAvatarSelected', function() {
gridEl.selectedItem = this.defaultIconURLs[1];
expectEquals(this.defaultNames[1], nameEl.value);
- OptionsPage.closeOverlay();
+ PageManager.closeOverlay();
});
// After the user edited the profile name, selecting a different avatar image
@@ -593,7 +593,7 @@ TEST_F('ManageProfileUITest', 'Create_NoNameUpdateOnAvatarSelectedAfterEdit',
gridEl.selectedItem = this.defaultIconURLs[0];
expectEquals(this.defaultNames[3], nameEl.value);
- OptionsPage.closeOverlay();
+ PageManager.closeOverlay();
});
// After the user edited the profile name, selecting a different avatar image
@@ -619,7 +619,7 @@ TEST_F('ManageProfileUITest', 'Create_NoNameUpdateOnAvatarSelectedAfterRevert',
gridEl.selectedItem = this.defaultIconURLs[0];
expectEquals(oldName, nameEl.value);
- OptionsPage.closeOverlay();
+ PageManager.closeOverlay();
});
// In the manage dialog, the name should never be updated on avatar selection.
@@ -627,7 +627,7 @@ TEST_F('ManageProfileUITest', 'Manage_NoNameUpdateOnAvatarSelected',
function() {
var mode = 'manage';
this.setProfileManaged_(false, mode);
- OptionsPage.showPageByName(mode + 'Profile');
+ PageManager.showPageByName(mode + 'Profile');
var testProfile = this.testProfileInfo_(false);
var iconURLs = [testProfile.iconURL, '/some/path', '/another/path'];
@@ -643,7 +643,7 @@ TEST_F('ManageProfileUITest', 'Manage_NoNameUpdateOnAvatarSelected',
gridEl.selectedItem = iconURLs[1];
expectEquals(oldName, nameEl.value);
- OptionsPage.closeOverlay();
+ PageManager.closeOverlay();
});
GEN('#endif // OS_CHROMEOS');

Powered by Google App Engine
This is Rietveld 408576698