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/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/common/intents_messages.h" | 10 #include "content/common/intents_messages.h" |
11 #include "content/common/view_messages.h" | 11 #include "content/common/view_messages.h" |
12 #include "content/public/browser/native_web_keyboard_event.h" | 12 #include "content/public/browser/native_web_keyboard_event.h" |
13 #include "content/public/browser/web_ui_controller_factory.h" | 13 #include "content/public/browser/web_ui_controller_factory.h" |
14 #include "content/public/common/bindings_policy.h" | 14 #include "content/public/common/bindings_policy.h" |
15 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
16 #include "content/public/test/render_view_test.h" | 16 #include "content/public/test/render_view_test.h" |
17 #include "content/renderer/render_view_impl.h" | 17 #include "content/renderer/render_view_impl.h" |
18 #include "content/shell/shell_content_browser_client.h" | 18 #include "content/shell/shell_content_browser_client.h" |
19 #include "content/shell/shell_content_client.h" | 19 #include "content/shell/shell_content_client.h" |
20 #include "content/shell/shell_main_delegate.h" | |
21 #include "content/test/mock_keyboard.h" | 20 #include "content/test/mock_keyboard.h" |
22 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody.
h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebHTTPBody.
h" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo.
h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo.
h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 134 |
136 } | 135 } |
137 | 136 |
138 class RenderViewImplTest : public content::RenderViewTest { | 137 class RenderViewImplTest : public content::RenderViewTest { |
139 public: | 138 public: |
140 RenderViewImplTest() { | 139 RenderViewImplTest() { |
141 // Attach a pseudo keyboard device to this object. | 140 // Attach a pseudo keyboard device to this object. |
142 mock_keyboard_.reset(new MockKeyboard()); | 141 mock_keyboard_.reset(new MockKeyboard()); |
143 } | 142 } |
144 | 143 |
145 virtual void SetUp() OVERRIDE { | |
146 content::RenderViewTest::SetUp(); | |
147 content::ShellMainDelegate::InitializeResourceBundle(); | |
148 } | |
149 | |
150 RenderViewImpl* view() { | 144 RenderViewImpl* view() { |
151 return static_cast<RenderViewImpl*>(view_); | 145 return static_cast<RenderViewImpl*>(view_); |
152 } | 146 } |
153 | 147 |
154 // Sends IPC messages that emulates a key-press event. | 148 // Sends IPC messages that emulates a key-press event. |
155 int SendKeyEvent(MockKeyboard::Layout layout, | 149 int SendKeyEvent(MockKeyboard::Layout layout, |
156 int key_code, | 150 int key_code, |
157 MockKeyboard::Modifiers modifiers, | 151 MockKeyboard::Modifiers modifiers, |
158 string16* output) { | 152 string16* output) { |
159 #if defined(OS_WIN) | 153 #if defined(OS_WIN) |
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1789 EXPECT_EQ("abcdefgopqrstuvwxyz", info.value); | 1783 EXPECT_EQ("abcdefgopqrstuvwxyz", info.value); |
1790 EXPECT_EQ(7, info.selectionStart); | 1784 EXPECT_EQ(7, info.selectionStart); |
1791 EXPECT_EQ(7, info.selectionEnd); | 1785 EXPECT_EQ(7, info.selectionEnd); |
1792 view()->OnSetEditableSelectionOffsets(4, 8); | 1786 view()->OnSetEditableSelectionOffsets(4, 8); |
1793 view()->OnExtendSelectionAndDelete(2, 5); | 1787 view()->OnExtendSelectionAndDelete(2, 5); |
1794 info = view()->webview()->textInputInfo(); | 1788 info = view()->webview()->textInputInfo(); |
1795 EXPECT_EQ("abuvwxyz", info.value); | 1789 EXPECT_EQ("abuvwxyz", info.value); |
1796 EXPECT_EQ(2, info.selectionStart); | 1790 EXPECT_EQ(2, info.selectionStart); |
1797 EXPECT_EQ(2, info.selectionEnd); | 1791 EXPECT_EQ(2, info.selectionEnd); |
1798 } | 1792 } |
OLD | NEW |