OLD | NEW |
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" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. | 155 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. |
156 rwhv_mac_ = static_cast<RenderWidgetHostViewMac*>( | 156 rwhv_mac_ = static_cast<RenderWidgetHostViewMac*>( |
157 RenderWidgetHostView::CreateViewForWidget(rvh())); | 157 RenderWidgetHostView::CreateViewForWidget(rvh())); |
158 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); | 158 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); |
159 } | 159 } |
160 virtual void TearDown() { | 160 virtual void TearDown() { |
161 // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs. | 161 // Make sure the rwhv_mac_ is gone once the superclass's |TearDown()| runs. |
162 rwhv_cocoa_.reset(); | 162 rwhv_cocoa_.reset(); |
163 pool_.Recycle(); | 163 pool_.Recycle(); |
164 MessageLoop::current()->RunUntilIdle(); | 164 base::MessageLoop::current()->RunUntilIdle(); |
165 pool_.Recycle(); | 165 pool_.Recycle(); |
166 | 166 |
167 // See comment in SetUp(). | 167 // See comment in SetUp(). |
168 test_rvh()->SetView(old_rwhv_); | 168 test_rvh()->SetView(old_rwhv_); |
169 | 169 |
170 RenderViewHostImplTestHarness::TearDown(); | 170 RenderViewHostImplTestHarness::TearDown(); |
171 } | 171 } |
172 protected: | 172 protected: |
173 private: | 173 private: |
174 // This class isn't derived from PlatformTest. | 174 // This class isn't derived from PlatformTest. |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 | 687 |
688 // 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. |
689 scoped_ptr<IPC::Message> response(new InputHostMsg_HandleInputEvent_ACK( | 689 scoped_ptr<IPC::Message> response(new InputHostMsg_HandleInputEvent_ACK( |
690 0, WebKit::WebInputEvent::MouseWheel, INPUT_EVENT_ACK_STATE_CONSUMED)); | 690 0, WebKit::WebInputEvent::MouseWheel, 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 base::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 |
OLD | NEW |