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

Side by Side Diff: chrome/test/data/webui/settings/people_page_manage_profile_test.js

Issue 2387173002: [MD Settings][People] Disables profile name field for legacy supervised users. (Closed)
Patch Set: Addressed comments Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/settings/people_page/people_page.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 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
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: false, 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 30 matching lines...) Expand all
86 assertEquals('fake-icon-2.png', manageProfile.profileIconUrl); 87 assertEquals('fake-icon-2.png', manageProfile.profileIconUrl);
87 assertEquals(2, selector.items.length); 88 assertEquals(2, selector.items.length);
88 assertFalse(selector.items[0].classList.contains('iron-selected')); 89 assertFalse(selector.items[0].classList.contains('iron-selected'));
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);
97 assertFalse(!!nameField.disabled);
96 98
97 assertEquals('Initial Fake Name', nameField.value); 99 assertEquals('Initial Fake Name', nameField.value);
98 100
99 nameField.value = 'New Name'; 101 nameField.value = 'New Name';
100 nameField.fire('change'); 102 nameField.fire('change');
101 103
102 return browserProxy.whenCalled('setProfileIconAndName').then( 104 return browserProxy.whenCalled('setProfileIconAndName').then(
103 function(args) { 105 function(args) {
104 assertEquals('fake-icon-1.png', args[0]); 106 assertEquals('fake-icon-1.png', args[0]);
105 assertEquals('New Name', args[1]); 107 assertEquals('New Name', args[1]);
106 }); 108 });
107 }); 109 });
108 110
111 test('ProfileNameIsDisabledForSupervisedUser', function() {
112 manageProfile.syncStatus = {supervisedUser: true, childUser: false};
113
114 var nameField = manageProfile.$.name;
115 assertTrue(!!nameField);
116
117 // Name field should be disabled for legacy supervised users.
118 assertTrue(!!nameField.disabled);
119 });
120
109 // Tests profile name updates pushed from the browser. 121 // Tests profile name updates pushed from the browser.
110 test('ManageProfileNameUpdated', function() { 122 test('ManageProfileNameUpdated', function() {
111 var nameField = manageProfile.$.name; 123 var nameField = manageProfile.$.name;
112 assertTrue(!!nameField); 124 assertTrue(!!nameField);
113 125
114 return browserProxy.whenCalled('getAvailableIcons').then(function() { 126 return browserProxy.whenCalled('getAvailableIcons').then(function() {
115 manageProfile.profileName = 'New Name From Browser'; 127 manageProfile.profileName = 'New Name From Browser';
116 128
117 Polymer.dom.flush(); 129 Polymer.dom.flush();
118 130
119 assertEquals('New Name From Browser', nameField.value); 131 assertEquals('New Name From Browser', nameField.value);
120 }); 132 });
121 }); 133 });
122 }); 134 });
123 } 135 }
124 136
125 return { 137 return {
126 registerTests: function() { 138 registerTests: function() {
127 registerManageProfileTests(); 139 registerManageProfileTests();
128 }, 140 },
129 }; 141 };
130 }); 142 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/people_page/people_page.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698