| OLD | NEW |
| 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 OptionsPage WebUI testing. | 6 * TestFixture for OptionsPage WebUI testing. |
| 7 * @extends {testing.Test} | 7 * @extends {testing.Test} |
| 8 * @constructor | 8 * @constructor |
| 9 **/ | 9 */ |
| 10 function OptionsWebUITest() {} | 10 function OptionsWebUITest() {} |
| 11 | 11 |
| 12 OptionsWebUITest.prototype = { | 12 OptionsWebUITest.prototype = { |
| 13 __proto__: testing.Test.prototype, | 13 __proto__: testing.Test.prototype, |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Browse to the options page & call our PreLoad(). | 16 * Browse to the options page & call our preLoad(). |
| 17 **/ | 17 */ |
| 18 browsePreload: 'chrome://settings', | 18 browsePreload: 'chrome://settings', |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * Register a mock handler to ensure expectations are met and options pages | 21 * Register a mock handler to ensure expectations are met and options pages |
| 22 * behave correctly. | 22 * behave correctly. |
| 23 **/ | 23 */ |
| 24 PreLoad: function() { | 24 preLoad: function() { |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * Create handler class with empty methods to allow mocking to register | 27 * Create handler class with empty methods to allow mocking to register |
| 28 * expectations and for registration of handlers with chrome.send. | 28 * expectations and for registration of handlers with chrome.send. |
| 29 **/ | 29 */ |
| 30 function MockOptionsHandler() {} | 30 function MockOptionsHandler() {} |
| 31 | 31 |
| 32 MockOptionsHandler.prototype = { | 32 MockOptionsHandler.prototype = { |
| 33 coreOptionsInitialize: function() {}, | 33 coreOptionsInitialize: function() {}, |
| 34 fetchPrefs: function() {}, | 34 fetchPrefs: function() {}, |
| 35 observePrefs: function() {}, | 35 observePrefs: function() {}, |
| 36 setBooleanPref: function() {}, | 36 setBooleanPref: function() {}, |
| 37 setIntegerPref: function() {}, | 37 setIntegerPref: function() {}, |
| 38 setDoublePref: function() {}, | 38 setDoublePref: function() {}, |
| 39 setStringPref: function() {}, | 39 setStringPref: function() {}, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 66 GEN('#endif // defined(OS_MACOSX)'); | 66 GEN('#endif // defined(OS_MACOSX)'); |
| 67 | 67 |
| 68 TEST_F('OptionsWebUITest', 'MAYBE_testSetBooleanPrefTriggers', function() { | 68 TEST_F('OptionsWebUITest', 'MAYBE_testSetBooleanPrefTriggers', function() { |
| 69 // TODO(dtseng): make generic to click all buttons. | 69 // TODO(dtseng): make generic to click all buttons. |
| 70 var showHomeButton = $('toolbarShowHomeButton'); | 70 var showHomeButton = $('toolbarShowHomeButton'); |
| 71 var trueListValue = [ | 71 var trueListValue = [ |
| 72 'browser.show_home_button', | 72 'browser.show_home_button', |
| 73 true, | 73 true, |
| 74 'Options_Homepage_HomeButton', | 74 'Options_Homepage_HomeButton', |
| 75 ]; | 75 ]; |
| 76 // Note: this expectation is checked in testing::Test::TearDown. | 76 // Note: this expectation is checked in testing::Test::tearDown. |
| 77 this.mockHandler.expects(once()).setBooleanPref(trueListValue); | 77 this.mockHandler.expects(once()).setBooleanPref(trueListValue); |
| 78 | 78 |
| 79 // Cause the handler to be called. | 79 // Cause the handler to be called. |
| 80 showHomeButton.click(); | 80 showHomeButton.click(); |
| 81 showHomeButton.blur(); | 81 showHomeButton.blur(); |
| 82 }); | 82 }); |
| 83 | 83 |
| 84 // Not meant to run on ChromeOS at this time. | 84 // Not meant to run on ChromeOS at this time. |
| 85 // Not finishing in windows. http://crbug.com/81723 | 85 // Not finishing in windows. http://crbug.com/81723 |
| 86 GEN('#if defined(OS_CHROMEOS) || defined(OS_MACOSX) || defined(OS_WIN) \\'); | 86 GEN('#if defined(OS_CHROMEOS) || defined(OS_MACOSX) || defined(OS_WIN) \\'); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 106 }); | 106 }); |
| 107 | 107 |
| 108 // Test that there are no console errors after opening all registered pages. | 108 // Test that there are no console errors after opening all registered pages. |
| 109 // crbug.com/90420 | 109 // crbug.com/90420 |
| 110 TEST_F('OptionsWebUITest', 'FLAKY_testOpenAllOptionsPages', function() { | 110 TEST_F('OptionsWebUITest', 'FLAKY_testOpenAllOptionsPages', function() { |
| 111 expectTrue(!!OptionsPage.registeredPages); | 111 expectTrue(!!OptionsPage.registeredPages); |
| 112 for (var name in OptionsPage.registeredPages) { | 112 for (var name in OptionsPage.registeredPages) { |
| 113 OptionsPage.showPageByName(name, false); | 113 OptionsPage.showPageByName(name, false); |
| 114 } | 114 } |
| 115 }); | 115 }); |
| OLD | NEW |