| 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', function() { | 5 cr.define('settings_people_page', function() { |
| 6 /** | 6 /** |
| 7 * @constructor | 7 * @constructor |
| 8 * @implements {settings.ProfileInfoBrowserProxy} | 8 * @implements {settings.ProfileInfoBrowserProxy} |
| 9 * @extends {settings.TestBrowserProxy} | 9 * @extends {settings.TestBrowserProxy} |
| 10 */ | 10 */ |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 browserProxy = new TestSyncBrowserProxy(); | 147 browserProxy = new TestSyncBrowserProxy(); |
| 148 settings.SyncBrowserProxyImpl.instance_ = browserProxy; | 148 settings.SyncBrowserProxyImpl.instance_ = browserProxy; |
| 149 | 149 |
| 150 PolymerTest.clearBody(); | 150 PolymerTest.clearBody(); |
| 151 peoplePage = document.createElement('settings-people-page'); | 151 peoplePage = document.createElement('settings-people-page'); |
| 152 document.body.appendChild(peoplePage); | 152 document.body.appendChild(peoplePage); |
| 153 }); | 153 }); |
| 154 | 154 |
| 155 teardown(function() { peoplePage.remove(); }); | 155 teardown(function() { peoplePage.remove(); }); |
| 156 | 156 |
| 157 test('ActivityControlsLink', function() { |
| 158 return browserProxy.whenCalled('getSyncStatus').then(function() { |
| 159 Polymer.dom.flush(); |
| 160 |
| 161 var activityControls = peoplePage.$$('#activity-controls'); |
| 162 assertTrue(!!activityControls); |
| 163 assertFalse(activityControls.hidden); |
| 164 |
| 165 cr.webUIListenerCallback('sync-status-changed', { |
| 166 signedIn: false, |
| 167 }); |
| 168 |
| 169 assertTrue(activityControls.hidden); |
| 170 }); |
| 171 }); |
| 172 |
| 173 test('CustomizeSyncDisabledForManagedSignin', function() { |
| 174 assertFalse(!!peoplePage.$$('#customize-sync')); |
| 175 |
| 176 return browserProxy.whenCalled('getSyncStatus').then(function() { |
| 177 cr.webUIListenerCallback('sync-status-changed', { |
| 178 signedIn: true, |
| 179 syncSystemEnabled: true, |
| 180 }); |
| 181 Polymer.dom.flush(); |
| 182 |
| 183 var customizeSync = peoplePage.$$('#customize-sync'); |
| 184 assertTrue(!!customizeSync); |
| 185 assertTrue(customizeSync.hasAttribute('actionable')); |
| 186 |
| 187 cr.webUIListenerCallback('sync-status-changed', { |
| 188 managed: true, |
| 189 signedIn: true, |
| 190 syncSystemEnabled: true, |
| 191 }); |
| 192 Polymer.dom.flush(); |
| 193 |
| 194 var customizeSync = peoplePage.$$('#customize-sync'); |
| 195 assertTrue(!!customizeSync); |
| 196 assertFalse(customizeSync.hasAttribute('actionable')); |
| 197 }); |
| 198 }); |
| 199 |
| 157 test('GetProfileInfo', function() { | 200 test('GetProfileInfo', function() { |
| 158 var disconnectButton = null; | 201 var disconnectButton = null; |
| 159 return browserProxy.whenCalled('getSyncStatus').then(function() { | 202 return browserProxy.whenCalled('getSyncStatus').then(function() { |
| 160 Polymer.dom.flush(); | 203 Polymer.dom.flush(); |
| 161 disconnectButton = peoplePage.$$('#disconnectButton'); | 204 disconnectButton = peoplePage.$$('#disconnectButton'); |
| 162 assertTrue(!!disconnectButton); | 205 assertTrue(!!disconnectButton); |
| 163 | 206 |
| 164 MockInteractions.tap(disconnectButton); | 207 MockInteractions.tap(disconnectButton); |
| 165 Polymer.dom.flush(); | 208 Polymer.dom.flush(); |
| 166 | 209 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 assertFalse(disconnectManagedProfileConfirm.hidden); | 249 assertFalse(disconnectManagedProfileConfirm.hidden); |
| 207 | 250 |
| 208 browserProxy.resetResolver('signOut'); | 251 browserProxy.resetResolver('signOut'); |
| 209 MockInteractions.tap(disconnectManagedProfileConfirm); | 252 MockInteractions.tap(disconnectManagedProfileConfirm); |
| 210 | 253 |
| 211 return browserProxy.whenCalled('signOut'); | 254 return browserProxy.whenCalled('signOut'); |
| 212 }).then(function(deleteProfile) { | 255 }).then(function(deleteProfile) { |
| 213 assertTrue(deleteProfile); | 256 assertTrue(deleteProfile); |
| 214 }); | 257 }); |
| 215 }); | 258 }); |
| 216 | |
| 217 test('ActivityControlsLink', function() { | |
| 218 return browserProxy.whenCalled('getSyncStatus').then(function() { | |
| 219 Polymer.dom.flush(); | |
| 220 | |
| 221 var activityControls = peoplePage.$$('#activity-controls'); | |
| 222 assertTrue(!!activityControls); | |
| 223 assertFalse(activityControls.hidden); | |
| 224 | |
| 225 cr.webUIListenerCallback('sync-status-changed', { | |
| 226 signedIn: false, | |
| 227 }); | |
| 228 | |
| 229 assertTrue(activityControls.hidden); | |
| 230 }); | |
| 231 }); | |
| 232 | |
| 233 test('CustomizeSyncDisabledForManagedSignin', function() { | |
| 234 assertFalse(!!peoplePage.$$('#customize-sync')); | |
| 235 | |
| 236 return browserProxy.whenCalled('getSyncStatus').then(function() { | |
| 237 cr.webUIListenerCallback('sync-status-changed', { | |
| 238 signedIn: true, | |
| 239 syncSystemEnabled: true, | |
| 240 }); | |
| 241 Polymer.dom.flush(); | |
| 242 | |
| 243 var customizeSync = peoplePage.$$('#customize-sync'); | |
| 244 assertTrue(!!customizeSync); | |
| 245 assertTrue(customizeSync.hasAttribute('actionable')); | |
| 246 | |
| 247 cr.webUIListenerCallback('sync-status-changed', { | |
| 248 managed: true, | |
| 249 signedIn: true, | |
| 250 syncSystemEnabled: true, | |
| 251 }); | |
| 252 Polymer.dom.flush(); | |
| 253 | |
| 254 var customizeSync = peoplePage.$$('#customize-sync'); | |
| 255 assertTrue(!!customizeSync); | |
| 256 assertFalse(customizeSync.hasAttribute('actionable')); | |
| 257 }); | |
| 258 }); | |
| 259 }); | 259 }); |
| 260 } | 260 } |
| 261 | 261 |
| 262 return { | 262 return { |
| 263 registerTests: function() { | 263 registerTests: function() { |
| 264 registerProfileInfoTests(); | 264 registerProfileInfoTests(); |
| 265 if (!cr.isChromeOS) | 265 if (!cr.isChromeOS) |
| 266 registerSyncStatusTests(); | 266 registerSyncStatusTests(); |
| 267 }, | 267 }, |
| 268 }; | 268 }; |
| 269 }); | 269 }); |
| OLD | NEW |