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

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

Issue 2240983003: Move |ScopedWebInputEvent| and |WebInputEventTraits| from |content::| to "ui/events/blink" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and ncarter's review Created 4 years, 4 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 #include <tuple> 10 #include <tuple>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.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/run_loop.h" 16 #include "base/run_loop.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "base/test/histogram_tester.h" 18 #include "base/test/histogram_tester.h"
19 #include "base/test/simple_test_tick_clock.h" 19 #include "base/test/simple_test_tick_clock.h"
20 #include "content/browser/browser_thread_impl.h" 20 #include "content/browser/browser_thread_impl.h"
21 #include "content/browser/compositor/test/no_transport_image_transport_factory.h " 21 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
22 #include "content/browser/frame_host/render_widget_host_view_guest.h" 22 #include "content/browser/frame_host/render_widget_host_view_guest.h"
23 #include "content/browser/gpu/compositor_util.h" 23 #include "content/browser/gpu/compositor_util.h"
24 #include "content/browser/renderer_host/render_widget_host_delegate.h" 24 #include "content/browser/renderer_host/render_widget_host_delegate.h"
25 #include "content/browser/renderer_host/text_input_manager.h" 25 #include "content/browser/renderer_host/text_input_manager.h"
26 #include "content/common/input/web_input_event_traits.h"
27 #include "content/common/input_messages.h" 26 #include "content/common/input_messages.h"
28 #include "content/common/text_input_state.h" 27 #include "content/common/text_input_state.h"
29 #include "content/common/view_messages.h" 28 #include "content/common/view_messages.h"
30 #include "content/public/browser/notification_types.h" 29 #include "content/public/browser/notification_types.h"
31 #include "content/public/browser/render_widget_host_view_mac_delegate.h" 30 #include "content/public/browser/render_widget_host_view_mac_delegate.h"
32 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
33 #include "content/public/test/mock_render_process_host.h" 32 #include "content/public/test/mock_render_process_host.h"
34 #include "content/public/test/test_browser_context.h" 33 #include "content/public/test/test_browser_context.h"
35 #include "content/public/test/test_utils.h" 34 #include "content/public/test/test_utils.h"
36 #include "content/test/test_render_view_host.h" 35 #include "content/test/test_render_view_host.h"
37 #include "gpu/ipc/common/gpu_messages.h" 36 #include "gpu/ipc/common/gpu_messages.h"
38 #include "testing/gmock/include/gmock/gmock.h" 37 #include "testing/gmock/include/gmock/gmock.h"
39 #include "testing/gtest/include/gtest/gtest.h" 38 #include "testing/gtest/include/gtest/gtest.h"
40 #include "testing/gtest_mac.h" 39 #include "testing/gtest_mac.h"
41 #import "third_party/ocmock/OCMock/OCMock.h" 40 #import "third_party/ocmock/OCMock/OCMock.h"
42 #import "third_party/ocmock/ocmock_extensions.h" 41 #import "third_party/ocmock/ocmock_extensions.h"
43 #include "ui/events/base_event_utils.h" 42 #include "ui/events/base_event_utils.h"
43 #include "ui/events/blink/web_input_event_traits.h"
44 #include "ui/events/latency_info.h" 44 #include "ui/events/latency_info.h"
45 #include "ui/events/test/cocoa_test_event_utils.h" 45 #include "ui/events/test/cocoa_test_event_utils.h"
46 #import "ui/gfx/test/ui_cocoa_test_helper.h" 46 #import "ui/gfx/test/ui_cocoa_test_helper.h"
47 47
48 // Helper class with methods used to mock -[NSEvent phase], used by 48 // Helper class with methods used to mock -[NSEvent phase], used by
49 // |MockScrollWheelEventWithPhase()|. 49 // |MockScrollWheelEventWithPhase()|.
50 @interface MockPhaseMethods : NSObject { 50 @interface MockPhaseMethods : NSObject {
51 } 51 }
52 52
53 - (NSEventPhase)phaseBegan; 53 - (NSEventPhase)phaseBegan;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 std::string GetInputMessageTypes(MockRenderProcessHost* process) { 108 std::string GetInputMessageTypes(MockRenderProcessHost* process) {
109 std::string result; 109 std::string result;
110 for (size_t i = 0; i < process->sink().message_count(); ++i) { 110 for (size_t i = 0; i < process->sink().message_count(); ++i) {
111 const IPC::Message* message = process->sink().GetMessageAt(i); 111 const IPC::Message* message = process->sink().GetMessageAt(i);
112 EXPECT_EQ(InputMsg_HandleInputEvent::ID, message->type()); 112 EXPECT_EQ(InputMsg_HandleInputEvent::ID, message->type());
113 InputMsg_HandleInputEvent::Param params; 113 InputMsg_HandleInputEvent::Param params;
114 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(message, &params)); 114 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(message, &params));
115 const blink::WebInputEvent* event = std::get<0>(params); 115 const blink::WebInputEvent* event = std::get<0>(params);
116 if (i != 0) 116 if (i != 0)
117 result += " "; 117 result += " ";
118 result += WebInputEventTraits::GetName(event->type); 118 result += ui::WebInputEventTraits::GetName(event->type);
119 } 119 }
120 process->sink().ClearMessages(); 120 process->sink().ClearMessages();
121 return result; 121 return result;
122 } 122 }
123 123
124 id MockGestureEvent(NSEventType type, double magnification) { 124 id MockGestureEvent(NSEventType type, double magnification) {
125 id event = [OCMockObject mockForClass:[NSEvent class]]; 125 id event = [OCMockObject mockForClass:[NSEvent class]];
126 NSPoint locationInWindow = NSMakePoint(0, 0); 126 NSPoint locationInWindow = NSMakePoint(0, 0);
127 CGFloat deltaX = 0; 127 CGFloat deltaX = 0;
128 CGFloat deltaY = 0; 128 CGFloat deltaY = 0;
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 // Repeat for the tab's view. 1449 // Repeat for the tab's view.
1450 [rwhv_cocoa_ setMarkedText:text 1450 [rwhv_cocoa_ setMarkedText:text
1451 selectedRange:selectedRange 1451 selectedRange:selectedRange
1452 replacementRange:replacementRange]; 1452 replacementRange:replacementRange];
1453 EXPECT_TRUE([rwhv_cocoa_ hasMarkedText]); 1453 EXPECT_TRUE([rwhv_cocoa_ hasMarkedText]);
1454 rwhv_mac_->ImeCancelComposition(); 1454 rwhv_mac_->ImeCancelComposition();
1455 EXPECT_FALSE([rwhv_cocoa_ hasMarkedText]); 1455 EXPECT_FALSE([rwhv_cocoa_ hasMarkedText]);
1456 } 1456 }
1457 1457
1458 } // namespace content 1458 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698