OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/common/ssl_status_serialization.h" | 10 #include "content/common/ssl_status_serialization.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "net/cert/cert_status_flags.h" | 27 #include "net/cert/cert_status_flags.h" |
28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
29 #include "third_party/WebKit/public/platform/WebData.h" | 29 #include "third_party/WebKit/public/platform/WebData.h" |
30 #include "third_party/WebKit/public/platform/WebHTTPBody.h" | 30 #include "third_party/WebKit/public/platform/WebHTTPBody.h" |
31 #include "third_party/WebKit/public/platform/WebString.h" | 31 #include "third_party/WebKit/public/platform/WebString.h" |
32 #include "third_party/WebKit/public/platform/WebURLError.h" | 32 #include "third_party/WebKit/public/platform/WebURLError.h" |
33 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 33 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
34 #include "third_party/WebKit/public/web/WebDataSource.h" | 34 #include "third_party/WebKit/public/web/WebDataSource.h" |
35 #include "third_party/WebKit/public/web/WebFrame.h" | 35 #include "third_party/WebKit/public/web/WebFrame.h" |
36 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 36 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 37 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
37 #include "third_party/WebKit/public/web/WebView.h" | 38 #include "third_party/WebKit/public/web/WebView.h" |
38 #include "third_party/WebKit/public/web/WebWindowFeatures.h" | 39 #include "third_party/WebKit/public/web/WebWindowFeatures.h" |
39 #include "ui/base/keycodes/keyboard_codes.h" | 40 #include "ui/base/keycodes/keyboard_codes.h" |
40 #include "ui/base/range/range.h" | 41 #include "ui/base/range/range.h" |
41 #include "ui/gfx/codec/jpeg_codec.h" | 42 #include "ui/gfx/codec/jpeg_codec.h" |
42 | 43 |
43 #if defined(OS_LINUX) && !defined(USE_AURA) | 44 #if defined(OS_LINUX) && !defined(USE_AURA) |
44 #include "ui/base/gtk/event_synthesis_gtk.h" | 45 #include "ui/base/gtk/event_synthesis_gtk.h" |
45 #endif | 46 #endif |
46 | 47 |
47 #if defined(USE_AURA) | 48 #if defined(USE_AURA) |
48 #include "ui/base/events/event.h" | 49 #include "ui/base/events/event.h" |
49 #endif | 50 #endif |
50 | 51 |
51 #if defined(USE_AURA) && defined(USE_X11) | 52 #if defined(USE_AURA) && defined(USE_X11) |
52 #include <X11/Xlib.h> | 53 #include <X11/Xlib.h> |
53 #include "ui/base/events/event_constants.h" | 54 #include "ui/base/events/event_constants.h" |
54 #include "ui/base/keycodes/keyboard_code_conversion.h" | 55 #include "ui/base/keycodes/keyboard_code_conversion.h" |
55 #include "ui/base/x/x11_util.h" | 56 #include "ui/base/x/x11_util.h" |
56 #endif | 57 #endif |
57 | 58 |
58 using WebKit::WebFrame; | 59 using WebKit::WebFrame; |
59 using WebKit::WebInputEvent; | 60 using WebKit::WebInputEvent; |
60 using WebKit::WebMouseEvent; | 61 using WebKit::WebMouseEvent; |
| 62 using WebKit::WebRuntimeFeatures; |
61 using WebKit::WebString; | 63 using WebKit::WebString; |
62 using WebKit::WebTextDirection; | 64 using WebKit::WebTextDirection; |
63 using WebKit::WebURLError; | 65 using WebKit::WebURLError; |
64 | 66 |
65 namespace content { | 67 namespace content { |
66 | 68 |
67 namespace { | 69 namespace { |
68 | 70 |
69 #if defined(USE_AURA) && defined(USE_X11) | 71 #if defined(USE_AURA) && defined(USE_X11) |
70 // Converts MockKeyboard::Modifiers to ui::EventFlags. | 72 // Converts MockKeyboard::Modifiers to ui::EventFlags. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 114 |
113 } // namespace | 115 } // namespace |
114 | 116 |
115 class RenderViewImplTest : public RenderViewTest { | 117 class RenderViewImplTest : public RenderViewTest { |
116 public: | 118 public: |
117 RenderViewImplTest() { | 119 RenderViewImplTest() { |
118 // Attach a pseudo keyboard device to this object. | 120 // Attach a pseudo keyboard device to this object. |
119 mock_keyboard_.reset(new MockKeyboard()); | 121 mock_keyboard_.reset(new MockKeyboard()); |
120 } | 122 } |
121 | 123 |
| 124 virtual ~RenderViewImplTest() {} |
| 125 |
| 126 virtual void SetUp() OVERRIDE { |
| 127 RenderViewTest::SetUp(); |
| 128 // This test depends on Blink flag InputModeAttribute, which is enabled |
| 129 // under only test. Content browser test doesn't enable the feature so we |
| 130 // need enable it manually. |
| 131 // TODO(yoichio): Remove this if InputMode feature is enabled by default. |
| 132 WebRuntimeFeatures::enableInputModeAttribute(true); |
| 133 } |
| 134 |
122 RenderViewImpl* view() { | 135 RenderViewImpl* view() { |
123 return static_cast<RenderViewImpl*>(view_); | 136 return static_cast<RenderViewImpl*>(view_); |
124 } | 137 } |
125 | 138 |
126 // Sends IPC messages that emulates a key-press event. | 139 // Sends IPC messages that emulates a key-press event. |
127 int SendKeyEvent(MockKeyboard::Layout layout, | 140 int SendKeyEvent(MockKeyboard::Layout layout, |
128 int key_code, | 141 int key_code, |
129 MockKeyboard::Modifiers modifiers, | 142 MockKeyboard::Modifiers modifiers, |
130 string16* output) { | 143 string16* output) { |
131 #if defined(OS_WIN) | 144 #if defined(OS_WIN) |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 view()->OnNavigate(params_B); | 777 view()->OnNavigate(params_B); |
765 ProcessPendingMessages(); | 778 ProcessPendingMessages(); |
766 | 779 |
767 EXPECT_EQ(2, view()->history_list_length_); | 780 EXPECT_EQ(2, view()->history_list_length_); |
768 EXPECT_EQ(0, view()->history_list_offset_); | 781 EXPECT_EQ(0, view()->history_list_offset_); |
769 EXPECT_EQ(2, view()->history_page_ids_[0]); | 782 EXPECT_EQ(2, view()->history_page_ids_[0]); |
770 } | 783 } |
771 | 784 |
772 // Test that our IME backend sends a notification message when the input focus | 785 // Test that our IME backend sends a notification message when the input focus |
773 // changes. | 786 // changes. |
774 // crbug.com/276821: | 787 TEST_F(RenderViewImplTest, OnImeTypeChanged) { |
775 // Because Blink change cause this test failed, we first disabled this test and | |
776 // fix later. | |
777 TEST_F(RenderViewImplTest, DISABLED_OnImeTypeChanged) { | |
778 // Enable our IME backend code. | 788 // Enable our IME backend code. |
779 view()->OnSetInputMethodActive(true); | 789 view()->OnSetInputMethodActive(true); |
780 | 790 |
781 // Load an HTML page consisting of two input fields. | 791 // Load an HTML page consisting of two input fields. |
782 view()->set_send_content_state_immediately(true); | 792 view()->set_send_content_state_immediately(true); |
783 LoadHTML("<html>" | 793 LoadHTML("<html>" |
784 "<head>" | 794 "<head>" |
785 "</head>" | 795 "</head>" |
786 "<body>" | 796 "<body>" |
787 "<input id=\"test1\" type=\"text\" value=\"some text\"></input>" | 797 "<input id=\"test1\" type=\"text\" value=\"some text\"></input>" |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 EXPECT_FALSE(net::IsCertStatusError(ssl_status.cert_status)); | 1944 EXPECT_FALSE(net::IsCertStatusError(ssl_status.cert_status)); |
1935 | 1945 |
1936 const_cast<WebKit::WebURLResponse&>(frame->dataSource()->response()). | 1946 const_cast<WebKit::WebURLResponse&>(frame->dataSource()->response()). |
1937 setSecurityInfo( | 1947 setSecurityInfo( |
1938 SerializeSecurityInfo(0, net::CERT_STATUS_ALL_ERRORS, 0, 0)); | 1948 SerializeSecurityInfo(0, net::CERT_STATUS_ALL_ERRORS, 0, 0)); |
1939 ssl_status = view()->GetSSLStatusOfFrame(frame); | 1949 ssl_status = view()->GetSSLStatusOfFrame(frame); |
1940 EXPECT_TRUE(net::IsCertStatusError(ssl_status.cert_status)); | 1950 EXPECT_TRUE(net::IsCertStatusError(ssl_status.cert_status)); |
1941 } | 1951 } |
1942 | 1952 |
1943 } // namespace content | 1953 } // namespace content |
OLD | NEW |