summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/options/advanced_options_browsertest.js
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui/webui/options/advanced_options_browsertest.js')
-rw-r--r--chrome/browser/ui/webui/options/advanced_options_browsertest.js41
1 files changed, 40 insertions, 1 deletions
diff --git a/chrome/browser/ui/webui/options/advanced_options_browsertest.js b/chrome/browser/ui/webui/options/advanced_options_browsertest.js
index a97945b..a929bbb 100644
--- a/chrome/browser/ui/webui/options/advanced_options_browsertest.js
+++ b/chrome/browser/ui/webui/options/advanced_options_browsertest.js
@@ -16,9 +16,48 @@ AdvancedOptionsWebUITest.prototype = {
* 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);
+});
+