| Index: chrome/browser/ui/webui/options/options_browsertest.js
|
| diff --git a/chrome/browser/ui/webui/options/options_browsertest.js b/chrome/browser/ui/webui/options/options_browsertest.js
|
| index 5fa7932896feaad293cc1ad9c7a8d3008bfd6770..fe18bb304b41ba7ce734f0e231f2ecbbc317c000 100644
|
| --- a/chrome/browser/ui/webui/options/options_browsertest.js
|
| +++ b/chrome/browser/ui/webui/options/options_browsertest.js
|
| @@ -232,6 +232,24 @@ TEST_F('OptionsWebUITest', 'EnableAndDisableDoNotTrack', function() {
|
| dntCheckbox.click();
|
| });
|
|
|
| +// Verify that preventDefault() is called on 'Enter' keydown events that trigger
|
| +// the default button. If this doesn't happen, other elements that may get
|
| +// focus (by the overlay closing for instance), will execute in addition to the
|
| +// default button. See crbug.com/268336.
|
| +TEST_F('OptionsWebUITest', 'EnterPreventsDefault', function() {
|
| + var page = HomePageOverlay.getInstance();
|
| + OptionsPage.showPageByName(page.name);
|
| + var event = new KeyboardEvent('keydown', {
|
| + 'bubbles': true,
|
| + 'cancelable': true,
|
| + 'keyIdentifier': 'Enter'
|
| + });
|
| + assertFalse(event.defaultPrevented);
|
| + page.pageDiv.dispatchEvent(event);
|
| + assertTrue(event.defaultPrevented);
|
| + testDone();
|
| +});
|
| +
|
| /**
|
| * TestFixture for OptionsPage WebUI testing including tab history.
|
| * @extends {testing.Test}
|
|
|