| 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
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6e3a8d7deaddad1b450630c307cd2ab84193c5a9
|
| --- /dev/null
|
| +++ b/chrome/test/data/webui/settings/appearance_browsertest.js
|
| @@ -0,0 +1,74 @@
|
| +// 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 Settings elements. */
|
| +
|
| +GEN_INCLUDE(['settings_page_browsertest.js']);
|
| +
|
| +/**
|
| + * Test Polymer Appearance Settings elements.
|
| + * @constructor
|
| + * @extends {SettingsPageBrowserTest}
|
| +*/
|
| +function AppearanceSettingsBrowserTest() {}
|
| +
|
| +AppearanceSettingsBrowserTest.prototype = {
|
| + __proto__: SettingsPageBrowserTest.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;
|
| + },
|
| +};
|
| +
|
| +TEST_F('AppearanceSettingsBrowserTest', 'uiTests', function() {
|
| + /**
|
| + * The prefs API that will get a fake implementation.
|
| + * @type {!SettingsPrivate}
|
| + */
|
| + var settingsPrefs;
|
| + var self = this;
|
| +
|
| + var fontSize = function() {
|
| + return self.appearancePage(
|
| + '#defaultFontSize').$$('.iron-selected').textContent.trim();
|
| + };
|
| +
|
| + suite('AppearanceHandler', function() {
|
| + suiteSetup(function() {
|
| + settingsPrefs = document.querySelector(
|
| + 'cr-settings').$$('settings-prefs');
|
| + assertTrue(!!settingsPrefs);
|
| + return CrSettingsPrefs.initialized;
|
| + });
|
| +
|
| + test('very small font', function() {
|
| + settingsPrefs.set('prefs.webkit.webprefs.default_font_size.value', 9);
|
| + assertEquals('Very small', fontSize());
|
| + });
|
| +
|
| + test('large font', function() {
|
| + settingsPrefs.set('prefs.webkit.webprefs.default_font_size.value', 20);
|
| + assertEquals('Large', fontSize());
|
| + });
|
| +
|
| + /**
|
| + * 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());
|
| + });
|
| + });
|
| + mocha.run();
|
| +});
|
|
|