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

Unified Diff: chrome/test/data/webui/settings/people_page_test.js

Issue 1900913002: Settings People Revamp: Split Profile Info out into its own handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/webui/settings/people_page_test.js
diff --git a/chrome/test/data/webui/settings/people_page_test.js b/chrome/test/data/webui/settings/people_page_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..5045c1ed822f982b16279e8150a2cb3a022b8c68
--- /dev/null
+++ b/chrome/test/data/webui/settings/people_page_test.js
@@ -0,0 +1,85 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('settings_people_page', function() {
+ /**
+ * @constructor
+ * @implements {settings.ProfileInfoBrowserProxy}
+ * @extends {settings.TestBrowserProxy}
+ */
+ var TestProfileInfoBrowserProxy = function() {
+ settings.TestBrowserProxy.call(this, [
+ 'getProfileInfo',
+ ]);
+ };
+
+ TestProfileInfoBrowserProxy.prototype = {
+ __proto__: settings.TestBrowserProxy.prototype,
+
+ /** @override */
+ getProfileInfo: function() {
+ this.methodCalled('getProfileInfo');
+ return Promise.resolve({
+ name: 'fakeName',
dpapad 2016/04/18 23:30:49 Nit (optional): Make this object a public member v
tommycli 2016/04/19 00:03:27 Done.
+ iconUrl: 'http://fake-icon-url.com/'
+ });
+ },
+ };
+
+ function registerProfileInfoTests() {
+ suite('ProfileInfoTests', function() {
+ var peoplePage = null;
+ var browserProxy = null;
+
+ suiteSetup(function() {
+ // Force easy unlock off. Those have their own ChromeOS-only tests.
+ loadTimeData.overrideValues({
+ easyUnlockAllowed: false,
+ });
+ });
+
+ setup(function() {
+ browserProxy = new TestProfileInfoBrowserProxy();
+ settings.ProfileInfoBrowserProxyImpl.instance_ = browserProxy;
+
+ PolymerTest.clearBody();
+ peoplePage = document.createElement('settings-people-page');
+ peoplePage.currentRoute = {
+ url: '/',
+ page: 'basic',
+ section: '',
+ };
+ document.body.appendChild(peoplePage);
+ });
+
+ teardown(function() { peoplePage.remove(); });
+
+ test('GetProfileInfo', function() {
+ return browserProxy.whenCalled('getProfileInfo').then(function() {
+ Polymer.dom.flush();
+ assertEquals('fakeName',
+ peoplePage.$$('#profile-name').textContent.trim());
+ assertEquals('http://fake-icon-url.com/',
dpapad 2016/04/18 23:30:49 assertEquals(browserProxy.profileInfo.iconUrl, peo
tommycli 2016/04/19 00:03:27 Done.
+ peoplePage.$$('#profile-icon').src);
+
+ cr.webUIListenerCallback(
+ 'profile-info-changed',
+ {name: 'pushedName', iconUrl: 'http://pushed-url/'});
+
+ Polymer.dom.flush();
+ assertEquals('pushedName',
+ peoplePage.$$('#profile-name').textContent.trim());
+ assertEquals('http://pushed-url/',
+ peoplePage.$$('#profile-icon').src);
+ });
+ });
+ });
+ }
+
+ return {
+ registerTests: function() {
+ registerProfileInfoTests();
+ },
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698