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

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

Issue 1896283003: [MD settings] appearance theme and wallpaper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: @private 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/browser/ui/webui/settings/appearance_handler.cc ('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/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
index 0bbb19a81dd11a7d718bc39906080654185ced28..425f21743bd114a15312e59e218e7a63f1be39fc 100644
--- a/chrome/test/data/webui/settings/appearance_page_test.js
+++ b/chrome/test/data/webui/settings/appearance_page_test.js
@@ -6,6 +6,56 @@
cr.define('settings_appearance', function() {
/**
+ * A test version of AppearanceBrowserProxy.
+ *
+ * @constructor
+ * @implements {settings.AppearanceBrowserProxy}
+ * @extends {settings.TestBrowserProxy}
+ */
+ var TestAppearanceBrowserProxy = function() {
+ settings.TestBrowserProxy.call(this, [
+ 'getResetThemeEnabled',
+ 'openWallpaperManager',
+ 'resetTheme',
+ ]);
+
+ /**
+ * @type {boolean}
+ * @private
+ */
+ this.allowResetTheme_ = false;
+ };
+
+ TestAppearanceBrowserProxy.prototype = {
+ __proto__: settings.TestBrowserProxy.prototype,
+
+ /** @override */
+ getResetThemeEnabled: function() {
+ this.methodCalled('getResetThemeEnabled');
+ return Promise.resolve(this.allowResetTheme_);
+ },
+
+ /** @override */
+ openWallpaperManager: function() {
+ this.methodCalled('openWallpaperManager');
+ },
+
+ /** @override */
+ resetTheme: function() {
+ this.methodCalled('resetTheme');
+ },
+
+ /**
+ * @param {boolean} isEnabled Whether the user reset the theme.
+ */
+ setAllowResetTheme: function(isEnabled) {
+ this.allowResetTheme_ = isEnabled;
+ cr.webUIListenerCallback('reset-theme-enabled-changed', isEnabled);
+ Polymer.dom.flush();
+ }
+ };
+
+ /**
* A test version of FontsBrowserProxy.
*
* @constructor
@@ -16,6 +66,7 @@ cr.define('settings_appearance', function() {
settings.TestBrowserProxy.call(this, [
'fetchFontsData',
'observeAdvancedFontExtensionAvailable',
+ 'openAdvancedFontSettings',
]);
/** @private {!FontsData} */
@@ -38,8 +89,57 @@ cr.define('settings_appearance', function() {
observeAdvancedFontExtensionAvailable: function() {
this.methodCalled('observeAdvancedFontExtensionAvailable');
},
+
+ /** @override */
+ openAdvancedFontSettings: function() {
+ this.methodCalled('openAdvancedFontSettings');
+ },
};
+ function registerAppearanceSettingsBrowserTest() {
+ var appearancePage = null;
+
+ /** @type {?TestAppearanceBrowserProxy} */
+ var appearanceBrowserProxy = null;
+
+ suite('AppearanceHandler', function() {
+ setup(function() {
+ appearanceBrowserProxy = new TestAppearanceBrowserProxy();
+ settings.AppearanceBrowserProxyImpl.instance_ = appearanceBrowserProxy;
+
+ PolymerTest.clearBody();
+
+ appearancePage = document.createElement('settings-appearance-page');
+ document.body.appendChild(appearancePage);
+ });
+
+ teardown(function() { appearancePage.remove(); });
+
+ if (cr.isChromeOS) {
+ test('wallpaperManager', function() {
+ var button = appearancePage.$.wallpaperButton;
+ assertTrue(!!button);
+ MockInteractions.tap(button);
+ return appearanceBrowserProxy.whenCalled('openWallpaperManager');
+ });
+ } else {
+ test('noWallpaperManager', function() {
+ // The wallpaper button should not be present.
+ var button = appearancePage.$.wallpaperButton;
+ assertFalse(!!button);
+ });
+ }
+
+ test('resetTheme', function() {
+ appearanceBrowserProxy.setAllowResetTheme(true);
+ var button = appearancePage.$$('#resetTheme');
+ assertTrue(!!button);
+ MockInteractions.tap(button);
+ return appearanceBrowserProxy.whenCalled('resetTheme');
+ });
+ });
+ }
+
function registerAppearanceFontSettingsBrowserTest() {
var fontsPage = null;
@@ -62,12 +162,22 @@ cr.define('settings_appearance', function() {
test('fetchFontsData', function() {
return fontsBrowserProxy.whenCalled('fetchFontsData');
});
+
+ test('openAdvancedFontSettings', function() {
+ cr.webUIListenerCallback('advanced-font-settings-installed', [true]);
+ Polymer.dom.flush();
+ var button = fontsPage.$$('#advancedButton');
+ assert(!!button);
+ MockInteractions.tap(button);
+ return fontsBrowserProxy.whenCalled('openAdvancedFontSettings');
+ });
});
}
return {
registerTests: function() {
registerAppearanceFontSettingsBrowserTest();
+ registerAppearanceSettingsBrowserTest();
},
};
});
« no previous file with comments | « chrome/browser/ui/webui/settings/appearance_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698