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. If this doesn't happen, other elements that may get |
| 237 // focus (by the overlay closing for instance), will execute in addition to the |
| 238 // default button. See crbug.com/268336. |
| 239 TEST_F('OptionsWebUITest', 'EnterPreventsDefault', function() { |
| 240 var page = HomePageOverlay.getInstance(); |
| 241 OptionsPage.showPageByName(page.name); |
| 242 var event = new KeyboardEvent('keydown', { |
| 243 'bubbles': true, |
| 244 'cancelable': true, |
| 245 'keyIdentifier': 'Enter' |
| 246 }); |
| 247 assertFalse(event.defaultPrevented); |
| 248 page.pageDiv.dispatchEvent(event); |
| 249 assertTrue(event.defaultPrevented); |
| 250 testDone(); |
| 251 }); |
| 252 |
235 /** | 253 /** |
236 * TestFixture for OptionsPage WebUI testing including tab history. | 254 * TestFixture for OptionsPage WebUI testing including tab history. |
237 * @extends {testing.Test} | 255 * @extends {testing.Test} |
238 * @constructor | 256 * @constructor |
239 */ | 257 */ |
240 function OptionsWebUINavigationTest() {} | 258 function OptionsWebUINavigationTest() {} |
241 | 259 |
242 OptionsWebUINavigationTest.prototype = { | 260 OptionsWebUINavigationTest.prototype = { |
243 __proto__: testing.Test.prototype, | 261 __proto__: testing.Test.prototype, |
244 | 262 |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 var self = this; | 640 var self = this; |
623 self.verifyOpenPages_(['settings', 'content', 'cookies']); | 641 self.verifyOpenPages_(['settings', 'content', 'cookies']); |
624 self.verifyHistory_(['settings', 'languages', 'cookies'], function() { | 642 self.verifyHistory_(['settings', 'languages', 'cookies'], function() { |
625 window.history.back(); | 643 window.history.back(); |
626 waitForPopstate(function() { | 644 waitForPopstate(function() { |
627 self.verifyOpenPages_(['settings', 'languages']); | 645 self.verifyOpenPages_(['settings', 'languages']); |
628 testDone(); | 646 testDone(); |
629 }); | 647 }); |
630 }); | 648 }); |
631 }); | 649 }); |
OLD | NEW |