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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * TestFixture for advanced options WebUI testing. 6 * TestFixture for advanced options WebUI testing.
7 * @extends {testing.Test} 7 * @extends {testing.Test}
8 * @constructor 8 * @constructor
9 **/ 9 **/
10 function AdvancedOptionsWebUITest() {} 10 function AdvancedOptionsWebUITest() {}
11 11
12 AdvancedOptionsWebUITest.prototype = { 12 AdvancedOptionsWebUITest.prototype = {
13 __proto__: testing.Test.prototype, 13 __proto__: testing.Test.prototype,
14 14
15 /** 15 /**
16 * Browse to advanced options. 16 * Browse to advanced options.
17 **/ 17 **/
18 browsePreload: 'chrome://settings/advanced', 18 browsePreload: 'chrome://settings/advanced',
19
20 /**
21 * Register a mock handler.
22 * @type {Function}
23 * @override
24 */
25 preLoad: function() {
26 this.makeAndRegisterMockHandler(['defaultZoomFactorAction']);
27 },
19 }; 28 };
20 29
21 // Test opening the advanced options has correct location. 30 /**
31 * The expected minimum length of the |defaultZoomFactor| element.
32 * @type {number}
33 * @const
34 */
35 var defaultZoomFactorMinimumLength = 10;
36
37 /**
38 * Test opening the advanced options has correct location.
39 */
22 TEST_F('AdvancedOptionsWebUITest', 'testOpenAdvancedOptions', function() { 40 TEST_F('AdvancedOptionsWebUITest', 'testOpenAdvancedOptions', function() {
23 assertEquals(this.browsePreload, document.location.href); 41 assertEquals(this.browsePreload, document.location.href);
24 }); 42 });
43
44 /**
45 * Test the default zoom factor select element.
46 */
47 TEST_F('AdvancedOptionsWebUITest', 'testDefaultZoomFactor', function() {
48 // Verify that the zoom factor element exists.
49 var defaultZoomFactor = $('defaultZoomFactor');
50 assertNotEquals(defaultZoomFactor, null);
51
52 // Verify that the zoom factor element has a reasonable number of choices.
53 expectGE(defaultZoomFactor.options.length, defaultZoomFactorMinimumLength);
54
55 // Simulate a change event, selecting the highest zoom value. Verify that
56 // the javascript handler was invoked once.
57 this.mockHandler.expects(once()).defaultZoomFactorAction(NOT_NULL).
58 will(callFunction(function() { }));
59 defaultZoomFactor.selectedIndex = defaultZoomFactor.options.length - 1;
60 var event = { target: defaultZoomFactor };
61 if (defaultZoomFactor.onchange) defaultZoomFactor.onchange(event);
62 });
63
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698