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 "app/keyboard_codes.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/shared_memory.h" | 9 #include "base/shared_memory.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 int key_code = kKeyCodes[k]; | 669 int key_code = kKeyCodes[k]; |
670 std::wstring char_code; | 670 std::wstring char_code; |
671 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) | 671 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) |
672 continue; | 672 continue; |
673 | 673 |
674 // Create an expected result from the virtual-key code, the character | 674 // Create an expected result from the virtual-key code, the character |
675 // code, and the modifier-key status. | 675 // code, and the modifier-key status. |
676 // We format a string that emulates a DOM-event string produced hy | 676 // We format a string that emulates a DOM-event string produced hy |
677 // our JavaScript function. (See the above comment for the format.) | 677 // our JavaScript function. (See the above comment for the format.) |
678 static char expected_result[1024]; | 678 static char expected_result[1024]; |
679 expected_result[0] = NULL; | 679 expected_result[0] = 0; |
680 base::snprintf(&expected_result[0], | 680 base::snprintf(&expected_result[0], |
681 sizeof(expected_result), | 681 sizeof(expected_result), |
682 "\n" // texts in the <input> element | 682 "\n" // texts in the <input> element |
683 "%d,%s\n" // texts in the first <div> element | 683 "%d,%s\n" // texts in the first <div> element |
684 "%d,%s\n" // texts in the second <div> element | 684 "%d,%s\n" // texts in the second <div> element |
685 "%d,%s", // texts in the third <div> element | 685 "%d,%s", // texts in the third <div> element |
686 key_code, kModifierData[j].expected_result, | 686 key_code, kModifierData[j].expected_result, |
687 static_cast<int>(char_code[0]), | 687 static_cast<int>(char_code[0]), |
688 kModifierData[j].expected_result, | 688 kModifierData[j].expected_result, |
689 key_code, kModifierData[j].expected_result); | 689 key_code, kModifierData[j].expected_result); |
(...skipping 536 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 |