| 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
| 24 #include "content/public/browser/render_widget_host_view.h" | 24 #include "content/public/browser/render_widget_host_view.h" |
| 25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 26 #include "content/public/browser/web_contents_view.h" | 26 #include "content/public/browser/web_contents_view.h" |
| 27 #include "content/public/test/browser_test_utils.h" | 27 #include "content/public/test/browser_test_utils.h" |
| 28 #include "net/test/test_server.h" | 28 #include "net/test/test_server.h" |
| 29 #include "ui/base/keycodes/keyboard_codes.h" | 29 #include "ui/base/keycodes/keyboard_codes.h" |
| 30 #include "ui/views/controls/textfield/textfield.h" | 30 #include "ui/views/controls/textfield/textfield.h" |
| 31 | 31 |
| 32 // TODO(kbr): remove: http://crbug.com/222296 |
| 33 #if defined(OS_MACOSX) |
| 34 #import "base/mac/mac_util.h" |
| 35 #endif |
| 36 |
| 32 using content::DomOperationNotificationDetails; | 37 using content::DomOperationNotificationDetails; |
| 33 using content::NavigationController; | 38 using content::NavigationController; |
| 34 using content::RenderViewHost; | 39 using content::RenderViewHost; |
| 35 | 40 |
| 36 namespace { | 41 namespace { |
| 37 | 42 |
| 38 const char kTestingPage[] = "files/keyevents_test.html"; | 43 const char kTestingPage[] = "files/keyevents_test.html"; |
| 39 const char kSuppressEventJS[] = | 44 const char kSuppressEventJS[] = |
| 40 "window.domAutomationController.send(setDefaultAction('%ls', %ls));"; | 45 "window.domAutomationController.send(setDefaultAction('%ls', %ls));"; |
| 41 const char kGetResultJS[] = | 46 const char kGetResultJS[] = |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 browser(), ui::VKEY_W, true, false, false, false)); | 753 browser(), ui::VKEY_W, true, false, false, false)); |
| 749 #endif | 754 #endif |
| 750 | 755 |
| 751 ASSERT_NO_FATAL_FAILURE(wait_for_tab_closed.Wait()); | 756 ASSERT_NO_FATAL_FAILURE(wait_for_tab_closed.Wait()); |
| 752 | 757 |
| 753 EXPECT_EQ(1, browser()->tab_strip_model()->count()); | 758 EXPECT_EQ(1, browser()->tab_strip_model()->count()); |
| 754 } | 759 } |
| 755 | 760 |
| 756 #if defined(OS_MACOSX) | 761 #if defined(OS_MACOSX) |
| 757 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, EditorKeyBindings) { | 762 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, EditorKeyBindings) { |
| 763 // TODO(kbr): re-enable: http://crbug.com/222296 |
| 764 if (base::mac::IsOSMountainLionOrLater()) |
| 765 return; |
| 766 |
| 758 static const KeyEventTestData kTestCtrlA = { | 767 static const KeyEventTestData kTestCtrlA = { |
| 759 ui::VKEY_A, true, false, false, false, | 768 ui::VKEY_A, true, false, false, false, |
| 760 false, false, false, false, 4, | 769 false, false, false, false, 4, |
| 761 { "D 17 0 true false false false", | 770 { "D 17 0 true false false false", |
| 762 "D 65 0 true false false false", | 771 "D 65 0 true false false false", |
| 763 "U 65 0 true false false false", | 772 "U 65 0 true false false false", |
| 764 "U 17 0 true false false false" } | 773 "U 17 0 true false false false" } |
| 765 }; | 774 }; |
| 766 | 775 |
| 767 static const KeyEventTestData kTestCtrlF = { | 776 static const KeyEventTestData kTestCtrlF = { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); | 892 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); |
| 884 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 893 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
| 885 | 894 |
| 886 // Ctrl+Alt should have no effect. | 895 // Ctrl+Alt should have no effect. |
| 887 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); | 896 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); |
| 888 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 897 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
| 889 } | 898 } |
| 890 #endif | 899 #endif |
| 891 | 900 |
| 892 } // namespace | 901 } // namespace |
| OLD | NEW |