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

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

Issue 1889313002: Revert of Browser Side Text Input State Tracking for OOPIF (Manual). (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_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"
24 #include "content/common/view_messages.h" 23 #include "content/common/view_messages.h"
25 #include "content/public/browser/notification_types.h" 24 #include "content/public/browser/notification_types.h"
26 #include "content/public/browser/render_widget_host_view_mac_delegate.h" 25 #include "content/public/browser/render_widget_host_view_mac_delegate.h"
27 #include "content/public/common/content_switches.h" 26 #include "content/public/common/content_switches.h"
28 #include "content/public/test/mock_render_process_host.h" 27 #include "content/public/test/mock_render_process_host.h"
29 #include "content/public/test/test_browser_context.h" 28 #include "content/public/test/test_browser_context.h"
30 #include "content/public/test/test_utils.h" 29 #include "content/public/test/test_utils.h"
31 #include "content/test/test_render_view_host.h" 30 #include "content/test/test_render_view_host.h"
32 #include "gpu/ipc/common/gpu_messages.h" 31 #include "gpu/ipc/common/gpu_messages.h"
33 #include "testing/gmock/include/gmock/gmock.h" 32 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(timestamp)] timestamp]; 135 [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(timestamp)] timestamp];
137 [(NSEvent*)[[event stub] 136 [(NSEvent*)[[event stub]
138 andReturnValue:OCMOCK_VALUE(modifierFlags)] modifierFlags]; 137 andReturnValue:OCMOCK_VALUE(modifierFlags)] modifierFlags];
139 [(NSEvent*)[[event stub] 138 [(NSEvent*)[[event stub]
140 andReturnValue:OCMOCK_VALUE(magnification)] magnification]; 139 andReturnValue:OCMOCK_VALUE(magnification)] magnification];
141 return event; 140 return event;
142 } 141 }
143 142
144 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { 143 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate {
145 public: 144 public:
146 MockRenderWidgetHostDelegate() : text_input_state_(new TextInputState()) {} 145 MockRenderWidgetHostDelegate() {}
147 ~MockRenderWidgetHostDelegate() override {} 146 ~MockRenderWidgetHostDelegate() override {}
148 147
149 const TextInputState* GetTextInputState() override {
150 return text_input_state_.get();
151 }
152
153 private: 148 private:
154 void Cut() override {} 149 void Cut() override {}
155 void Copy() override {} 150 void Copy() override {}
156 void Paste() override {} 151 void Paste() override {}
157 void SelectAll() override {} 152 void SelectAll() override {}
158
159 std::unique_ptr<TextInputState> text_input_state_;
160 }; 153 };
161 154
162 class MockRenderWidgetHostImpl : public RenderWidgetHostImpl { 155 class MockRenderWidgetHostImpl : public RenderWidgetHostImpl {
163 public: 156 public:
164 MockRenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, 157 MockRenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
165 RenderProcessHost* process, 158 RenderProcessHost* process,
166 int32_t routing_id) 159 int32_t routing_id)
167 : RenderWidgetHostImpl(delegate, process, routing_id, false) { 160 : RenderWidgetHostImpl(delegate, process, routing_id, false) {
168 set_renderer_initialized(true); 161 set_renderer_initialized(true);
169 } 162 }
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 EXPECT_EQ(1U, process_host_->sink().message_count()); 1226 EXPECT_EQ(1U, process_host_->sink().message_count());
1234 process_host_->sink().ClearMessages(); 1227 process_host_->sink().ClearMessages();
1235 } 1228 }
1236 1229
1237 // Clean up. 1230 // Clean up.
1238 host->ShutdownAndDestroyWidget(true); 1231 host->ShutdownAndDestroyWidget(true);
1239 } 1232 }
1240 1233
1241 1234
1242 } // namespace content 1235 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698