| Index: content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
|
| diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
|
| index 6f9a643f78344d2eb66d6294d1f3bbdbdeb5912e..2fdad45d346d8641fc2cb5e0e101e2384624049c 100644
|
| --- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
|
| +++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
|
| @@ -124,8 +124,17 @@ std::string GetInputMessageTypes(MockRenderProcessHost* process) {
|
| return result;
|
| }
|
|
|
| +NSEventPhase PhaseForEventType(NSEventType type) {
|
| + if (type == NSEventTypeBeginGesture)
|
| + return NSEventPhaseBegan;
|
| + if (type == NSEventTypeEndGesture)
|
| + return NSEventPhaseEnded;
|
| + return NSEventPhaseChanged;
|
| +}
|
| +
|
| id MockGestureEvent(NSEventType type, double magnification) {
|
| id event = [OCMockObject mockForClass:[NSEvent class]];
|
| + NSEventPhase phase = PhaseForEventType(type);
|
| NSPoint locationInWindow = NSMakePoint(0, 0);
|
| CGFloat deltaX = 0;
|
| CGFloat deltaY = 0;
|
| @@ -133,6 +142,7 @@ id MockGestureEvent(NSEventType type, double magnification) {
|
| NSUInteger modifierFlags = 0;
|
|
|
| [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(type)] type];
|
| + [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(phase)] phase];
|
| [(NSEvent*)[[event stub]
|
| andReturnValue:OCMOCK_VALUE(locationInWindow)] locationInWindow];
|
| [(NSEvent*)[[event stub] andReturnValue:OCMOCK_VALUE(deltaX)] deltaX];
|
| @@ -1225,6 +1235,7 @@ TEST_F(RenderWidgetHostViewMacPinchTest, PinchThresholding) {
|
| MockGestureEvent(NSEventTypeEndGesture, 0);
|
|
|
| [view->cocoa_view() beginGestureWithEvent:pinchBeginEvent];
|
| + [view->cocoa_view() magnifyWithEvent:pinchBeginEvent];
|
| EXPECT_EQ(0U, process_host_->sink().message_count());
|
|
|
| // No zoom is sent for the first update event.
|
| @@ -1250,6 +1261,7 @@ TEST_F(RenderWidgetHostViewMacPinchTest, PinchThresholding) {
|
| process_host_->sink().ClearMessages();
|
|
|
| [view->cocoa_view() endGestureWithEvent:pinchEndEvent];
|
| + [view->cocoa_view() magnifyWithEvent:pinchEndEvent];
|
| EXPECT_EQ(1U, process_host_->sink().message_count());
|
| process_host_->sink().ClearMessages();
|
| }
|
| @@ -1264,6 +1276,7 @@ TEST_F(RenderWidgetHostViewMacPinchTest, PinchThresholding) {
|
| view->page_at_minimum_scale_ = false;
|
|
|
| [view->cocoa_view() beginGestureWithEvent:pinchBeginEvent];
|
| + [view->cocoa_view() magnifyWithEvent:pinchBeginEvent];
|
| EXPECT_EQ(0U, process_host_->sink().message_count());
|
|
|
| // Expect that a zoom happen because the time threshold has not passed.
|
| @@ -1274,6 +1287,7 @@ TEST_F(RenderWidgetHostViewMacPinchTest, PinchThresholding) {
|
| process_host_->sink().ClearMessages();
|
|
|
| [view->cocoa_view() endGestureWithEvent:pinchEndEvent];
|
| + [view->cocoa_view() magnifyWithEvent:pinchEndEvent];
|
| EXPECT_EQ(1U, process_host_->sink().message_count());
|
| process_host_->sink().ClearMessages();
|
| }
|
| @@ -1288,6 +1302,7 @@ TEST_F(RenderWidgetHostViewMacPinchTest, PinchThresholding) {
|
| view->page_at_minimum_scale_ = true;
|
|
|
| [view->cocoa_view() beginGestureWithEvent:pinchBeginEvent];
|
| + [view->cocoa_view() magnifyWithEvent:pinchBeginEvent];
|
| EXPECT_EQ(0U, process_host_->sink().message_count());
|
|
|
| // Get back to zoom one right after the begin event. This should still keep
|
| @@ -1302,6 +1317,7 @@ TEST_F(RenderWidgetHostViewMacPinchTest, PinchThresholding) {
|
| process_host_->sink().ClearMessages();
|
|
|
| [view->cocoa_view() endGestureWithEvent:pinchEndEvent];
|
| + [view->cocoa_view() magnifyWithEvent:pinchEndEvent];
|
| EXPECT_EQ(1U, process_host_->sink().message_count());
|
| process_host_->sink().ClearMessages();
|
| }
|
|
|