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