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

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

Issue 1864713003: [MD settings] appearance browser tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test proxy 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/appearance_page_test.js
diff --git a/chrome/test/data/webui/settings/appearance_page_test.js b/chrome/test/data/webui/settings/appearance_page_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..0bbb19a81dd11a7d718bc39906080654185ced28
--- /dev/null
+++ b/chrome/test/data/webui/settings/appearance_page_test.js
@@ -0,0 +1,73 @@
+// Copyright 2015 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.
+
+/** @fileoverview Runs polymer appearance font settings elements. */
dpapad 2016/04/13 19:06:24 Nit: /** @fileoverview Tests for appearance font s
+
+cr.define('settings_appearance', function() {
+ /**
+ * A test version of FontsBrowserProxy.
+ *
+ * @constructor
+ * @implements {settings.FontsBrowserProxy}
+ * @extends {settings.TestBrowserProxy}
+ */
+ var TestFontsBrowserProxy = function() {
+ settings.TestBrowserProxy.call(this, [
+ 'fetchFontsData',
+ 'observeAdvancedFontExtensionAvailable',
+ ]);
+
+ /** @private {!FontsData} */
+ this.fontsData_ = {
+ 'fontList': [['font name', 'alternate', 'ltr']],
dpapad 2016/04/13 19:06:24 Nit(optional): Object property names do not need q
+ 'encodingList': [['encoding name', 'alternate', 'ltr']],
+ };
+ };
+
+ TestFontsBrowserProxy.prototype = {
+ __proto__: settings.TestBrowserProxy.prototype,
+
+ /** @override */
+ fetchFontsData: function() {
+ this.methodCalled('fetchFontsData');
+ return Promise.resolve(this.fontsData_);
+ },
+
+ /** @override */
+ observeAdvancedFontExtensionAvailable: function() {
+ this.methodCalled('observeAdvancedFontExtensionAvailable');
+ },
+ };
+
+ function registerAppearanceFontSettingsBrowserTest() {
+ var fontsPage = null;
+
+ /** @type {?TestFontsBrowserProxy} */
+ var fontsBrowserProxy = null;
+
+ suite('AppearanceFontHandler', function() {
+ setup(function() {
+ fontsBrowserProxy = new TestFontsBrowserProxy();
+ settings.FontsBrowserProxyImpl.instance_ = fontsBrowserProxy;
+
+ PolymerTest.clearBody();
+
+ fontsPage = document.createElement('settings-appearance-fonts-page');
+ document.body.appendChild(fontsPage);
+ });
+
+ teardown(function() { fontsPage.remove(); });
+
+ test('fetchFontsData', function() {
+ return fontsBrowserProxy.whenCalled('fetchFontsData');
+ });
+ });
+ }
+
+ return {
+ registerTests: function() {
+ registerAppearanceFontSettingsBrowserTest();
+ },
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698