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

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

Issue 1864713003: [MD settings] appearance browser tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review changes 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/chrome_tests.gypi ('k') | chrome/test/data/webui/settings/cr_settings_browsertest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/appearance_browsertest.js
diff --git a/chrome/test/data/webui/settings/appearance_browsertest.js b/chrome/test/data/webui/settings/appearance_browsertest.js
index 3c3e17a34fee8d5c3ba76a202f894fc4d3b529f9..8050c00fa019d818a445bbc9fe8e556ece65d0c2 100644
--- a/chrome/test/data/webui/settings/appearance_browsertest.js
+++ b/chrome/test/data/webui/settings/appearance_browsertest.js
@@ -2,73 +2,66 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-/** @fileoverview Runs Polymer Appearance Settings elements. */
+/** @fileoverview Runs polymer appearance font settings elements. */
-GEN_INCLUDE(['settings_page_browsertest.js']);
+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',
+ ]);
-/**
- * Test Polymer Appearance Settings elements.
- * @constructor
- * @extends {SettingsPageBrowserTest}
-*/
-function AppearanceSettingsBrowserTest() {}
+ /** @private {!FontData} */
dpapad 2016/04/07 21:24:26 Typo? s/FontData/FontsData
dschuyler 2016/04/07 21:30:49 Done.
+ this.fontsData_ = {
+ 'fontList': [['font name', 'alternate', 'ltr']],
+ 'encodingList': [['encoding name', 'alternate', 'ltr']],
+ };
+ };
-AppearanceSettingsBrowserTest.prototype = {
- __proto__: SettingsPageBrowserTest.prototype,
+ TestFontsBrowserProxy.prototype = {
+ __proto__: settings.TestBrowserProxy.prototype,
- /** @return {string} */
- appearancePage: function(selector) {
- var section = this.getSection(this.getPage('basic'), 'appearance');
- assertTrue(!!section);
- var appearance = section.querySelector('settings-appearance-page');
- assertTrue(!!appearance);
- var result = appearance.$$(selector);
- assertTrue(!!result);
- return result;
- },
-};
+ /** @override */
+ fetchFontsData: function() {
+ this.methodCalled('fetchFontsData');
+ return Promise.resolve(this.fontsData_);
+ },
+ };
-TEST_F('AppearanceSettingsBrowserTest', 'uiTests', function() {
- /**
- * The prefs API that will get a fake implementation.
- * @type {!SettingsPrivate}
- */
- var settingsPrefs;
- var self = this;
+ function registerAppearanceFontSettingsBrowserTest() {
+ var fontsPage = null;
- var fontSize = function() {
- return self.appearancePage(
- '#defaultFontSize').$$('[class=iron-selected]').textContent.trim();
- };
+ /** @type {?TestFontsBrowserProxy} */
+ var fontsBrowserProxy = null;
- suite('AppearanceHandler', function() {
- suiteSetup(function() {
- settingsPrefs = document.querySelector(
- 'cr-settings').$$('settings-prefs');
- assertTrue(!!settingsPrefs);
- return CrSettingsPrefs.initialized;
- });
+ suite('AppearanceFontHandler', function() {
+ setup(function() {
+ fontsBrowserProxy = new TestFontsBrowserProxy();
+ settings.FontsBrowserProxyImpl.instance_ = fontsBrowserProxy;
- test('very small font', function() {
- settingsPrefs.set('prefs.webkit.webprefs.default_font_size.value', 9);
- assertEquals('Very small', fontSize());
- });
+ PolymerTest.clearBody();
- test('large font', function() {
- settingsPrefs.set('prefs.webkit.webprefs.default_font_size.value', 20);
- assertEquals('Large', fontSize());
- });
+ fontsPage = document.createElement('settings-appearance-fonts-page');
+ document.body.appendChild(fontsPage);
+ });
- /**
- * If the font size is not one of the preset options (e.g. 16, 20, etc.)
- * then the menu label will be 'Custom' (rather than 'Medium', 'Large',
- * etc.).
- */
- test('custom font size', function() {
- settingsPrefs.set(
- 'prefs.webkit.webprefs.default_font_size.value', 19);
- assertEquals('Custom', fontSize());
+ teardown(function() { fontsPage.remove(); });
+
+ test('fetchFontsData', function() {
+ return fontsBrowserProxy.whenCalled('fetchFontsData');
+ });
});
- });
- mocha.run();
+ }
+
+ return {
+ registerTests: function() {
+ registerAppearanceFontSettingsBrowserTest();
+ },
+ };
});
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/webui/settings/cr_settings_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698