OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 | 6 |
| 7 #include "app/keyboard_codes.h" |
7 #include "base/file_util.h" | 8 #include "base/file_util.h" |
8 #include "base/keyboard_codes.h" | |
9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/common/content_settings.h" | 11 #include "chrome/common/content_settings.h" |
12 #include "chrome/common/native_web_keyboard_event.h" | 12 #include "chrome/common/native_web_keyboard_event.h" |
13 #include "chrome/common/render_messages.h" | 13 #include "chrome/common/render_messages.h" |
14 #include "chrome/common/render_messages_params.h" | 14 #include "chrome/common/render_messages_params.h" |
15 #include "chrome/renderer/print_web_view_helper.h" | 15 #include "chrome/renderer/print_web_view_helper.h" |
16 #include "chrome/test/render_view_test.h" | 16 #include "chrome/test/render_view_test.h" |
17 #include "gfx/codec/jpeg_codec.h" | 17 #include "gfx/codec/jpeg_codec.h" |
18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 572 |
573 MockKeyboard::Layout layout = kLayouts[i]; | 573 MockKeyboard::Layout layout = kLayouts[i]; |
574 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifierData); ++j) { | 574 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifierData); ++j) { |
575 // Virtual key codes used for this test. | 575 // Virtual key codes used for this test. |
576 static const int kKeyCodes[] = { | 576 static const int kKeyCodes[] = { |
577 '0', '1', '2', '3', '4', '5', '6', '7', | 577 '0', '1', '2', '3', '4', '5', '6', '7', |
578 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', | 578 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', |
579 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', | 579 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', |
580 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', | 580 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', |
581 'W', 'X', 'Y', 'Z', | 581 'W', 'X', 'Y', 'Z', |
582 base::VKEY_OEM_1, | 582 app::VKEY_OEM_1, |
583 base::VKEY_OEM_PLUS, | 583 app::VKEY_OEM_PLUS, |
584 base::VKEY_OEM_COMMA, | 584 app::VKEY_OEM_COMMA, |
585 base::VKEY_OEM_MINUS, | 585 app::VKEY_OEM_MINUS, |
586 base::VKEY_OEM_PERIOD, | 586 app::VKEY_OEM_PERIOD, |
587 base::VKEY_OEM_2, | 587 app::VKEY_OEM_2, |
588 base::VKEY_OEM_3, | 588 app::VKEY_OEM_3, |
589 base::VKEY_OEM_4, | 589 app::VKEY_OEM_4, |
590 base::VKEY_OEM_5, | 590 app::VKEY_OEM_5, |
591 base::VKEY_OEM_6, | 591 app::VKEY_OEM_6, |
592 base::VKEY_OEM_7, | 592 app::VKEY_OEM_7, |
593 #if defined(OS_WIN) | 593 #if defined(OS_WIN) |
594 // Not sure how to handle this key on Linux. | 594 // Not sure how to handle this key on Linux. |
595 base::VKEY_OEM_8, | 595 app::VKEY_OEM_8, |
596 #endif | 596 #endif |
597 }; | 597 }; |
598 | 598 |
599 MockKeyboard::Modifiers modifiers = kModifierData[j].modifiers; | 599 MockKeyboard::Modifiers modifiers = kModifierData[j].modifiers; |
600 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { | 600 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { |
601 // Send a keyboard event to the RenderView object. | 601 // Send a keyboard event to the RenderView object. |
602 // We should test a keyboard event only when the given keyboard-layout | 602 // We should test a keyboard event only when the given keyboard-layout |
603 // driver is installed in a PC and the driver can assign a Unicode | 603 // driver is installed in a PC and the driver can assign a Unicode |
604 // charcter for the given tuple (key-code and modifiers). | 604 // charcter for the given tuple (key-code and modifiers). |
605 int key_code = kKeyCodes[k]; | 605 int key_code = kKeyCodes[k]; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 | 811 |
812 MockKeyboard::Layout layout = kLayouts[i].layout; | 812 MockKeyboard::Layout layout = kLayouts[i].layout; |
813 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifiers); ++j) { | 813 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifiers); ++j) { |
814 // Virtual key codes used for this test. | 814 // Virtual key codes used for this test. |
815 static const int kKeyCodes[] = { | 815 static const int kKeyCodes[] = { |
816 '0', '1', '2', '3', '4', '5', '6', '7', | 816 '0', '1', '2', '3', '4', '5', '6', '7', |
817 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', | 817 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', |
818 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', | 818 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', |
819 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', | 819 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', |
820 'W', 'X', 'Y', 'Z', | 820 'W', 'X', 'Y', 'Z', |
821 base::VKEY_OEM_1, | 821 app::VKEY_OEM_1, |
822 base::VKEY_OEM_PLUS, | 822 app::VKEY_OEM_PLUS, |
823 base::VKEY_OEM_COMMA, | 823 app::VKEY_OEM_COMMA, |
824 base::VKEY_OEM_MINUS, | 824 app::VKEY_OEM_MINUS, |
825 base::VKEY_OEM_PERIOD, | 825 app::VKEY_OEM_PERIOD, |
826 base::VKEY_OEM_2, | 826 app::VKEY_OEM_2, |
827 base::VKEY_OEM_3, | 827 app::VKEY_OEM_3, |
828 base::VKEY_OEM_4, | 828 app::VKEY_OEM_4, |
829 base::VKEY_OEM_5, | 829 app::VKEY_OEM_5, |
830 base::VKEY_OEM_6, | 830 app::VKEY_OEM_6, |
831 base::VKEY_OEM_7, | 831 app::VKEY_OEM_7, |
832 #if defined(OS_WIN) | 832 #if defined(OS_WIN) |
833 // Unclear how to handle this on Linux. | 833 // Unclear how to handle this on Linux. |
834 base::VKEY_OEM_8, | 834 app::VKEY_OEM_8, |
835 #endif | 835 #endif |
836 }; | 836 }; |
837 | 837 |
838 MockKeyboard::Modifiers modifiers = kModifiers[j]; | 838 MockKeyboard::Modifiers modifiers = kModifiers[j]; |
839 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { | 839 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { |
840 // Send a keyboard event to the RenderView object. | 840 // Send a keyboard event to the RenderView object. |
841 // We should test a keyboard event only when the given keyboard-layout | 841 // We should test a keyboard event only when the given keyboard-layout |
842 // driver is installed in a PC and the driver can assign a Unicode | 842 // driver is installed in a PC and the driver can assign a Unicode |
843 // charcter for the given tuple (layout, key-code, and modifiers). | 843 // charcter for the given tuple (layout, key-code, and modifiers). |
844 int key_code = kKeyCodes[k]; | 844 int key_code = kKeyCodes[k]; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 0); | 1083 0); |
1084 | 1084 |
1085 ProcessPendingMessages(); | 1085 ProcessPendingMessages(); |
1086 const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching( | 1086 const IPC::Message* message2 = render_thread_.sink().GetUniqueMessageMatching( |
1087 ViewHostMsg_FillAutoFillFormData::ID); | 1087 ViewHostMsg_FillAutoFillFormData::ID); |
1088 | 1088 |
1089 // No message should be sent in this case. |firstname| is filled directly. | 1089 // No message should be sent in this case. |firstname| is filled directly. |
1090 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2); | 1090 ASSERT_EQ(static_cast<IPC::Message*>(NULL), message2); |
1091 EXPECT_EQ(firstname.value(), WebKit::WebString::fromUTF8("David")); | 1091 EXPECT_EQ(firstname.value(), WebKit::WebString::fromUTF8("David")); |
1092 } | 1092 } |
OLD | NEW |