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

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

Issue 14487003: Add a new pair of IPC categories for messages that need handling as input events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addresses feedback Created 7 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 | Annotate | Revision Log
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 "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "base/mac/scoped_nsautorelease_pool.h" 8 #include "base/mac/scoped_nsautorelease_pool.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/browser/browser_thread_impl.h" 10 #include "content/browser/browser_thread_impl.h"
11 #include "content/browser/renderer_host/render_widget_host_delegate.h" 11 #include "content/browser/renderer_host/render_widget_host_delegate.h"
12 #include "content/browser/renderer_host/test_render_view_host.h" 12 #include "content/browser/renderer_host/test_render_view_host.h"
13 #include "content/common/gpu/gpu_messages.h" 13 #include "content/common/gpu/gpu_messages.h"
14 #include "content/common/input_messages.h"
14 #include "content/common/view_messages.h" 15 #include "content/common/view_messages.h"
15 #include "content/public/browser/notification_types.h" 16 #include "content/public/browser/notification_types.h"
16 #include "content/public/test/mock_render_process_host.h" 17 #include "content/public/test/mock_render_process_host.h"
17 #include "content/public/test/test_browser_context.h" 18 #include "content/public/test/test_browser_context.h"
18 #include "content/public/test/test_utils.h" 19 #include "content/public/test/test_utils.h"
19 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 #include "ui/base/test/cocoa_test_event_utils.h" 22 #include "ui/base/test/cocoa_test_event_utils.h"
22 #import "ui/base/test/ui_cocoa_test_helper.h" 23 #import "ui/base/test/ui_cocoa_test_helper.h"
23 #include "webkit/plugins/npapi/webplugin.h" 24 #include "webkit/plugins/npapi/webplugin.h"
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 &delegate, process_host, MSG_ROUTING_NONE); 679 &delegate, process_host, MSG_ROUTING_NONE);
679 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>( 680 RenderWidgetHostViewMac* view = static_cast<RenderWidgetHostViewMac*>(
680 RenderWidgetHostView::CreateViewForWidget(host)); 681 RenderWidgetHostView::CreateViewForWidget(host));
681 682
682 // Send an initial wheel event with NSEventPhaseBegan to the view. 683 // Send an initial wheel event with NSEventPhaseBegan to the view.
683 NSEvent* event1 = MockScrollWheelEventWithPhase(@selector(phaseBegan)); 684 NSEvent* event1 = MockScrollWheelEventWithPhase(@selector(phaseBegan));
684 [view->cocoa_view() scrollWheel:event1]; 685 [view->cocoa_view() scrollWheel:event1];
685 ASSERT_EQ(1U, process_host->sink().message_count()); 686 ASSERT_EQ(1U, process_host->sink().message_count());
686 687
687 // Send an ACK for the first wheel event, so that the queue will be flushed. 688 // Send an ACK for the first wheel event, so that the queue will be flushed.
688 scoped_ptr<IPC::Message> response( 689 scoped_ptr<IPC::Message> response(new InputHostMsg_HandleInputEvent_ACK(
689 new ViewHostMsg_HandleInputEvent_ACK(0, WebKit::WebInputEvent::MouseWheel, 690 0, WebKit::WebInputEvent::MouseWheel, INPUT_EVENT_ACK_STATE_CONSUMED));
690 INPUT_EVENT_ACK_STATE_CONSUMED));
691 host->OnMessageReceived(*response); 691 host->OnMessageReceived(*response);
692 692
693 // Post the NSEventPhaseEnded wheel event to NSApp and check whether the 693 // Post the NSEventPhaseEnded wheel event to NSApp and check whether the
694 // render view receives it. 694 // render view receives it.
695 NSEvent* event2 = MockScrollWheelEventWithPhase(@selector(phaseEnded)); 695 NSEvent* event2 = MockScrollWheelEventWithPhase(@selector(phaseEnded));
696 [NSApp postEvent:event2 atStart:NO]; 696 [NSApp postEvent:event2 atStart:NO];
697 MessageLoop::current()->RunUntilIdle(); 697 MessageLoop::current()->RunUntilIdle();
698 ASSERT_EQ(2U, process_host->sink().message_count()); 698 ASSERT_EQ(2U, process_host->sink().message_count());
699 699
700 // Clean up. 700 // Clean up.
701 host->Shutdown(); 701 host->Shutdown();
702 } 702 }
703 703
704 } // namespace content 704 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698