Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 cr.define('settings_people_page_manage_profile', function() { | 5 cr.define('settings_people_page_manage_profile', function() { |
| 6 /** | 6 /** |
| 7 * @constructor | 7 * @constructor |
| 8 * @implements {settings.ManageProfileBrowserProxy} | 8 * @implements {settings.ManageProfileBrowserProxy} |
| 9 * @extends {settings.TestBrowserProxy} | 9 * @extends {settings.TestBrowserProxy} |
| 10 */ | 10 */ |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 var manageProfile = null; | 36 var manageProfile = null; |
| 37 var browserProxy = null; | 37 var browserProxy = null; |
| 38 | 38 |
| 39 setup(function() { | 39 setup(function() { |
| 40 browserProxy = new TestManageProfileBrowserProxy(); | 40 browserProxy = new TestManageProfileBrowserProxy(); |
| 41 settings.ManageProfileBrowserProxyImpl.instance_ = browserProxy; | 41 settings.ManageProfileBrowserProxyImpl.instance_ = browserProxy; |
| 42 PolymerTest.clearBody(); | 42 PolymerTest.clearBody(); |
| 43 manageProfile = document.createElement('settings-manage-profile'); | 43 manageProfile = document.createElement('settings-manage-profile'); |
| 44 manageProfile.profileIconUrl = 'fake-icon-1.png'; | 44 manageProfile.profileIconUrl = 'fake-icon-1.png'; |
| 45 manageProfile.profileName = 'Initial Fake Name'; | 45 manageProfile.profileName = 'Initial Fake Name'; |
| 46 manageProfile.syncStatus = {supervisedUser: true, childUser: false}; | |
| 46 document.body.appendChild(manageProfile); | 47 document.body.appendChild(manageProfile); |
| 47 }); | 48 }); |
| 48 | 49 |
| 49 teardown(function() { manageProfile.remove(); }); | 50 teardown(function() { manageProfile.remove(); }); |
| 50 | 51 |
| 51 // Tests that the manage profile subpage | 52 // Tests that the manage profile subpage |
| 52 // - gets and receives all the available icons | 53 // - gets and receives all the available icons |
| 53 // - has the correct icon selected | 54 // - has the correct icon selected |
| 54 // - can select a new icon | 55 // - can select a new icon |
| 55 test('ManageProfileChangeIcon', function() { | 56 test('ManageProfileChangeIcon', function() { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 assertTrue(selector.items[1].classList.contains('iron-selected')); | 90 assertTrue(selector.items[1].classList.contains('iron-selected')); |
| 90 }); | 91 }); |
| 91 }); | 92 }); |
| 92 | 93 |
| 93 test('ManageProfileChangeName', function() { | 94 test('ManageProfileChangeName', function() { |
| 94 var nameField = manageProfile.$.name; | 95 var nameField = manageProfile.$.name; |
| 95 assertTrue(!!nameField); | 96 assertTrue(!!nameField); |
| 96 | 97 |
| 97 assertEquals('Initial Fake Name', nameField.value); | 98 assertEquals('Initial Fake Name', nameField.value); |
| 98 | 99 |
| 100 // Name field should be disabled for legacy supervised users. | |
| 101 assertTrue(!!nameField.disabled); | |
|
tommycli
2016/10/03 20:37:22
Can we separate out the legacy supervised users in
Moe
2016/10/03 22:26:43
fair enough! done.
| |
| 102 | |
| 99 nameField.value = 'New Name'; | 103 nameField.value = 'New Name'; |
| 100 nameField.fire('change'); | 104 nameField.fire('change'); |
| 101 | 105 |
| 102 return browserProxy.whenCalled('setProfileIconAndName').then( | 106 return browserProxy.whenCalled('setProfileIconAndName').then( |
| 103 function(args) { | 107 function(args) { |
| 104 assertEquals('fake-icon-1.png', args[0]); | 108 assertEquals('fake-icon-1.png', args[0]); |
| 105 assertEquals('New Name', args[1]); | 109 assertEquals('New Name', args[1]); |
| 106 }); | 110 }); |
| 107 }); | 111 }); |
| 108 | 112 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 121 }); | 125 }); |
| 122 }); | 126 }); |
| 123 } | 127 } |
| 124 | 128 |
| 125 return { | 129 return { |
| 126 registerTests: function() { | 130 registerTests: function() { |
| 127 registerManageProfileTests(); | 131 registerManageProfileTests(); |
| 128 }, | 132 }, |
| 129 }; | 133 }; |
| 130 }); | 134 }); |
| OLD | NEW |