| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 /** @override */ | 62 /** @override */ |
| 63 signOut: function(deleteProfile) { | 63 signOut: function(deleteProfile) { |
| 64 this.methodCalled('signOut', deleteProfile); | 64 this.methodCalled('signOut', deleteProfile); |
| 65 }, | 65 }, |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 function registerProfileInfoTests() { | 68 function registerProfileInfoTests() { |
| 69 suite('ProfileInfoTests', function() { | 69 suite('ProfileInfoTests', function() { |
| 70 var peoplePage = null; | 70 var peoplePage = null; |
| 71 var browserProxy = null; | 71 var browserProxy = null; |
| 72 var syncBrowserProxy = null; |
| 72 | 73 |
| 73 suiteSetup(function() { | 74 suiteSetup(function() { |
| 74 // Force easy unlock off. Those have their own ChromeOS-only tests. | 75 // Force easy unlock off. Those have their own ChromeOS-only tests. |
| 75 loadTimeData.overrideValues({ | 76 loadTimeData.overrideValues({ |
| 76 easyUnlockAllowed: false, | 77 easyUnlockAllowed: false, |
| 77 }); | 78 }); |
| 78 }); | 79 }); |
| 79 | 80 |
| 80 setup(function() { | 81 setup(function() { |
| 81 browserProxy = new TestProfileInfoBrowserProxy(); | 82 browserProxy = new TestProfileInfoBrowserProxy(); |
| 82 settings.ProfileInfoBrowserProxyImpl.instance_ = browserProxy; | 83 settings.ProfileInfoBrowserProxyImpl.instance_ = browserProxy; |
| 83 | 84 |
| 85 syncBrowserProxy = new TestSyncBrowserProxy(); |
| 86 settings.SyncBrowserProxyImpl.instance_ = syncBrowserProxy; |
| 87 |
| 84 PolymerTest.clearBody(); | 88 PolymerTest.clearBody(); |
| 85 peoplePage = document.createElement('settings-people-page'); | 89 peoplePage = document.createElement('settings-people-page'); |
| 86 document.body.appendChild(peoplePage); | 90 document.body.appendChild(peoplePage); |
| 87 }); | 91 }); |
| 88 | 92 |
| 89 teardown(function() { peoplePage.remove(); }); | 93 teardown(function() { peoplePage.remove(); }); |
| 90 | 94 |
| 91 test('GetProfileInfo', function() { | 95 test('GetProfileInfo', function() { |
| 92 return browserProxy.whenCalled('getProfileInfo').then(function() { | 96 return Promise.all([browserProxy.whenCalled('getProfileInfo'), |
| 97 syncBrowserProxy.whenCalled('getSyncStatus')]) |
| 98 .then(function() { |
| 93 Polymer.dom.flush(); | 99 Polymer.dom.flush(); |
| 94 assertEquals(browserProxy.fakeProfileInfo.name, | 100 assertEquals(browserProxy.fakeProfileInfo.name, |
| 95 peoplePage.$$('#profile-name').textContent.trim()); | 101 peoplePage.$$('#profile-name').textContent.trim()); |
| 96 var bg = peoplePage.$$('#profile-icon').style.backgroundImage; | 102 var bg = peoplePage.$$('#profile-icon').style.backgroundImage; |
| 97 assertTrue(bg.includes(browserProxy.fakeProfileInfo.iconUrl)); | 103 assertTrue(bg.includes(browserProxy.fakeProfileInfo.iconUrl)); |
| 98 | 104 |
| 99 cr.webUIListenerCallback( | 105 cr.webUIListenerCallback( |
| 100 'profile-info-changed', | 106 'profile-info-changed', |
| 101 {name: 'pushedName', iconUrl: 'http://pushed-url/'}); | 107 {name: 'pushedName', iconUrl: 'http://pushed-url/'}); |
| 102 | 108 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 260 } |
| 255 | 261 |
| 256 return { | 262 return { |
| 257 registerTests: function() { | 263 registerTests: function() { |
| 258 registerProfileInfoTests(); | 264 registerProfileInfoTests(); |
| 259 if (!cr.isChromeOS) | 265 if (!cr.isChromeOS) |
| 260 registerSyncStatusTests(); | 266 registerSyncStatusTests(); |
| 261 }, | 267 }, |
| 262 }; | 268 }; |
| 263 }); | 269 }); |
| OLD | NEW |