Chromium Code Reviews| 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 "chrome/browser/ui/webui/options/options_browsertest.h"'); | 5 GEN('#include "chrome/browser/ui/webui/options/options_browsertest.h"'); |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Wait for the global window.onpopstate callback to be called (after a tab | 8 * Wait for the global window.onpopstate callback to be called (after a tab |
| 9 * history navigation), then execute |afterFunction|. | 9 * history navigation), then execute |afterFunction|. |
| 10 */ | 10 */ |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 testDone(); | 225 testDone(); |
| 226 }, 0) | 226 }, 0) |
| 227 } | 227 } |
| 228 this.mockHandler.expects(once()).setBooleanPref( | 228 this.mockHandler.expects(once()).setBooleanPref( |
| 229 eq(["enable_do_not_track", false, 'Options_DoNotTrackCheckbox'])).will( | 229 eq(["enable_do_not_track", false, 'Options_DoNotTrackCheckbox'])).will( |
| 230 callFunction(verifyCorrectEndState)); | 230 callFunction(verifyCorrectEndState)); |
| 231 | 231 |
| 232 dntCheckbox.click(); | 232 dntCheckbox.click(); |
| 233 }); | 233 }); |
| 234 | 234 |
| 235 // Verify that preventDefault() is called on 'Enter' keydown events that trigger | |
| 236 // the default button. | |
|
Dan Beam
2013/08/06 00:53:32
nit: explain why you want to ensure preventDefault
Rune Fevang
2013/08/06 00:58:02
Done.
| |
| 237 TEST_F('OptionsWebUITest', 'EnterPreventsDefault', function() { | |
| 238 var page = HomePageOverlay.getInstance(); | |
| 239 OptionsPage.showPageByName(page.name); | |
| 240 var event = new KeyboardEvent('keydown', { | |
| 241 'bubbles': true, | |
| 242 'cancelable': true, | |
| 243 'keyIdentifier': 'Enter' | |
| 244 }); | |
| 245 assertFalse(event.defaultPrevented); | |
| 246 page.pageDiv.dispatchEvent(event); | |
| 247 assertTrue(event.defaultPrevented); | |
| 248 testDone(); | |
| 249 }); | |
| 250 | |
| 235 /** | 251 /** |
| 236 * TestFixture for OptionsPage WebUI testing including tab history. | 252 * TestFixture for OptionsPage WebUI testing including tab history. |
| 237 * @extends {testing.Test} | 253 * @extends {testing.Test} |
| 238 * @constructor | 254 * @constructor |
| 239 */ | 255 */ |
| 240 function OptionsWebUINavigationTest() {} | 256 function OptionsWebUINavigationTest() {} |
| 241 | 257 |
| 242 OptionsWebUINavigationTest.prototype = { | 258 OptionsWebUINavigationTest.prototype = { |
| 243 __proto__: testing.Test.prototype, | 259 __proto__: testing.Test.prototype, |
| 244 | 260 |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 622 var self = this; | 638 var self = this; |
| 623 self.verifyOpenPages_(['settings', 'content', 'cookies']); | 639 self.verifyOpenPages_(['settings', 'content', 'cookies']); |
| 624 self.verifyHistory_(['settings', 'languages', 'cookies'], function() { | 640 self.verifyHistory_(['settings', 'languages', 'cookies'], function() { |
| 625 window.history.back(); | 641 window.history.back(); |
| 626 waitForPopstate(function() { | 642 waitForPopstate(function() { |
| 627 self.verifyOpenPages_(['settings', 'languages']); | 643 self.verifyOpenPages_(['settings', 'languages']); |
| 628 testDone(); | 644 testDone(); |
| 629 }); | 645 }); |
| 630 }); | 646 }); |
| 631 }); | 647 }); |
| OLD | NEW |