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

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

Issue 2769353004: Fix build break on Mac SDK 10.12. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 process_host->sink().ClearMessages(); 1066 process_host->sink().ClearMessages();
1067 1067
1068 // Send a NSEvent of NSTabletProximity type which has a device type of eraser. 1068 // Send a NSEvent of NSTabletProximity type which has a device type of eraser.
1069 NSEvent* event = MockTabletEventWithParams(kCGEventTabletProximity, true, 1069 NSEvent* event = MockTabletEventWithParams(kCGEventTabletProximity, true,
1070 NSEraserPointingDevice); 1070 NSEraserPointingDevice);
1071 [view->cocoa_view() tabletEvent:event]; 1071 [view->cocoa_view() tabletEvent:event];
1072 // Flush and clear other messages (e.g. begin frames) the RWHVMac also sends. 1072 // Flush and clear other messages (e.g. begin frames) the RWHVMac also sends.
1073 base::RunLoop().RunUntilIdle(); 1073 base::RunLoop().RunUntilIdle();
1074 process_host->sink().ClearMessages(); 1074 process_host->sink().ClearMessages();
1075 1075
1076 event = MockMouseEventWithParams(kCGEventMouseMoved, {6, 9}, 0, 1076 event =
1077 kCGEventMouseSubtypeTabletPoint); 1077 MockMouseEventWithParams(kCGEventMouseMoved, {6, 9}, kCGMouseButtonLeft,
1078 kCGEventMouseSubtypeTabletPoint);
1078 [view->cocoa_view() mouseEvent:event]; 1079 [view->cocoa_view() mouseEvent:event];
1079 ASSERT_EQ(1U, process_host->sink().message_count()); 1080 ASSERT_EQ(1U, process_host->sink().message_count());
1080 EXPECT_EQ(blink::WebPointerProperties::PointerType::Eraser, 1081 EXPECT_EQ(blink::WebPointerProperties::PointerType::Eraser,
1081 GetInputMessagePointerTypes(process_host)); 1082 GetInputMessagePointerTypes(process_host));
1082 1083
1083 // Clean up. 1084 // Clean up.
1084 host->ShutdownAndDestroyWidget(true); 1085 host->ShutdownAndDestroyWidget(true);
1085 } 1086 }
1086 1087
1087 TEST_F(RenderWidgetHostViewMacTest, PointerEventWithPenType) { 1088 TEST_F(RenderWidgetHostViewMacTest, PointerEventWithPenType) {
(...skipping 12 matching lines...) Expand all
1100 process_host->sink().ClearMessages(); 1101 process_host->sink().ClearMessages();
1101 1102
1102 // Send a NSEvent of NSTabletProximity type which has a device type of pen. 1103 // Send a NSEvent of NSTabletProximity type which has a device type of pen.
1103 NSEvent* event = MockTabletEventWithParams(kCGEventTabletProximity, true, 1104 NSEvent* event = MockTabletEventWithParams(kCGEventTabletProximity, true,
1104 NSPenPointingDevice); 1105 NSPenPointingDevice);
1105 [view->cocoa_view() tabletEvent:event]; 1106 [view->cocoa_view() tabletEvent:event];
1106 // Flush and clear other messages (e.g. begin frames) the RWHVMac also sends. 1107 // Flush and clear other messages (e.g. begin frames) the RWHVMac also sends.
1107 base::RunLoop().RunUntilIdle(); 1108 base::RunLoop().RunUntilIdle();
1108 process_host->sink().ClearMessages(); 1109 process_host->sink().ClearMessages();
1109 1110
1110 event = MockMouseEventWithParams(kCGEventMouseMoved, {6, 9}, 0, 1111 event =
1111 kCGEventMouseSubtypeTabletPoint); 1112 MockMouseEventWithParams(kCGEventMouseMoved, {6, 9}, kCGMouseButtonLeft,
1113 kCGEventMouseSubtypeTabletPoint);
1112 [view->cocoa_view() mouseEvent:event]; 1114 [view->cocoa_view() mouseEvent:event];
1113 ASSERT_EQ(1U, process_host->sink().message_count()); 1115 ASSERT_EQ(1U, process_host->sink().message_count());
1114 EXPECT_EQ(blink::WebPointerProperties::PointerType::Pen, 1116 EXPECT_EQ(blink::WebPointerProperties::PointerType::Pen,
1115 GetInputMessagePointerTypes(process_host)); 1117 GetInputMessagePointerTypes(process_host));
1116 1118
1117 // Clean up. 1119 // Clean up.
1118 host->ShutdownAndDestroyWidget(true); 1120 host->ShutdownAndDestroyWidget(true);
1119 } 1121 }
1120 1122
1121 TEST_F(RenderWidgetHostViewMacTest, PointerEventWithMouseType) { 1123 TEST_F(RenderWidgetHostViewMacTest, PointerEventWithMouseType) {
1122 // Initialize the view associated with a MockRenderWidgetHostImpl, rather than 1124 // Initialize the view associated with a MockRenderWidgetHostImpl, rather than
1123 // the MockRenderProcessHost that is set up by the test harness which mocks 1125 // the MockRenderProcessHost that is set up by the test harness which mocks
1124 // out |OnMessageReceived()|. 1126 // out |OnMessageReceived()|.
1125 TestBrowserContext browser_context; 1127 TestBrowserContext browser_context;
1126 MockRenderProcessHost* process_host = 1128 MockRenderProcessHost* process_host =
1127 new MockRenderProcessHost(&browser_context); 1129 new MockRenderProcessHost(&browser_context);
1128 process_host->Init(); 1130 process_host->Init();
1129 MockRenderWidgetHostDelegate delegate; 1131 MockRenderWidgetHostDelegate delegate;
1130 int32_t routing_id = process_host->GetNextRoutingID(); 1132 int32_t routing_id = process_host->GetNextRoutingID();
1131 MockRenderWidgetHostImpl* host = 1133 MockRenderWidgetHostImpl* host =
1132 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id); 1134 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id);
1133 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false); 1135 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false);
1134 process_host->sink().ClearMessages(); 1136 process_host->sink().ClearMessages();
1135 1137
1136 // Send a NSEvent of a mouse type. 1138 // Send a NSEvent of a mouse type.
1137 NSEvent* event = MockMouseEventWithParams(kCGEventMouseMoved, {6, 9}, 0, 1139 NSEvent* event =
1138 kCGEventMouseSubtypeDefault); 1140 MockMouseEventWithParams(kCGEventMouseMoved, {6, 9}, kCGMouseButtonLeft,
1141 kCGEventMouseSubtypeDefault);
1139 [view->cocoa_view() mouseEvent:event]; 1142 [view->cocoa_view() mouseEvent:event];
1140 ASSERT_EQ(1U, process_host->sink().message_count()); 1143 ASSERT_EQ(1U, process_host->sink().message_count());
1141 EXPECT_EQ(blink::WebPointerProperties::PointerType::Mouse, 1144 EXPECT_EQ(blink::WebPointerProperties::PointerType::Mouse,
1142 GetInputMessagePointerTypes(process_host)); 1145 GetInputMessagePointerTypes(process_host));
1143 1146
1144 // Clean up. 1147 // Clean up.
1145 host->ShutdownAndDestroyWidget(true); 1148 host->ShutdownAndDestroyWidget(true);
1146 } 1149 }
1147 1150
1148 TEST_F(RenderWidgetHostViewMacTest, 1151 TEST_F(RenderWidgetHostViewMacTest,
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 // Verify that this IPC is asking for no monitoring or immediate updates. 1785 // Verify that this IPC is asking for no monitoring or immediate updates.
1783 InputMsg_RequestCompositionUpdates::Read(composition_request_msg_for_child, 1786 InputMsg_RequestCompositionUpdates::Read(composition_request_msg_for_child,
1784 &child_msg_params); 1787 &child_msg_params);
1785 is_child_msg_for_immediate_request = std::get<0>(child_msg_params); 1788 is_child_msg_for_immediate_request = std::get<0>(child_msg_params);
1786 is_child_msg_for_monitor_request = std::get<1>(child_msg_params); 1789 is_child_msg_for_monitor_request = std::get<1>(child_msg_params);
1787 EXPECT_FALSE(is_child_msg_for_immediate_request); 1790 EXPECT_FALSE(is_child_msg_for_immediate_request);
1788 EXPECT_FALSE(is_child_msg_for_monitor_request); 1791 EXPECT_FALSE(is_child_msg_for_monitor_request);
1789 } 1792 }
1790 1793
1791 } // namespace content 1794 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698