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

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

Issue 369923003: NoTransportImageTransportFactory is compiled into only test targets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: InitializeForUnitTests get scoped_ptr Created 6 years, 5 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
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/mac/sdk_forward_declarations.h" 9 #include "base/mac/sdk_forward_declarations.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "content/browser/browser_thread_impl.h" 11 #include "content/browser/browser_thread_impl.h"
12 #include "content/browser/compositor/image_transport_factory.h" 12 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
13 #include "content/browser/gpu/compositor_util.h" 13 #include "content/browser/gpu/compositor_util.h"
14 #include "content/browser/renderer_host/render_widget_host_delegate.h" 14 #include "content/browser/renderer_host/render_widget_host_delegate.h"
15 #include "content/common/gpu/gpu_messages.h" 15 #include "content/common/gpu/gpu_messages.h"
16 #include "content/common/input_messages.h" 16 #include "content/common/input_messages.h"
17 #include "content/common/view_messages.h" 17 #include "content/common/view_messages.h"
18 #include "content/public/browser/notification_types.h" 18 #include "content/public/browser/notification_types.h"
19 #include "content/public/browser/render_widget_host_view_mac_delegate.h" 19 #include "content/public/browser/render_widget_host_view_mac_delegate.h"
20 #include "content/public/test/mock_render_process_host.h" 20 #include "content/public/test/mock_render_process_host.h"
21 #include "content/public/test/test_browser_context.h" 21 #include "content/public/test/test_browser_context.h"
22 #include "content/public/test/test_utils.h" 22 #include "content/public/test/test_utils.h"
23 #include "content/test/test_render_view_host.h" 23 #include "content/test/test_render_view_host.h"
24 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 #include "ui/compositor/test/in_process_context_factory.h"
27 #include "ui/events/test/cocoa_test_event_utils.h" 26 #include "ui/events/test/cocoa_test_event_utils.h"
28 #import "ui/gfx/test/ui_cocoa_test_helper.h" 27 #import "ui/gfx/test/ui_cocoa_test_helper.h"
29 28
30 // Helper class with methods used to mock -[NSEvent phase], used by 29 // Helper class with methods used to mock -[NSEvent phase], used by
31 // |MockScrollWheelEventWithPhase()|. 30 // |MockScrollWheelEventWithPhase()|.
32 @interface MockPhaseMethods : NSObject { 31 @interface MockPhaseMethods : NSObject {
33 } 32 }
34 33
35 - (NSEventPhase)phaseBegan; 34 - (NSEventPhase)phaseBegan;
36 - (NSEventPhase)phaseChanged; 35 - (NSEventPhase)phaseChanged;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } // namespace 162 } // namespace
164 163
165 class RenderWidgetHostViewMacTest : public RenderViewHostImplTestHarness { 164 class RenderWidgetHostViewMacTest : public RenderViewHostImplTestHarness {
166 public: 165 public:
167 RenderWidgetHostViewMacTest() : old_rwhv_(NULL), rwhv_mac_(NULL) {} 166 RenderWidgetHostViewMacTest() : old_rwhv_(NULL), rwhv_mac_(NULL) {}
168 167
169 virtual void SetUp() { 168 virtual void SetUp() {
170 RenderViewHostImplTestHarness::SetUp(); 169 RenderViewHostImplTestHarness::SetUp();
171 if (IsDelegatedRendererEnabled()) { 170 if (IsDelegatedRendererEnabled()) {
172 ImageTransportFactory::InitializeForUnitTests( 171 ImageTransportFactory::InitializeForUnitTests(
173 scoped_ptr<ui::ContextFactory>(new ui::InProcessContextFactory)); 172 scoped_ptr<ImageTransportFactory>(
173 new NoTransportImageTransportFactory));
174 } 174 }
175 175
176 // TestRenderViewHost's destruction assumes that its view is a 176 // TestRenderViewHost's destruction assumes that its view is a
177 // TestRenderWidgetHostView, so store its view and reset it back to the 177 // TestRenderWidgetHostView, so store its view and reset it back to the
178 // stored view in |TearDown()|. 178 // stored view in |TearDown()|.
179 old_rwhv_ = rvh()->GetView(); 179 old_rwhv_ = rvh()->GetView();
180 180
181 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|. 181 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa_|.
182 rwhv_mac_ = new RenderWidgetHostViewMac(rvh()); 182 rwhv_mac_ = new RenderWidgetHostViewMac(rvh());
183 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]); 183 rwhv_cocoa_.reset([rwhv_mac_->cocoa_view() retain]);
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 host->OnMessageReceived(*response2); 777 host->OnMessageReceived(*response2);
778 778
779 // Check that the view delegate ignored the empty unhandled wheel event. 779 // Check that the view delegate ignored the empty unhandled wheel event.
780 ASSERT_EQ(NO, view_delegate.get().unhandledWheelEventReceived); 780 ASSERT_EQ(NO, view_delegate.get().unhandledWheelEventReceived);
781 781
782 // Clean up. 782 // Clean up.
783 host->Shutdown(); 783 host->Shutdown();
784 } 784 }
785 785
786 } // namespace content 786 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698