Chromium Code Reviews| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 }, | 195 }, |
| 196 { | 196 { |
| 197 id: 'supervisedUser3', | 197 id: 'supervisedUser3', |
| 198 name: 'Test', | 198 name: 'Test', |
| 199 iconURL: 'chrome://path/to/icon/image', | 199 iconURL: 'chrome://path/to/icon/image', |
| 200 onCurrentDevice: true, | 200 onCurrentDevice: true, |
| 201 needAvatar: false | 201 needAvatar: false |
| 202 }, | 202 }, |
| 203 { | 203 { |
| 204 id: 'supervisedUser4', | 204 id: 'supervisedUser4', |
| 205 name: 'SameName', | 205 name: 'RepeatingName', |
| 206 iconURL: 'chrome://path/to/icon/image', | |
| 207 onCurrentDevice: true, | |
| 208 needAvatar: false | |
| 209 }, | |
| 210 { | |
| 211 id: 'supervisedUser5', | |
| 212 name: 'RepeatingName', | |
| 206 iconURL: 'chrome://path/to/icon/image', | 213 iconURL: 'chrome://path/to/icon/image', |
| 207 onCurrentDevice: false, | 214 onCurrentDevice: false, |
| 208 needAvatar: false | 215 needAvatar: false |
| 209 }]; | 216 }]; |
| 210 var promise = Promise.resolve(supervisedUsers); | 217 var promise = Promise.resolve(supervisedUsers); |
| 211 options.SupervisedUserListData.getInstance().promise_ = promise; | 218 options.SupervisedUserListData.getInstance().promise_ = promise; |
| 212 | 219 |
| 213 // Initialize the ManageProfileOverlay. | 220 // Initialize the ManageProfileOverlay. |
| 214 ManageProfileOverlay.getInstance().initializePage(); | 221 ManageProfileOverlay.getInstance().initializePage(); |
| 215 var custodianEmail = 'chrome.playpen.test@gmail.com'; | 222 var custodianEmail = 'chrome.playpen.test@gmail.com'; |
| 216 CreateProfileOverlay.updateSignedInStatus(custodianEmail); | 223 CreateProfileOverlay.updateSignedInStatus(custodianEmail); |
| 217 assertEquals(custodianEmail, | 224 assertEquals(custodianEmail, |
| 218 CreateProfileOverlay.getInstance().signedInEmail_); | 225 CreateProfileOverlay.getInstance().signedInEmail_); |
| 219 this.setProfileSupervised_(false, 'create'); | 226 this.setProfileSupervised_(false, 'create'); |
| 220 | 227 |
| 221 // Also add the names 'Test' and 'SameName' to |existingProfileNames_| to | 228 // Also add the names 'Test' and 'SameName' to |existingProfileNames_| to |
|
Marc Treib
2015/12/21 10:02:19
nit: Update comment ('RepeatingName')
atanasova
2015/12/21 10:11:53
Done.
| |
| 222 // simulate that profiles with those names exist on the device. | 229 // simulate that profiles with those names exist on the device. |
| 223 ManageProfileOverlay.getInstance().existingProfileNames_.Test = true; | 230 ManageProfileOverlay.getInstance().existingProfileNames_.Test = true; |
| 224 ManageProfileOverlay.getInstance().existingProfileNames_.SameName = true; | 231 ManageProfileOverlay.getInstance().existingProfileNames_.RepeatingName = true; |
| 225 | 232 |
| 226 // Initially, the ok button should be enabled and the import link should not | 233 // Initially, the ok button should be enabled and the import link should not |
| 227 // exist. | 234 // exist. |
| 228 assertFalse($('create-profile-ok').disabled); | 235 assertFalse($('create-profile-ok').disabled); |
| 229 assertTrue($('supervised-user-import-existing') == null); | 236 assertTrue($('supervised-user-import-existing') == null); |
| 230 | 237 |
| 231 // Now try to create profiles with the names of existing supervised users. | 238 // Now try to create profiles with the names of existing supervised users. |
| 232 $('create-profile-supervised').checked = true; | 239 $('create-profile-supervised').checked = true; |
| 233 var nameField = $('create-profile-name'); | 240 var nameField = $('create-profile-name'); |
| 234 // A profile which already has an avatar. | 241 // A profile which already has an avatar. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 245 return options.SupervisedUserListData.getInstance().promise_; | 252 return options.SupervisedUserListData.getInstance().promise_; |
| 246 }).then(function() { | 253 }).then(function() { |
| 247 assertTrue($('create-profile-ok').disabled); | 254 assertTrue($('create-profile-ok').disabled); |
| 248 assertFalse($('supervised-user-import-existing') == null); | 255 assertFalse($('supervised-user-import-existing') == null); |
| 249 | 256 |
| 250 // A profile which already exists on the device. | 257 // A profile which already exists on the device. |
| 251 nameField.value = 'Test'; | 258 nameField.value = 'Test'; |
| 252 ManageProfileOverlay.getInstance().onNameChanged_('create'); | 259 ManageProfileOverlay.getInstance().onNameChanged_('create'); |
| 253 return options.SupervisedUserListData.getInstance().promise_; | 260 return options.SupervisedUserListData.getInstance().promise_; |
| 254 }).then(function() { | 261 }).then(function() { |
| 255 assertFalse($('create-profile-ok').disabled); | 262 assertTrue($('create-profile-ok').disabled); |
| 256 assertTrue($('supervised-user-import-existing') == null); | 263 assertTrue($('supervised-user-import-existing') == null); |
| 257 | 264 |
| 258 // A profile which does not exist on the device, but there is a profile with | 265 // A supervised user profile that is on the device, but has the same name |
| 259 // the same name already on the device. | 266 // as a supervised user profile that is not imported. |
| 260 nameField.value = 'SameName'; | 267 // This can happen due to a bug (https://crbug.com/557445) |
| 268 nameField.value = 'RepeatingName'; | |
| 261 ManageProfileOverlay.getInstance().onNameChanged_('create'); | 269 ManageProfileOverlay.getInstance().onNameChanged_('create'); |
| 262 return options.SupervisedUserListData.getInstance().promise_; | 270 return options.SupervisedUserListData.getInstance().promise_; |
| 263 }).then(function() { | 271 }).then(function() { |
| 264 assertTrue($('create-profile-ok').disabled); | 272 assertTrue($('create-profile-ok').disabled); |
| 265 assertFalse($('supervised-user-import-existing') == null); | 273 assertFalse($('supervised-user-import-existing') == null); |
| 266 | 274 |
| 267 // A profile which does not exist yet. | 275 // A profile which does not exist yet. |
| 268 nameField.value = 'NewProfileName'; | 276 nameField.value = 'NewProfileName'; |
| 269 ManageProfileOverlay.getInstance().onNameChanged_('create'); | 277 ManageProfileOverlay.getInstance().onNameChanged_('create'); |
| 270 return options.SupervisedUserListData.getInstance().promise_; | 278 return options.SupervisedUserListData.getInstance().promise_; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 655 | 663 |
| 656 // Select another icon and check if the profile name was updated. | 664 // Select another icon and check if the profile name was updated. |
| 657 var oldName = nameEl.value; | 665 var oldName = nameEl.value; |
| 658 gridEl.selectedItem = iconURLs[1]; | 666 gridEl.selectedItem = iconURLs[1]; |
| 659 expectEquals(oldName, nameEl.value); | 667 expectEquals(oldName, nameEl.value); |
| 660 | 668 |
| 661 PageManager.closeOverlay(); | 669 PageManager.closeOverlay(); |
| 662 }); | 670 }); |
| 663 | 671 |
| 664 GEN('#endif // OS_CHROMEOS'); | 672 GEN('#endif // OS_CHROMEOS'); |
| OLD | NEW |