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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 571 |
572 MockKeyboard::Layout layout = kLayouts[i]; | 572 MockKeyboard::Layout layout = kLayouts[i]; |
573 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifierData); ++j) { | 573 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifierData); ++j) { |
574 // Virtual key codes used for this test. | 574 // Virtual key codes used for this test. |
575 static const int kKeyCodes[] = { | 575 static const int kKeyCodes[] = { |
576 '0', '1', '2', '3', '4', '5', '6', '7', | 576 '0', '1', '2', '3', '4', '5', '6', '7', |
577 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', | 577 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', |
578 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', | 578 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', |
579 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', | 579 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', |
580 'W', 'X', 'Y', 'Z', | 580 'W', 'X', 'Y', 'Z', |
581 base::VKEY_OEM_1, | 581 app::VKEY_OEM_1, |
582 base::VKEY_OEM_PLUS, | 582 app::VKEY_OEM_PLUS, |
583 base::VKEY_OEM_COMMA, | 583 app::VKEY_OEM_COMMA, |
584 base::VKEY_OEM_MINUS, | 584 app::VKEY_OEM_MINUS, |
585 base::VKEY_OEM_PERIOD, | 585 app::VKEY_OEM_PERIOD, |
586 base::VKEY_OEM_2, | 586 app::VKEY_OEM_2, |
587 base::VKEY_OEM_3, | 587 app::VKEY_OEM_3, |
588 base::VKEY_OEM_4, | 588 app::VKEY_OEM_4, |
589 base::VKEY_OEM_5, | 589 app::VKEY_OEM_5, |
590 base::VKEY_OEM_6, | 590 app::VKEY_OEM_6, |
591 base::VKEY_OEM_7, | 591 app::VKEY_OEM_7, |
592 #if defined(OS_WIN) | 592 #if defined(OS_WIN) |
593 // Not sure how to handle this key on Linux. | 593 // Not sure how to handle this key on Linux. |
594 base::VKEY_OEM_8, | 594 app::VKEY_OEM_8, |
595 #endif | 595 #endif |
596 }; | 596 }; |
597 | 597 |
598 MockKeyboard::Modifiers modifiers = kModifierData[j].modifiers; | 598 MockKeyboard::Modifiers modifiers = kModifierData[j].modifiers; |
599 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { | 599 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { |
600 // Send a keyboard event to the RenderView object. | 600 // Send a keyboard event to the RenderView object. |
601 // We should test a keyboard event only when the given keyboard-layout | 601 // We should test a keyboard event only when the given keyboard-layout |
602 // driver is installed in a PC and the driver can assign a Unicode | 602 // driver is installed in a PC and the driver can assign a Unicode |
603 // charcter for the given tuple (key-code and modifiers). | 603 // charcter for the given tuple (key-code and modifiers). |
604 int key_code = kKeyCodes[k]; | 604 int key_code = kKeyCodes[k]; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 | 810 |
811 MockKeyboard::Layout layout = kLayouts[i].layout; | 811 MockKeyboard::Layout layout = kLayouts[i].layout; |
812 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifiers); ++j) { | 812 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifiers); ++j) { |
813 // Virtual key codes used for this test. | 813 // Virtual key codes used for this test. |
814 static const int kKeyCodes[] = { | 814 static const int kKeyCodes[] = { |
815 '0', '1', '2', '3', '4', '5', '6', '7', | 815 '0', '1', '2', '3', '4', '5', '6', '7', |
816 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', | 816 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', |
817 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', | 817 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', |
818 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', | 818 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', |
819 'W', 'X', 'Y', 'Z', | 819 'W', 'X', 'Y', 'Z', |
820 base::VKEY_OEM_1, | 820 app::VKEY_OEM_1, |
821 base::VKEY_OEM_PLUS, | 821 app::VKEY_OEM_PLUS, |
822 base::VKEY_OEM_COMMA, | 822 app::VKEY_OEM_COMMA, |
823 base::VKEY_OEM_MINUS, | 823 app::VKEY_OEM_MINUS, |
824 base::VKEY_OEM_PERIOD, | 824 app::VKEY_OEM_PERIOD, |
825 base::VKEY_OEM_2, | 825 app::VKEY_OEM_2, |
826 base::VKEY_OEM_3, | 826 app::VKEY_OEM_3, |
827 base::VKEY_OEM_4, | 827 app::VKEY_OEM_4, |
828 base::VKEY_OEM_5, | 828 app::VKEY_OEM_5, |
829 base::VKEY_OEM_6, | 829 app::VKEY_OEM_6, |
830 base::VKEY_OEM_7, | 830 app::VKEY_OEM_7, |
831 #if defined(OS_WIN) | 831 #if defined(OS_WIN) |
832 // Unclear how to handle this on Linux. | 832 // Unclear how to handle this on Linux. |
833 base::VKEY_OEM_8, | 833 app::VKEY_OEM_8, |
834 #endif | 834 #endif |
835 }; | 835 }; |
836 | 836 |
837 MockKeyboard::Modifiers modifiers = kModifiers[j]; | 837 MockKeyboard::Modifiers modifiers = kModifiers[j]; |
838 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { | 838 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { |
839 // Send a keyboard event to the RenderView object. | 839 // Send a keyboard event to the RenderView object. |
840 // We should test a keyboard event only when the given keyboard-layout | 840 // We should test a keyboard event only when the given keyboard-layout |
841 // driver is installed in a PC and the driver can assign a Unicode | 841 // driver is installed in a PC and the driver can assign a Unicode |
842 // charcter for the given tuple (layout, key-code, and modifiers). | 842 // charcter for the given tuple (layout, key-code, and modifiers). |
843 int key_code = kKeyCodes[k]; | 843 int key_code = kKeyCodes[k]; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 LoadHTML("<html><head><meta http-equiv=\"content-language\" " | 1151 LoadHTML("<html><head><meta http-equiv=\"content-language\" " |
1152 "content=\" fr , es,en \">" | 1152 "content=\" fr , es,en \">" |
1153 "</head><body>A random page with random content.</body></html>"); | 1153 "</head><body>A random page with random content.</body></html>"); |
1154 ProcessPendingMessages(); | 1154 ProcessPendingMessages(); |
1155 message = render_thread_.sink().GetUniqueMessageMatching( | 1155 message = render_thread_.sink().GetUniqueMessageMatching( |
1156 ViewHostMsg_PageContents::ID); | 1156 ViewHostMsg_PageContents::ID); |
1157 ASSERT_NE(static_cast<IPC::Message*>(NULL), message); | 1157 ASSERT_NE(static_cast<IPC::Message*>(NULL), message); |
1158 ViewHostMsg_PageContents::Read(message, ¶ms); | 1158 ViewHostMsg_PageContents::Read(message, ¶ms); |
1159 EXPECT_EQ("fr", params.d); | 1159 EXPECT_EQ("fr", params.d); |
1160 } | 1160 } |
OLD | NEW |