Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 1895523002: Revert of Browser Side Text Input State Tracking for OOPIF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 23 matching lines...) Expand all
34 #include "content/browser/renderer_host/overscroll_controller_delegate.h" 34 #include "content/browser/renderer_host/overscroll_controller_delegate.h"
35 #include "content/browser/renderer_host/render_view_host_factory.h" 35 #include "content/browser/renderer_host/render_view_host_factory.h"
36 #include "content/browser/renderer_host/render_widget_host_delegate.h" 36 #include "content/browser/renderer_host/render_widget_host_delegate.h"
37 #include "content/browser/renderer_host/render_widget_host_impl.h" 37 #include "content/browser/renderer_host/render_widget_host_impl.h"
38 #include "content/browser/renderer_host/resize_lock.h" 38 #include "content/browser/renderer_host/resize_lock.h"
39 #include "content/browser/web_contents/web_contents_view_aura.h" 39 #include "content/browser/web_contents/web_contents_view_aura.h"
40 #include "content/common/host_shared_bitmap_manager.h" 40 #include "content/common/host_shared_bitmap_manager.h"
41 #include "content/common/input/input_event_utils.h" 41 #include "content/common/input/input_event_utils.h"
42 #include "content/common/input/synthetic_web_input_event_builders.h" 42 #include "content/common/input/synthetic_web_input_event_builders.h"
43 #include "content/common/input_messages.h" 43 #include "content/common/input_messages.h"
44 #include "content/common/text_input_state.h"
45 #include "content/common/view_messages.h" 44 #include "content/common/view_messages.h"
46 #include "content/public/browser/render_widget_host_view.h" 45 #include "content/public/browser/render_widget_host_view.h"
47 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" 46 #include "content/public/browser/render_widget_host_view_frame_subscriber.h"
48 #include "content/public/browser/web_contents_view_delegate.h" 47 #include "content/public/browser/web_contents_view_delegate.h"
49 #include "content/public/common/context_menu_params.h" 48 #include "content/public/common/context_menu_params.h"
50 #include "content/public/test/mock_render_process_host.h" 49 #include "content/public/test/mock_render_process_host.h"
51 #include "content/public/test/test_browser_context.h" 50 #include "content/public/test/test_browser_context.h"
52 #include "content/test/test_render_view_host.h" 51 #include "content/test/test_render_view_host.h"
53 #include "content/test/test_web_contents.h" 52 #include "content/test/test_web_contents.h"
54 #include "ipc/ipc_test_sink.h" 53 #include "ipc/ipc_test_sink.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 OverscrollMode current_mode_; 145 OverscrollMode current_mode_;
147 OverscrollMode completed_mode_; 146 OverscrollMode completed_mode_;
148 float delta_x_; 147 float delta_x_;
149 float delta_y_; 148 float delta_y_;
150 149
151 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate); 150 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate);
152 }; 151 };
153 152
154 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { 153 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate {
155 public: 154 public:
156 MockRenderWidgetHostDelegate() 155 MockRenderWidgetHostDelegate() : rwh_(nullptr) {}
157 : rwh_(nullptr), text_input_state_(new TextInputState()) {}
158 ~MockRenderWidgetHostDelegate() override {} 156 ~MockRenderWidgetHostDelegate() override {}
159 const NativeWebKeyboardEvent* last_event() const { return last_event_.get(); } 157 const NativeWebKeyboardEvent* last_event() const { return last_event_.get(); }
160 void set_widget_host(RenderWidgetHostImpl* rwh) { rwh_ = rwh; } 158 void set_widget_host(RenderWidgetHostImpl* rwh) { rwh_ = rwh; }
161 159
162 protected: 160 protected:
163 // RenderWidgetHostDelegate: 161 // RenderWidgetHostDelegate:
164 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, 162 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
165 bool* is_keyboard_shortcut) override { 163 bool* is_keyboard_shortcut) override {
166 last_event_.reset(new NativeWebKeyboardEvent(event)); 164 last_event_.reset(new NativeWebKeyboardEvent(event));
167 return true; 165 return true;
168 } 166 }
169
170 const TextInputState* GetTextInputState() override {
171 return text_input_state_.get();
172 }
173
174 void Cut() override {} 167 void Cut() override {}
175 void Copy() override {} 168 void Copy() override {}
176 void Paste() override {} 169 void Paste() override {}
177 void SelectAll() override {} 170 void SelectAll() override {}
178 void SendScreenRects() override { 171 void SendScreenRects() override {
179 if (rwh_) 172 if (rwh_)
180 rwh_->SendScreenRects(); 173 rwh_->SendScreenRects();
181 } 174 }
182 175
183 private: 176 private:
184 scoped_ptr<NativeWebKeyboardEvent> last_event_; 177 scoped_ptr<NativeWebKeyboardEvent> last_event_;
185 RenderWidgetHostImpl* rwh_; 178 RenderWidgetHostImpl* rwh_;
186 scoped_ptr<TextInputState> text_input_state_;
187
188 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHostDelegate); 179 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHostDelegate);
189 }; 180 };
190 181
191 // Simple observer that keeps track of changes to a window for tests. 182 // Simple observer that keeps track of changes to a window for tests.
192 class TestWindowObserver : public aura::WindowObserver { 183 class TestWindowObserver : public aura::WindowObserver {
193 public: 184 public:
194 explicit TestWindowObserver(aura::Window* window_to_observe) 185 explicit TestWindowObserver(aura::Window* window_to_observe)
195 : window_(window_to_observe) { 186 : window_(window_to_observe) {
196 window_->AddObserver(this); 187 window_->AddObserver(this);
197 } 188 }
(...skipping 4283 matching lines...) Expand 10 before | Expand all | Expand 10 after
4481 view()->OnGestureEvent(&gesture_event); 4472 view()->OnGestureEvent(&gesture_event);
4482 4473
4483 EXPECT_TRUE(delegate->context_menu_request_received()); 4474 EXPECT_TRUE(delegate->context_menu_request_received());
4484 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); 4475 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH);
4485 #endif 4476 #endif
4486 4477
4487 RenderViewHostFactory::set_is_real_render_view_host(false); 4478 RenderViewHostFactory::set_is_real_render_view_host(false);
4488 } 4479 }
4489 4480
4490 } // namespace content 4481 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698