OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * TestFixture for advanced options WebUI testing. | |
7 * @extends {testing.Test} | |
8 * @constructor | |
9 **/ | |
10 function AdvancedOptionsWebUITest() {} | |
11 | |
12 AdvancedOptionsWebUITest.prototype = { | |
13 __proto__: testing.Test.prototype, | |
14 | |
15 /** | |
16 * Browse to advanced options. | |
17 **/ | |
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 }, | |
28 }; | |
29 | |
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 */ | |
40 TEST_F('AdvancedOptionsWebUITest', 'testOpenAdvancedOptions', function() { | |
41 assertEquals(this.browsePreload, document.location.href); | |
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 | |
OLD | NEW |