| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 GEN_INCLUDE(['options_browsertest_base.js']); | 5 GEN_INCLUDE(['options_browsertest_base.js']); |
| 6 GEN('#include "chrome/browser/ui/webui/options/options_browsertest.h"'); | 6 GEN('#include "chrome/browser/ui/webui/options/options_browsertest.h"'); |
| 7 | 7 |
| 8 /** @const */ var SUPERVISED_USERS_PREF = 'profile.managed_users'; | 8 /** @const */ var SUPERVISED_USERS_PREF = 'profile.managed_users'; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 /** @override */ | 55 /** @override */ |
| 56 isAsync: true, | 56 isAsync: true, |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * Register a mock handler to ensure expectations are met and options pages | 59 * Register a mock handler to ensure expectations are met and options pages |
| 60 * behave correctly. | 60 * behave correctly. |
| 61 */ | 61 */ |
| 62 preLoad: function() { | 62 preLoad: function() { |
| 63 this.makeAndRegisterMockHandler( | 63 this.makeAndRegisterMockHandler( |
| 64 ['defaultZoomFactorAction', | 64 ['defaultZoomFactorAction', |
| 65 'defaultZoomScopeAction', |
| 65 'fetchPrefs', | 66 'fetchPrefs', |
| 66 'observePrefs', | 67 'observePrefs', |
| 67 'setBooleanPref', | 68 'setBooleanPref', |
| 68 'setIntegerPref', | 69 'setIntegerPref', |
| 69 'setDoublePref', | 70 'setDoublePref', |
| 70 'setStringPref', | 71 'setStringPref', |
| 71 'setObjectPref', | 72 'setObjectPref', |
| 72 'clearPref', | 73 'clearPref', |
| 73 'coreOptionsUserMetricsAction', | 74 'coreOptionsUserMetricsAction', |
| 74 ]); | 75 ]); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // the javascript handler was invoked once. | 197 // the javascript handler was invoked once. |
| 197 this.mockHandler.expects(once()).defaultZoomFactorAction(NOT_NULL). | 198 this.mockHandler.expects(once()).defaultZoomFactorAction(NOT_NULL). |
| 198 will(callFunction(function() { })); | 199 will(callFunction(function() { })); |
| 199 defaultZoomFactor.selectedIndex = defaultZoomFactor.options.length - 1; | 200 defaultZoomFactor.selectedIndex = defaultZoomFactor.options.length - 1; |
| 200 var event = {target: defaultZoomFactor}; | 201 var event = {target: defaultZoomFactor}; |
| 201 if (defaultZoomFactor.onchange) defaultZoomFactor.onchange(event); | 202 if (defaultZoomFactor.onchange) defaultZoomFactor.onchange(event); |
| 202 testDone(); | 203 testDone(); |
| 203 }); | 204 }); |
| 204 | 205 |
| 205 /** | 206 /** |
| 207 * Test the default zoom scope checkbox. |
| 208 */ |
| 209 TEST_F('OptionsWebUITest', 'testDefaultZoomScope', function() { |
| 210 // Verify that the zoom scope checkbox exists. |
| 211 var defaultZoomScope = $('defaultZoomScope'); |
| 212 assertNotEquals(defaultZoomScope, null); |
| 213 var initialValue = $('defaultZoomScope').checked; |
| 214 |
| 215 this.mockHandler.expects(once()).defaultZoomScopeAction([!initialValue]); |
| 216 defaultZoomScope.click(); |
| 217 testDone(); |
| 218 }); |
| 219 |
| 220 /** |
| 206 * If |confirmInterstitial| is true, the OK button of the Do Not Track | 221 * If |confirmInterstitial| is true, the OK button of the Do Not Track |
| 207 * interstitial is pressed, otherwise the abort button is pressed. | 222 * interstitial is pressed, otherwise the abort button is pressed. |
| 208 * @param {boolean} confirmInterstitial Whether to confirm the Do Not Track | 223 * @param {boolean} confirmInterstitial Whether to confirm the Do Not Track |
| 209 * interstitial. | 224 * interstitial. |
| 210 */ | 225 */ |
| 211 OptionsWebUITest.prototype.testDoNotTrackInterstitial = | 226 OptionsWebUITest.prototype.testDoNotTrackInterstitial = |
| 212 function(confirmInterstitial) { | 227 function(confirmInterstitial) { |
| 213 Preferences.prefsFetchedCallback({'enable_do_not_track': {'value': false}}); | 228 Preferences.prefsFetchedCallback({'enable_do_not_track': {'value': false}}); |
| 214 var buttonToClick = confirmInterstitial ? $('do-not-track-confirm-ok') : | 229 var buttonToClick = confirmInterstitial ? $('do-not-track-confirm-ok') : |
| 215 $('do-not-track-confirm-cancel'); | 230 $('do-not-track-confirm-cancel'); |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 __proto__: OptionsWebUIExtendedTest.prototype, | 974 __proto__: OptionsWebUIExtendedTest.prototype, |
| 960 | 975 |
| 961 /** @override */ | 976 /** @override */ |
| 962 browsePreload: 'chrome://settings-frame/nonexistantPage', | 977 browsePreload: 'chrome://settings-frame/nonexistantPage', |
| 963 }; | 978 }; |
| 964 | 979 |
| 965 TEST_F('OptionsWebUIRedirectTest', 'TestURL', function() { | 980 TEST_F('OptionsWebUIRedirectTest', 'TestURL', function() { |
| 966 assertEquals('chrome://settings-frame/', document.location.href); | 981 assertEquals('chrome://settings-frame/', document.location.href); |
| 967 this.verifyHistory_([''], testDone); | 982 this.verifyHistory_([''], testDone); |
| 968 }); | 983 }); |
| OLD | NEW |