Chromium Code Reviews| 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 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 | 113 |
| 113 } // namespace | 114 } // namespace |
| 114 | 115 |
| 115 class RenderViewImplTest : public RenderViewTest { | 116 class RenderViewImplTest : public RenderViewTest { |
| 116 public: | 117 public: |
| 117 RenderViewImplTest() { | 118 RenderViewImplTest() { |
| 118 // Attach a pseudo keyboard device to this object. | 119 // Attach a pseudo keyboard device to this object. |
| 119 mock_keyboard_.reset(new MockKeyboard()); | 120 mock_keyboard_.reset(new MockKeyboard()); |
| 120 } | 121 } |
| 121 | 122 |
| 123 virtual ~RenderViewImplTest() {} | |
| 124 | |
| 125 virtual void SetUp() OVERRIDE { | |
| 126 RenderViewTest::SetUp(); | |
| 127 // This test depends on Blink flag InputModeAttribute, which is enabled | |
| 128 // under only test. Content browser test doesn't enable the feature so we | |
| 129 // need enable it manually. | |
| 130 // TODO(yoichio): Remove this if InputMode feature is enabled by default. | |
| 131 WebKit::WebRuntimeFeatures::enableInputModeAttribute(true); | |
|
jochen (gone - plz use gerrit)
2013/08/22 06:28:45
nit. add using WebKit::WebRuntimeFeatures to the l
yoichio
2013/08/22 06:48:37
Done.
| |
| 132 } | |
| 133 | |
| 122 RenderViewImpl* view() { | 134 RenderViewImpl* view() { |
| 123 return static_cast<RenderViewImpl*>(view_); | 135 return static_cast<RenderViewImpl*>(view_); |
| 124 } | 136 } |
| 125 | 137 |
| 126 // Sends IPC messages that emulates a key-press event. | 138 // Sends IPC messages that emulates a key-press event. |
| 127 int SendKeyEvent(MockKeyboard::Layout layout, | 139 int SendKeyEvent(MockKeyboard::Layout layout, |
| 128 int key_code, | 140 int key_code, |
| 129 MockKeyboard::Modifiers modifiers, | 141 MockKeyboard::Modifiers modifiers, |
| 130 string16* output) { | 142 string16* output) { |
| 131 #if defined(OS_WIN) | 143 #if defined(OS_WIN) |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 764 view()->OnNavigate(params_B); | 776 view()->OnNavigate(params_B); |
| 765 ProcessPendingMessages(); | 777 ProcessPendingMessages(); |
| 766 | 778 |
| 767 EXPECT_EQ(2, view()->history_list_length_); | 779 EXPECT_EQ(2, view()->history_list_length_); |
| 768 EXPECT_EQ(0, view()->history_list_offset_); | 780 EXPECT_EQ(0, view()->history_list_offset_); |
| 769 EXPECT_EQ(2, view()->history_page_ids_[0]); | 781 EXPECT_EQ(2, view()->history_page_ids_[0]); |
| 770 } | 782 } |
| 771 | 783 |
| 772 // Test that our IME backend sends a notification message when the input focus | 784 // Test that our IME backend sends a notification message when the input focus |
| 773 // changes. | 785 // changes. |
| 774 // crbug.com/276821: | 786 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. | 787 // Enable our IME backend code. |
| 779 view()->OnSetInputMethodActive(true); | 788 view()->OnSetInputMethodActive(true); |
| 780 | 789 |
| 781 // Load an HTML page consisting of two input fields. | 790 // Load an HTML page consisting of two input fields. |
| 782 view()->set_send_content_state_immediately(true); | 791 view()->set_send_content_state_immediately(true); |
| 783 LoadHTML("<html>" | 792 LoadHTML("<html>" |
| 784 "<head>" | 793 "<head>" |
| 785 "</head>" | 794 "</head>" |
| 786 "<body>" | 795 "<body>" |
| 787 "<input id=\"test1\" type=\"text\" value=\"some text\"></input>" | 796 "<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)); | 1943 EXPECT_FALSE(net::IsCertStatusError(ssl_status.cert_status)); |
| 1935 | 1944 |
| 1936 const_cast<WebKit::WebURLResponse&>(frame->dataSource()->response()). | 1945 const_cast<WebKit::WebURLResponse&>(frame->dataSource()->response()). |
| 1937 setSecurityInfo( | 1946 setSecurityInfo( |
| 1938 SerializeSecurityInfo(0, net::CERT_STATUS_ALL_ERRORS, 0, 0)); | 1947 SerializeSecurityInfo(0, net::CERT_STATUS_ALL_ERRORS, 0, 0)); |
| 1939 ssl_status = view()->GetSSLStatusOfFrame(frame); | 1948 ssl_status = view()->GetSSLStatusOfFrame(frame); |
| 1940 EXPECT_TRUE(net::IsCertStatusError(ssl_status.cert_status)); | 1949 EXPECT_TRUE(net::IsCertStatusError(ssl_status.cert_status)); |
| 1941 } | 1950 } |
| 1942 | 1951 |
| 1943 } // namespace content | 1952 } // namespace content |
| OLD | NEW |