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

Unified Diff: chrome/browser/ui/webui/options/advanced_options_browsertest.js

Issue 8528011: Page zoom improvements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: One last(?) tweak. Created 9 years, 1 month 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/browser/ui/webui/options/advanced_options_browsertest.js
===================================================================
--- chrome/browser/ui/webui/options/advanced_options_browsertest.js (revision 110998)
+++ chrome/browser/ui/webui/options/advanced_options_browsertest.js (working copy)
@@ -16,9 +16,48 @@
* Browse to advanced options.
**/
browsePreload: 'chrome://settings/advanced',
+
+ /**
+ * Register a mock handler.
+ * @type {Function}
+ * @override
+ */
+ preLoad: function() {
+ this.makeAndRegisterMockHandler(['defaultZoomFactorAction']);
+ },
};
-// Test opening the advanced options has correct location.
+/**
+ * The expected minimum length of the |defaultZoomFactor| element.
+ * @type {number}
+ * @const
+ */
+var defaultZoomFactorMinimumLength = 10;
+
+/**
+ * Test opening the advanced options has correct location.
+ */
TEST_F('AdvancedOptionsWebUITest', 'testOpenAdvancedOptions', function() {
assertEquals(this.browsePreload, document.location.href);
});
+
+/**
+ * Test the default zoom factor select element.
+ */
+TEST_F('AdvancedOptionsWebUITest', 'testDefaultZoomFactor', function() {
+ // Verify that the zoom factor element exists.
+ var defaultZoomFactor = $('defaultZoomFactor');
+ assertNotEquals(defaultZoomFactor, null);
+
+ // Verify that the zoom factor element has a reasonable number of choices.
+ expectGE(defaultZoomFactor.options.length, defaultZoomFactorMinimumLength);
+
+ // Simulate a change event, selecting the highest zoom value. Verify that
+ // the javascript handler was invoked once.
+ this.mockHandler.expects(once()).defaultZoomFactorAction(NOT_NULL).
+ will(callFunction(function() { }));
+ defaultZoomFactor.selectedIndex = defaultZoomFactor.options.length - 1;
+ var event = { target: defaultZoomFactor };
+ if (defaultZoomFactor.onchange) defaultZoomFactor.onchange(event);
+});
+

Powered by Google App Engine
This is Rietveld 408576698