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/public/test/layouttest_support.h" | 5 #include "content/public/test/layouttest_support.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "third_party/WebKit/public/platform/WebGamepads.h" | 34 #include "third_party/WebKit/public/platform/WebGamepads.h" |
35 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionData.h" | 35 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionData.h" |
36 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationData.h" | 36 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eOrientationData.h" |
37 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 37 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
38 #include "third_party/WebKit/public/web/WebView.h" | 38 #include "third_party/WebKit/public/web/WebView.h" |
39 | 39 |
40 #if defined(OS_MACOSX) | 40 #if defined(OS_MACOSX) |
41 #include "content/browser/frame_host/popup_menu_helper_mac.h" | 41 #include "content/browser/frame_host/popup_menu_helper_mac.h" |
42 #elif defined(OS_WIN) | 42 #elif defined(OS_WIN) |
43 #include "content/child/font_warmup_win.h" | 43 #include "content/child/font_warmup_win.h" |
44 #include "content/public/common/dwrite_font_platform_win.h" | |
45 #include "third_party/WebKit/public/web/win/WebFontRendering.h" | 44 #include "third_party/WebKit/public/web/win/WebFontRendering.h" |
46 #include "third_party/skia/include/ports/SkFontMgr.h" | 45 #include "third_party/skia/include/ports/SkFontMgr.h" |
47 #include "third_party/skia/include/ports/SkTypeface_win.h" | 46 #include "third_party/skia/include/ports/SkTypeface_win.h" |
48 #include "ui/gfx/win/direct_write.h" | 47 #include "ui/gfx/win/direct_write.h" |
49 #endif | 48 #endif |
50 | 49 |
51 using blink::WebDeviceMotionData; | 50 using blink::WebDeviceMotionData; |
52 using blink::WebDeviceOrientationData; | 51 using blink::WebDeviceOrientationData; |
53 using blink::WebGamepad; | 52 using blink::WebGamepad; |
54 using blink::WebGamepads; | 53 using blink::WebGamepads; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 #if defined(OS_WIN) | 96 #if defined(OS_WIN) |
98 // DirectWrite only has access to %WINDIR%\Fonts by default. For developer | 97 // DirectWrite only has access to %WINDIR%\Fonts by default. For developer |
99 // side-loading, support kRegisterFontFiles to allow access to additional fonts. | 98 // side-loading, support kRegisterFontFiles to allow access to additional fonts. |
100 void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) { | 99 void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) { |
101 RenderThreadImpl::current()->EnsureWebKitInitialized(); | 100 RenderThreadImpl::current()->EnsureWebKitInitialized(); |
102 std::vector<std::string> files = switches::GetSideloadFontFiles(); | 101 std::vector<std::string> files = switches::GetSideloadFontFiles(); |
103 for (std::vector<std::string>::const_iterator i(files.begin()); | 102 for (std::vector<std::string>::const_iterator i(files.begin()); |
104 i != files.end(); | 103 i != files.end(); |
105 ++i) { | 104 ++i) { |
106 SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); | 105 SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); |
107 if (!ShouldUseDirectWriteFontProxyFieldTrial()) | |
108 DoPreSandboxWarmupForTypeface(typeface); | |
109 blink::WebFontRendering::addSideloadedFontForTesting(typeface); | 106 blink::WebFontRendering::addSideloadedFontForTesting(typeface); |
110 } | 107 } |
111 } | 108 } |
112 #endif // OS_WIN | 109 #endif // OS_WIN |
113 | 110 |
114 } // namespace | 111 } // namespace |
115 | 112 |
116 void EnableWebTestProxyCreation( | 113 void EnableWebTestProxyCreation( |
117 const base::Callback<void(RenderView*, test_runner::WebTestProxyBase*)>& | 114 const base::Callback<void(RenderView*, test_runner::WebTestProxyBase*)>& |
118 callback) { | 115 callback) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 160 |
164 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { | 161 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { |
165 RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(data); | 162 RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(data); |
166 } | 163 } |
167 | 164 |
168 void EnableRendererLayoutTestMode() { | 165 void EnableRendererLayoutTestMode() { |
169 RenderThreadImpl::current()->set_layout_test_mode(true); | 166 RenderThreadImpl::current()->set_layout_test_mode(true); |
170 | 167 |
171 #if defined(OS_WIN) | 168 #if defined(OS_WIN) |
172 if (gfx::win::ShouldUseDirectWrite()) { | 169 if (gfx::win::ShouldUseDirectWrite()) { |
173 if (ShouldUseDirectWriteFontProxyFieldTrial()) | 170 RegisterSideloadedTypefaces(SkFontMgr_New_DirectWrite()); |
174 RegisterSideloadedTypefaces(SkFontMgr_New_DirectWrite()); | |
175 else | |
176 RegisterSideloadedTypefaces(GetPreSandboxWarmupFontMgr()); | |
177 } | 171 } |
178 #endif | 172 #endif |
179 } | 173 } |
180 | 174 |
181 void EnableBrowserLayoutTestMode() { | 175 void EnableBrowserLayoutTestMode() { |
182 #if defined(OS_MACOSX) | 176 #if defined(OS_MACOSX) |
183 ImageTransportSurface::SetAllowOSMesaForTesting(true); | 177 ImageTransportSurface::SetAllowOSMesaForTesting(true); |
184 PopupMenuHelper::DontShowPopupMenuForTesting(); | 178 PopupMenuHelper::DontShowPopupMenuForTesting(); |
185 #endif | 179 #endif |
186 RenderWidgetHostImpl::DisableResizeAckCheckForTesting(); | 180 RenderWidgetHostImpl::DisableResizeAckCheckForTesting(); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 result.append( | 445 result.append( |
452 DumpHistoryItem(entry->root_history_node(), | 446 DumpHistoryItem(entry->root_history_node(), |
453 8, | 447 8, |
454 index == current_index)); | 448 index == current_index)); |
455 } | 449 } |
456 result.append("===============================================\n"); | 450 result.append("===============================================\n"); |
457 return result; | 451 return result; |
458 } | 452 } |
459 | 453 |
460 } // namespace content | 454 } // namespace content |
OLD | NEW |