| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "chrome/common/native_web_keyboard_event.h" | 6 #include "chrome/common/native_web_keyboard_event.h" |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "chrome/test/render_view_test.h" | 8 #include "chrome/test/render_view_test.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 VK_OEM_2, | 527 VK_OEM_2, |
| 528 VK_OEM_3, | 528 VK_OEM_3, |
| 529 VK_OEM_4, | 529 VK_OEM_4, |
| 530 VK_OEM_5, | 530 VK_OEM_5, |
| 531 VK_OEM_6, | 531 VK_OEM_6, |
| 532 VK_OEM_7, | 532 VK_OEM_7, |
| 533 VK_OEM_8, | 533 VK_OEM_8, |
| 534 }; | 534 }; |
| 535 | 535 |
| 536 MockKeyboard::Modifiers modifiers = kModifierData[j].modifiers; | 536 MockKeyboard::Modifiers modifiers = kModifierData[j].modifiers; |
| 537 for (size_t k = 0; k <= ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { | 537 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { |
| 538 // Send a keyboard event to the RenderView object. | 538 // Send a keyboard event to the RenderView object. |
| 539 // We should test a keyboard event only when the given keyboard-layout | 539 // We should test a keyboard event only when the given keyboard-layout |
| 540 // driver is installed in a PC and the driver can assign a Unicode | 540 // driver is installed in a PC and the driver can assign a Unicode |
| 541 // charcter for the given tuple (key-code and modifiers). | 541 // charcter for the given tuple (key-code and modifiers). |
| 542 int key_code = kKeyCodes[k]; | 542 int key_code = kKeyCodes[k]; |
| 543 std::wstring char_code; | 543 std::wstring char_code; |
| 544 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) | 544 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) |
| 545 continue; | 545 continue; |
| 546 | 546 |
| 547 // Create an expected result from the virtual-key code, the character | 547 // Create an expected result from the virtual-key code, the character |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 VK_OEM_2, | 752 VK_OEM_2, |
| 753 VK_OEM_3, | 753 VK_OEM_3, |
| 754 VK_OEM_4, | 754 VK_OEM_4, |
| 755 VK_OEM_5, | 755 VK_OEM_5, |
| 756 VK_OEM_6, | 756 VK_OEM_6, |
| 757 VK_OEM_7, | 757 VK_OEM_7, |
| 758 VK_OEM_8, | 758 VK_OEM_8, |
| 759 }; | 759 }; |
| 760 | 760 |
| 761 MockKeyboard::Modifiers modifiers = kModifiers[j]; | 761 MockKeyboard::Modifiers modifiers = kModifiers[j]; |
| 762 for (size_t k = 0; k <= ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { | 762 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { |
| 763 // Send a keyboard event to the RenderView object. | 763 // Send a keyboard event to the RenderView object. |
| 764 // We should test a keyboard event only when the given keyboard-layout | 764 // We should test a keyboard event only when the given keyboard-layout |
| 765 // driver is installed in a PC and the driver can assign a Unicode | 765 // driver is installed in a PC and the driver can assign a Unicode |
| 766 // charcter for the given tuple (layout, key-code, and modifiers). | 766 // charcter for the given tuple (layout, key-code, and modifiers). |
| 767 int key_code = kKeyCodes[k]; | 767 int key_code = kKeyCodes[k]; |
| 768 std::wstring char_code; | 768 std::wstring char_code; |
| 769 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) | 769 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) |
| 770 continue; | 770 continue; |
| 771 } | 771 } |
| 772 } | 772 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 error.domain.fromUTF8("test_domain"); | 807 error.domain.fromUTF8("test_domain"); |
| 808 error.reason = net::ERR_ABORTED; | 808 error.reason = net::ERR_ABORTED; |
| 809 error.unreachableURL = GURL("http://foo"); | 809 error.unreachableURL = GURL("http://foo"); |
| 810 WebFrame* web_frame = GetMainFrame(); | 810 WebFrame* web_frame = GetMainFrame(); |
| 811 WebView* web_view = web_frame->GetView(); | 811 WebView* web_view = web_frame->GetView(); |
| 812 // A cancellation occurred. | 812 // A cancellation occurred. |
| 813 view_->DidFailProvisionalLoadWithError(web_view, error, web_frame); | 813 view_->DidFailProvisionalLoadWithError(web_view, error, web_frame); |
| 814 // Frame should stay in view-source mode. | 814 // Frame should stay in view-source mode. |
| 815 EXPECT_TRUE(web_frame->GetInViewSourceMode()); | 815 EXPECT_TRUE(web_frame->GetInViewSourceMode()); |
| 816 } | 816 } |
| OLD | NEW |