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

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

Issue 2451953004: Fix mac raciness with initial needs begin frame state (Closed)
Patch Set: Fixes for ScrollWheelEndEventDelivery test Created 4 years, 1 month 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 | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | 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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 MockRenderWidgetHostImpl* host = 942 MockRenderWidgetHostImpl* host =
943 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id); 943 new MockRenderWidgetHostImpl(&delegate, process_host, routing_id);
944 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false); 944 RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false);
945 process_host->sink().ClearMessages(); 945 process_host->sink().ClearMessages();
946 946
947 // Send an initial wheel event with NSEventPhaseBegan to the view. 947 // Send an initial wheel event with NSEventPhaseBegan to the view.
948 NSEvent* event1 = MockScrollWheelEventWithPhase(@selector(phaseBegan), 0); 948 NSEvent* event1 = MockScrollWheelEventWithPhase(@selector(phaseBegan), 0);
949 [view->cocoa_view() scrollWheel:event1]; 949 [view->cocoa_view() scrollWheel:event1];
950 ASSERT_EQ(1U, process_host->sink().message_count()); 950 ASSERT_EQ(1U, process_host->sink().message_count());
951 951
952 // Flush and clear other messages (e.g. begin frames) the RWHVMac also sends.
953 base::RunLoop().RunUntilIdle();
954 process_host->sink().ClearMessages();
955
952 // Send an ACK for the first wheel event, so that the queue will be flushed. 956 // Send an ACK for the first wheel event, so that the queue will be flushed.
953 InputEventAck ack(blink::WebInputEvent::MouseWheel, 957 InputEventAck ack(blink::WebInputEvent::MouseWheel,
954 INPUT_EVENT_ACK_STATE_CONSUMED); 958 INPUT_EVENT_ACK_STATE_CONSUMED);
955 std::unique_ptr<IPC::Message> response( 959 std::unique_ptr<IPC::Message> response(
956 new InputHostMsg_HandleInputEvent_ACK(0, ack)); 960 new InputHostMsg_HandleInputEvent_ACK(0, ack));
957 host->OnMessageReceived(*response); 961 host->OnMessageReceived(*response);
958 962
959 // Post the NSEventPhaseEnded wheel event to NSApp and check whether the 963 // Post the NSEventPhaseEnded wheel event to NSApp and check whether the
960 // render view receives it. 964 // render view receives it.
961 NSEvent* event2 = MockScrollWheelEventWithPhase(@selector(phaseEnded), 0); 965 NSEvent* event2 = MockScrollWheelEventWithPhase(@selector(phaseEnded), 0);
962 [NSApp postEvent:event2 atStart:NO]; 966 [NSApp postEvent:event2 atStart:NO];
963 base::RunLoop().RunUntilIdle(); 967 base::RunLoop().RunUntilIdle();
964 ASSERT_EQ(2U, process_host->sink().message_count()); 968 ASSERT_EQ(1U, process_host->sink().message_count());
965 969
966 // Clean up. 970 // Clean up.
967 host->ShutdownAndDestroyWidget(true); 971 host->ShutdownAndDestroyWidget(true);
968 } 972 }
969 973
970 TEST_F(RenderWidgetHostViewMacTest, 974 TEST_F(RenderWidgetHostViewMacTest,
971 IgnoreEmptyUnhandledWheelEventWithWheelGestures) { 975 IgnoreEmptyUnhandledWheelEventWithWheelGestures) {
972 // Initialize the view associated with a MockRenderWidgetHostImpl, rather than 976 // Initialize the view associated with a MockRenderWidgetHostImpl, rather than
973 // the MockRenderProcessHost that is set up by the test harness which mocks 977 // the MockRenderProcessHost that is set up by the test harness which mocks
974 // out |OnMessageReceived()|. 978 // out |OnMessageReceived()|.
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
1574 // Verify that this IPC is asking for no monitoring or immediate updates. 1578 // Verify that this IPC is asking for no monitoring or immediate updates.
1575 InputMsg_RequestCompositionUpdate::Read(composition_request_msg_for_child, 1579 InputMsg_RequestCompositionUpdate::Read(composition_request_msg_for_child,
1576 &child_msg_params); 1580 &child_msg_params);
1577 is_child_msg_for_immediate_request = std::get<0>(child_msg_params); 1581 is_child_msg_for_immediate_request = std::get<0>(child_msg_params);
1578 is_child_msg_for_monitor_request = std::get<1>(child_msg_params); 1582 is_child_msg_for_monitor_request = std::get<1>(child_msg_params);
1579 EXPECT_FALSE(is_child_msg_for_immediate_request); 1583 EXPECT_FALSE(is_child_msg_for_immediate_request);
1580 EXPECT_FALSE(is_child_msg_for_monitor_request); 1584 EXPECT_FALSE(is_child_msg_for_monitor_request);
1581 } 1585 }
1582 1586
1583 } // namespace content 1587 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698