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