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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac_unittest.mm

Issue 1652483002: Browser Side Text Input State Tracking for OOPIF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merged 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_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include <Cocoa/Cocoa.h> 7 #include <Cocoa/Cocoa.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/mac/mac_util.h" 12 #include "base/mac/mac_util.h"
13 #include "base/mac/scoped_nsautorelease_pool.h" 13 #include "base/mac/scoped_nsautorelease_pool.h"
14 #include "base/mac/sdk_forward_declarations.h" 14 #include "base/mac/sdk_forward_declarations.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "content/browser/browser_thread_impl.h" 17 #include "content/browser/browser_thread_impl.h"
18 #include "content/browser/compositor/test/no_transport_image_transport_factory.h " 18 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
19 #include "content/browser/frame_host/render_widget_host_view_guest.h" 19 #include "content/browser/frame_host/render_widget_host_view_guest.h"
20 #include "content/browser/gpu/compositor_util.h" 20 #include "content/browser/gpu/compositor_util.h"
21 #include "content/browser/renderer_host/render_widget_host_delegate.h" 21 #include "content/browser/renderer_host/render_widget_host_delegate.h"
22 #include "content/common/input_messages.h" 22 #include "content/common/input_messages.h"
23 #include "content/common/text_input_state.h"
23 #include "content/common/view_messages.h" 24 #include "content/common/view_messages.h"
24 #include "content/public/browser/notification_types.h" 25 #include "content/public/browser/notification_types.h"
25 #include "content/public/browser/render_widget_host_view_mac_delegate.h" 26 #include "content/public/browser/render_widget_host_view_mac_delegate.h"
26 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
27 #include "content/public/test/mock_render_process_host.h" 28 #include "content/public/test/mock_render_process_host.h"
28 #include "content/public/test/test_browser_context.h" 29 #include "content/public/test/test_browser_context.h"
29 #include "content/public/test/test_utils.h" 30 #include "content/public/test/test_utils.h"
30 #include "content/test/test_render_view_host.h" 31 #include "content/test/test_render_view_host.h"
31 #include "gpu/ipc/common/gpu_messages.h" 32 #include "gpu/ipc/common/gpu_messages.h"
32 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(timestamp)] timestamp]; 136 [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(timestamp)] timestamp];
136 [(NSEvent*)[[event stub] 137 [(NSEvent*)[[event stub]
137 andReturnValue:OCMOCK_VALUE(modifierFlags)] modifierFlags]; 138 andReturnValue:OCMOCK_VALUE(modifierFlags)] modifierFlags];
138 [(NSEvent*)[[event stub] 139 [(NSEvent*)[[event stub]
139 andReturnValue:OCMOCK_VALUE(magnification)] magnification]; 140 andReturnValue:OCMOCK_VALUE(magnification)] magnification];
140 return event; 141 return event;
141 } 142 }
142 143
143 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { 144 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate {
144 public: 145 public:
145 MockRenderWidgetHostDelegate() {} 146 MockRenderWidgetHostDelegate() : text_input_state_(new TextInputState()) {}
146 ~MockRenderWidgetHostDelegate() override {} 147 ~MockRenderWidgetHostDelegate() override {}
147 148
149 const TextInputState* GetTextInputState() override {
150 return text_input_state_.get();
151 }
152
148 private: 153 private:
149 void Cut() override {} 154 void Cut() override {}
150 void Copy() override {} 155 void Copy() override {}
151 void Paste() override {} 156 void Paste() override {}
152 void SelectAll() override {} 157 void SelectAll() override {}
158
159 scoped_ptr<TextInputState> text_input_state_;
153 }; 160 };
154 161
155 class MockRenderWidgetHostImpl : public RenderWidgetHostImpl { 162 class MockRenderWidgetHostImpl : public RenderWidgetHostImpl {
156 public: 163 public:
157 MockRenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, 164 MockRenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
158 RenderProcessHost* process, 165 RenderProcessHost* process,
159 int32_t routing_id) 166 int32_t routing_id)
160 : RenderWidgetHostImpl(delegate, process, routing_id, false) { 167 : RenderWidgetHostImpl(delegate, process, routing_id, false) {
161 set_renderer_initialized(true); 168 set_renderer_initialized(true);
162 } 169 }
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 EXPECT_EQ(1U, process_host_->sink().message_count()); 1233 EXPECT_EQ(1U, process_host_->sink().message_count());
1227 process_host_->sink().ClearMessages(); 1234 process_host_->sink().ClearMessages();
1228 } 1235 }
1229 1236
1230 // Clean up. 1237 // Clean up.
1231 host->ShutdownAndDestroyWidget(true); 1238 host->ShutdownAndDestroyWidget(true);
1232 } 1239 }
1233 1240
1234 1241
1235 } // namespace content 1242 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698