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" | |
8 #include "base/file_util.h" | 7 #include "base/file_util.h" |
9 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
10 #include "base/string_util.h" | 9 #include "base/string_util.h" |
11 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
12 #include "chrome/common/content_settings.h" | 11 #include "chrome/common/content_settings.h" |
13 #include "chrome/common/native_web_keyboard_event.h" | 12 #include "chrome/common/native_web_keyboard_event.h" |
14 #include "chrome/common/render_messages.h" | 13 #include "chrome/common/render_messages.h" |
15 #include "chrome/common/render_messages_params.h" | 14 #include "chrome/common/render_messages_params.h" |
16 #include "chrome/renderer/print_web_view_helper.h" | 15 #include "chrome/renderer/print_web_view_helper.h" |
17 #include "chrome/test/render_view_test.h" | 16 #include "chrome/test/render_view_test.h" |
18 #include "gfx/codec/jpeg_codec.h" | 17 #include "gfx/codec/jpeg_codec.h" |
19 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
20 #include "printing/image.h" | 19 #include "printing/image.h" |
21 #include "printing/native_metafile.h" | 20 #include "printing/native_metafile.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebDocument.h" |
24 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" | 23 #include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" |
25 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 24 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
26 #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" | 25 #include "third_party/WebKit/WebKit/chromium/public/WebURLError.h" |
27 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 26 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 27 #include "ui/base/keycodes/keyboard_codes.h" |
28 #include "webkit/glue/form_data.h" | 28 #include "webkit/glue/form_data.h" |
29 #include "webkit/glue/form_field.h" | 29 #include "webkit/glue/form_field.h" |
30 #include "webkit/glue/web_io_operators.h" | 30 #include "webkit/glue/web_io_operators.h" |
31 | 31 |
32 using WebKit::WebDocument; | 32 using WebKit::WebDocument; |
33 using WebKit::WebFrame; | 33 using WebKit::WebFrame; |
34 using WebKit::WebInputElement; | 34 using WebKit::WebInputElement; |
35 using WebKit::WebString; | 35 using WebKit::WebString; |
36 using WebKit::WebTextDirection; | 36 using WebKit::WebTextDirection; |
37 using WebKit::WebURLError; | 37 using WebKit::WebURLError; |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 | 636 |
637 MockKeyboard::Layout layout = kLayouts[i]; | 637 MockKeyboard::Layout layout = kLayouts[i]; |
638 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifierData); ++j) { | 638 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifierData); ++j) { |
639 // Virtual key codes used for this test. | 639 // Virtual key codes used for this test. |
640 static const int kKeyCodes[] = { | 640 static const int kKeyCodes[] = { |
641 '0', '1', '2', '3', '4', '5', '6', '7', | 641 '0', '1', '2', '3', '4', '5', '6', '7', |
642 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', | 642 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', |
643 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', | 643 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', |
644 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', | 644 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', |
645 'W', 'X', 'Y', 'Z', | 645 'W', 'X', 'Y', 'Z', |
646 app::VKEY_OEM_1, | 646 ui::VKEY_OEM_1, |
647 app::VKEY_OEM_PLUS, | 647 ui::VKEY_OEM_PLUS, |
648 app::VKEY_OEM_COMMA, | 648 ui::VKEY_OEM_COMMA, |
649 app::VKEY_OEM_MINUS, | 649 ui::VKEY_OEM_MINUS, |
650 app::VKEY_OEM_PERIOD, | 650 ui::VKEY_OEM_PERIOD, |
651 app::VKEY_OEM_2, | 651 ui::VKEY_OEM_2, |
652 app::VKEY_OEM_3, | 652 ui::VKEY_OEM_3, |
653 app::VKEY_OEM_4, | 653 ui::VKEY_OEM_4, |
654 app::VKEY_OEM_5, | 654 ui::VKEY_OEM_5, |
655 app::VKEY_OEM_6, | 655 ui::VKEY_OEM_6, |
656 app::VKEY_OEM_7, | 656 ui::VKEY_OEM_7, |
657 #if defined(OS_WIN) | 657 #if defined(OS_WIN) |
658 // Not sure how to handle this key on Linux. | 658 // Not sure how to handle this key on Linux. |
659 app::VKEY_OEM_8, | 659 ui::VKEY_OEM_8, |
660 #endif | 660 #endif |
661 }; | 661 }; |
662 | 662 |
663 MockKeyboard::Modifiers modifiers = kModifierData[j].modifiers; | 663 MockKeyboard::Modifiers modifiers = kModifierData[j].modifiers; |
664 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { | 664 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { |
665 // Send a keyboard event to the RenderView object. | 665 // Send a keyboard event to the RenderView object. |
666 // We should test a keyboard event only when the given keyboard-layout | 666 // We should test a keyboard event only when the given keyboard-layout |
667 // driver is installed in a PC and the driver can assign a Unicode | 667 // driver is installed in a PC and the driver can assign a Unicode |
668 // charcter for the given tuple (key-code and modifiers). | 668 // charcter for the given tuple (key-code and modifiers). |
669 int key_code = kKeyCodes[k]; | 669 int key_code = kKeyCodes[k]; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 | 877 |
878 MockKeyboard::Layout layout = kLayouts[i].layout; | 878 MockKeyboard::Layout layout = kLayouts[i].layout; |
879 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifiers); ++j) { | 879 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifiers); ++j) { |
880 // Virtual key codes used for this test. | 880 // Virtual key codes used for this test. |
881 static const int kKeyCodes[] = { | 881 static const int kKeyCodes[] = { |
882 '0', '1', '2', '3', '4', '5', '6', '7', | 882 '0', '1', '2', '3', '4', '5', '6', '7', |
883 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', | 883 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', |
884 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', | 884 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', |
885 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', | 885 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', |
886 'W', 'X', 'Y', 'Z', | 886 'W', 'X', 'Y', 'Z', |
887 app::VKEY_OEM_1, | 887 ui::VKEY_OEM_1, |
888 app::VKEY_OEM_PLUS, | 888 ui::VKEY_OEM_PLUS, |
889 app::VKEY_OEM_COMMA, | 889 ui::VKEY_OEM_COMMA, |
890 app::VKEY_OEM_MINUS, | 890 ui::VKEY_OEM_MINUS, |
891 app::VKEY_OEM_PERIOD, | 891 ui::VKEY_OEM_PERIOD, |
892 app::VKEY_OEM_2, | 892 ui::VKEY_OEM_2, |
893 app::VKEY_OEM_3, | 893 ui::VKEY_OEM_3, |
894 app::VKEY_OEM_4, | 894 ui::VKEY_OEM_4, |
895 app::VKEY_OEM_5, | 895 ui::VKEY_OEM_5, |
896 app::VKEY_OEM_6, | 896 ui::VKEY_OEM_6, |
897 app::VKEY_OEM_7, | 897 ui::VKEY_OEM_7, |
898 #if defined(OS_WIN) | 898 #if defined(OS_WIN) |
899 // Unclear how to handle this on Linux. | 899 // Unclear how to handle this on Linux. |
900 app::VKEY_OEM_8, | 900 ui::VKEY_OEM_8, |
901 #endif | 901 #endif |
902 }; | 902 }; |
903 | 903 |
904 MockKeyboard::Modifiers modifiers = kModifiers[j]; | 904 MockKeyboard::Modifiers modifiers = kModifiers[j]; |
905 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { | 905 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { |
906 // Send a keyboard event to the RenderView object. | 906 // Send a keyboard event to the RenderView object. |
907 // We should test a keyboard event only when the given keyboard-layout | 907 // We should test a keyboard event only when the given keyboard-layout |
908 // driver is installed in a PC and the driver can assign a Unicode | 908 // driver is installed in a PC and the driver can assign a Unicode |
909 // charcter for the given tuple (layout, key-code, and modifiers). | 909 // charcter for the given tuple (layout, key-code, and modifiers). |
910 int key_code = kKeyCodes[k]; | 910 int key_code = kKeyCodes[k]; |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 LoadHTML("<html><head><meta http-equiv=\"content-language\" " | 1226 LoadHTML("<html><head><meta http-equiv=\"content-language\" " |
1227 "content=\" fr , es,en \">" | 1227 "content=\" fr , es,en \">" |
1228 "</head><body>A random page with random content.</body></html>"); | 1228 "</head><body>A random page with random content.</body></html>"); |
1229 ProcessPendingMessages(); | 1229 ProcessPendingMessages(); |
1230 message = render_thread_.sink().GetUniqueMessageMatching( | 1230 message = render_thread_.sink().GetUniqueMessageMatching( |
1231 ViewHostMsg_PageContents::ID); | 1231 ViewHostMsg_PageContents::ID); |
1232 ASSERT_NE(static_cast<IPC::Message*>(NULL), message); | 1232 ASSERT_NE(static_cast<IPC::Message*>(NULL), message); |
1233 ViewHostMsg_PageContents::Read(message, ¶ms); | 1233 ViewHostMsg_PageContents::Read(message, ¶ms); |
1234 EXPECT_EQ("fr", params.d); | 1234 EXPECT_EQ("fr", params.d); |
1235 } | 1235 } |
OLD | NEW |