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

Side by Side Diff: content/test/layouttest_support.cc

Issue 5222955109842944: Add plumbing for platform based Device Motion testing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forward declare of WebDeviceMotionData Created 7 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
« no previous file with comments | « content/shell/renderer/webkit_test_runner.cc ('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/public/test/layouttest_support.h" 5 #include "content/public/test/layouttest_support.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "content/browser/renderer_host/render_widget_host_impl.h" 9 #include "content/browser/renderer_host/render_widget_host_impl.h"
10 #include "content/common/gpu/image_transport_surface.h" 10 #include "content/common/gpu/image_transport_surface.h"
11 #include "content/renderer/render_thread_impl.h" 11 #include "content/renderer/render_thread_impl.h"
12 #include "content/renderer/render_view_impl.h" 12 #include "content/renderer/render_view_impl.h"
13 #include "content/renderer/renderer_webkitplatformsupport_impl.h" 13 #include "content/renderer/renderer_webkitplatformsupport_impl.h"
14 #include "content/test/test_media_stream_client.h" 14 #include "content/test/test_media_stream_client.h"
15 #include "third_party/WebKit/public/platform/WebDeviceMotionData.h"
15 #include "third_party/WebKit/public/platform/WebGamepads.h" 16 #include "third_party/WebKit/public/platform/WebGamepads.h"
16 #include "third_party/WebKit/public/testing/WebFrameTestProxy.h" 17 #include "third_party/WebKit/public/testing/WebFrameTestProxy.h"
17 #include "third_party/WebKit/public/testing/WebTestProxy.h" 18 #include "third_party/WebKit/public/testing/WebTestProxy.h"
18 19
19 #if defined(OS_WIN) && !defined(USE_AURA) 20 #if defined(OS_WIN) && !defined(USE_AURA)
20 #include "content/browser/web_contents/web_contents_drag_win.h" 21 #include "content/browser/web_contents/web_contents_drag_win.h"
21 #endif 22 #endif
22 23
23 #if defined(OS_MACOSX) 24 #if defined(OS_MACOSX)
24 #include "content/browser/renderer_host/popup_menu_helper_mac.h" 25 #include "content/browser/renderer_host/popup_menu_helper_mac.h"
25 #endif 26 #endif
26 27
28 using WebKit::WebDeviceMotionData;
27 using WebKit::WebGamepads; 29 using WebKit::WebGamepads;
28 using WebKit::WebRect; 30 using WebKit::WebRect;
29 using WebKit::WebSize; 31 using WebKit::WebSize;
30 using WebTestRunner::WebFrameTestProxy; 32 using WebTestRunner::WebFrameTestProxy;
31 using WebTestRunner::WebTestProxy; 33 using WebTestRunner::WebTestProxy;
32 using WebTestRunner::WebTestProxyBase; 34 using WebTestRunner::WebTestProxyBase;
33 35
34 namespace content { 36 namespace content {
35 37
36 namespace { 38 namespace {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) { 72 const base::Callback<void(RenderView*, WebTestProxyBase*)>& callback) {
71 g_callback.Get() = callback; 73 g_callback.Get() = callback;
72 RenderViewImpl::InstallCreateHook(CreateWebTestProxy); 74 RenderViewImpl::InstallCreateHook(CreateWebTestProxy);
73 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy); 75 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy);
74 } 76 }
75 77
76 void SetMockGamepads(const WebGamepads& pads) { 78 void SetMockGamepads(const WebGamepads& pads) {
77 RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(pads); 79 RendererWebKitPlatformSupportImpl::SetMockGamepadsForTesting(pads);
78 } 80 }
79 81
82 void SetMockDeviceMotionData(const WebDeviceMotionData& data) {
83 RendererWebKitPlatformSupportImpl::SetMockDeviceMotionDataForTesting(data);
84 }
85
80 void EnableRendererLayoutTestMode() { 86 void EnableRendererLayoutTestMode() {
81 RenderThreadImpl::current()->set_layout_test_mode(true); 87 RenderThreadImpl::current()->set_layout_test_mode(true);
82 } 88 }
83 89
84 void EnableBrowserLayoutTestMode() { 90 void EnableBrowserLayoutTestMode() {
85 #if defined(OS_MACOSX) 91 #if defined(OS_MACOSX)
86 ImageTransportSurface::SetAllowOSMesaForTesting(true); 92 ImageTransportSurface::SetAllowOSMesaForTesting(true);
87 PopupMenuHelper::DontShowPopupMenuForTesting(); 93 PopupMenuHelper::DontShowPopupMenuForTesting();
88 #elif defined(OS_WIN) && !defined(USE_AURA) 94 #elif defined(OS_WIN) && !defined(USE_AURA)
89 WebContentsDragWin::DisableDragDropForTesting(); 95 WebContentsDragWin::DisableDragDropForTesting();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 ->DisableAutoResizeForTesting(new_size); 137 ->DisableAutoResizeForTesting(new_size);
132 } 138 }
133 139
134 void UseMockMediaStreams(RenderView* render_view) { 140 void UseMockMediaStreams(RenderView* render_view) {
135 RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view); 141 RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view);
136 render_view_impl->SetMediaStreamClientForTesting( 142 render_view_impl->SetMediaStreamClientForTesting(
137 new TestMediaStreamClient(render_view_impl)); 143 new TestMediaStreamClient(render_view_impl));
138 } 144 }
139 145
140 } // namespace content 146 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/webkit_test_runner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698