| OLD | NEW |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 /** | 65 /** |
| 66 * Set some default profile infos (icon URLs and names). | 66 * Set some default profile infos (icon URLs and names). |
| 67 * @param {boolean} managed Whether the test profile should be marked managed. | 67 * @param {boolean} managed Whether the test profile should be marked managed. |
| 68 * @param {string} mode The mode of the overlay (either 'manage' or 'create'). | 68 * @param {string} mode The mode of the overlay (either 'manage' or 'create'). |
| 69 */ | 69 */ |
| 70 initDefaultProfiles_: function(mode) { | 70 initDefaultProfiles_: function(mode) { |
| 71 OptionsPage.showPageByName(mode + 'Profile'); | 71 OptionsPage.showPageByName(mode + 'Profile'); |
| 72 | 72 |
| 73 var defaultProfile = { | 73 var defaultProfile = { |
| 74 name: "Default Name", | 74 name: 'Default Name', |
| 75 iconURL: "/default/path", | 75 iconURL: '/default/path', |
| 76 }; | 76 }; |
| 77 this.defaultIconURLs = ['/some/path', | 77 this.defaultIconURLs = ['/some/path', |
| 78 defaultProfile.iconURL, | 78 defaultProfile.iconURL, |
| 79 '/another/path', | 79 '/another/path', |
| 80 '/one/more/path']; | 80 '/one/more/path']; |
| 81 this.defaultNames = ['Some Name', defaultProfile.name, '', 'Another Name']; | 81 this.defaultNames = ['Some Name', defaultProfile.name, '', 'Another Name']; |
| 82 ManageProfileOverlay.receiveDefaultProfileIconsAndNames( | 82 ManageProfileOverlay.receiveDefaultProfileIconsAndNames( |
| 83 mode, this.defaultIconURLs, this.defaultNames); | 83 mode, this.defaultIconURLs, this.defaultNames); |
| 84 ManageProfileOverlay.receiveNewProfileDefaults(defaultProfile); | 84 ManageProfileOverlay.receiveNewProfileDefaults(defaultProfile); |
| 85 | 85 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 createShortcut.checked = !shortcutsAllowed; | 133 createShortcut.checked = !shortcutsAllowed; |
| 134 createManaged.checked = true; | 134 createManaged.checked = true; |
| 135 OptionsPage.closeOverlay(); | 135 OptionsPage.closeOverlay(); |
| 136 OptionsPage.showPageByName('createProfile'); | 136 OptionsPage.showPageByName('createProfile'); |
| 137 assertEquals(shortcutsAllowed, createShortcut.checked); | 137 assertEquals(shortcutsAllowed, createShortcut.checked); |
| 138 assertFalse(createManaged.checked); | 138 assertFalse(createManaged.checked); |
| 139 }); | 139 }); |
| 140 | 140 |
| 141 // The checkbox label should change depending on whether the user is signed in. | 141 // The checkbox label should change depending on whether the user is signed in. |
| 142 TEST_F('ManageProfileUITest', 'CreateManagedUserText', function() { | 142 TEST_F('ManageProfileUITest', 'CreateManagedUserText', function() { |
| 143 var signedInText = $('create-profile-managed-signed-in'); | 143 var signedInText = $('create-profile-managed-signed-in'); |
| 144 var notSignedInText = $('create-profile-managed-not-signed-in'); | 144 var notSignedInText = $('create-profile-managed-not-signed-in'); |
| 145 | 145 |
| 146 ManageProfileOverlay.getInstance().initializePage(); | 146 ManageProfileOverlay.getInstance().initializePage(); |
| 147 | 147 |
| 148 var custodianEmail = 'chrome.playpen.test@gmail.com'; | 148 var custodianEmail = 'chrome.playpen.test@gmail.com'; |
| 149 CreateProfileOverlay.updateSignedInStatus(custodianEmail); | 149 CreateProfileOverlay.updateSignedInStatus(custodianEmail); |
| 150 assertEquals(custodianEmail, | 150 assertEquals(custodianEmail, |
| 151 CreateProfileOverlay.getInstance().signedInEmail_); | 151 CreateProfileOverlay.getInstance().signedInEmail_); |
| 152 assertFalse(signedInText.hidden); | 152 assertFalse(signedInText.hidden); |
| 153 assertTrue(notSignedInText.hidden); | 153 assertTrue(notSignedInText.hidden); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name); | 331 assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name); |
| 332 var errorBubble = $('create-profile-error-bubble'); | 332 var errorBubble = $('create-profile-error-bubble'); |
| 333 assertTrue(errorBubble.hidden); | 333 assertTrue(errorBubble.hidden); |
| 334 | 334 |
| 335 CreateProfileOverlay.onError('An Error Message!'); | 335 CreateProfileOverlay.onError('An Error Message!'); |
| 336 assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name); | 336 assertEquals('createProfile', OptionsPage.getTopmostVisiblePage().name); |
| 337 assertFalse(errorBubble.hidden); | 337 assertFalse(errorBubble.hidden); |
| 338 }); | 338 }); |
| 339 | 339 |
| 340 // The name and email should be inserted into the confirmation dialog. | 340 // The name and email should be inserted into the confirmation dialog. |
| 341 TEST_F('ManageProfileUITest', 'CreateConfirmationText', function () { | 341 TEST_F('ManageProfileUITest', 'CreateConfirmationText', function() { |
| 342 var self = this; | 342 var self = this; |
| 343 var custodianEmail = 'foo@example.com'; | 343 var custodianEmail = 'foo@example.com'; |
| 344 | 344 |
| 345 // Checks the strings in the confirmation dialog. If |expectedNameText| is | 345 // Checks the strings in the confirmation dialog. If |expectedNameText| is |
| 346 // given, it should be present in the dialog's textContent; otherwise the name | 346 // given, it should be present in the dialog's textContent; otherwise the name |
| 347 // is expected. If |expectedNameHtml| is given, it should be present in the | 347 // is expected. If |expectedNameHtml| is given, it should be present in the |
| 348 // dialog's innerHTML; otherwise the expected text is expected in the HTML | 348 // dialog's innerHTML; otherwise the expected text is expected in the HTML |
| 349 // too. | 349 // too. |
| 350 function checkDialog(name, expectedNameText, expectedNameHtml) { | 350 function checkDialog(name, expectedNameText, expectedNameHtml) { |
| 351 var expectedText = expectedNameText || name; | 351 var expectedText = expectedNameText || name; |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 | 640 |
| 641 // Select another icon and check if the profile name was updated. | 641 // Select another icon and check if the profile name was updated. |
| 642 var oldName = nameEl.value; | 642 var oldName = nameEl.value; |
| 643 gridEl.selectedItem = iconURLs[1]; | 643 gridEl.selectedItem = iconURLs[1]; |
| 644 expectEquals(oldName, nameEl.value); | 644 expectEquals(oldName, nameEl.value); |
| 645 | 645 |
| 646 OptionsPage.closeOverlay(); | 646 OptionsPage.closeOverlay(); |
| 647 }); | 647 }); |
| 648 | 648 |
| 649 GEN('#endif // OS_CHROMEOS'); | 649 GEN('#endif // OS_CHROMEOS'); |
| OLD | NEW |