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

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
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8a4bbe2e6d2fd3ca729790aa6d103af65baa7c07
--- /dev/null
+++ b/chrome/test/data/webui/settings/people_page_test.js
@@ -0,0 +1,87 @@
+// 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,
+
+ fakeProfileInfo: {
+ name: 'fakeName',
+ iconUrl: 'http://fake-icon-url.com/',
+ },
+
+ /** @override */
+ getProfileInfo: function() {
+ this.methodCalled('getProfileInfo');
+ return Promise.resolve(this.fakeProfileInfo);
+ },
+ };
+
+ 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(browserProxy.fakeProfileInfo.name,
+ peoplePage.$$('#profile-name').textContent.trim());
+ assertEquals(browserProxy.fakeProfileInfo.iconUrl,
+ 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();
+ },
+ };
+});
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698