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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 95 |
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 std::vector<std::string> files = switches::GetSideloadFontFiles(); | 100 std::vector<std::string> files = switches::GetSideloadFontFiles(); |
102 for (std::vector<std::string>::const_iterator i(files.begin()); | 101 for (std::vector<std::string>::const_iterator i(files.begin()); |
103 i != files.end(); | 102 i != files.end(); |
104 ++i) { | 103 ++i) { |
105 SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); | 104 SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); |
106 if (!ShouldUseDirectWriteFontProxyFieldTrial()) | |
107 DoPreSandboxWarmupForTypeface(typeface); | |
108 blink::WebFontRendering::addSideloadedFontForTesting(typeface); | 105 blink::WebFontRendering::addSideloadedFontForTesting(typeface); |
109 } | 106 } |
110 } | 107 } |
111 #endif // OS_WIN | 108 #endif // OS_WIN |
112 | 109 |
113 } // namespace | 110 } // namespace |
114 | 111 |
115 void EnableWebTestProxyCreation( | 112 void EnableWebTestProxyCreation( |
116 const base::Callback<void(RenderView*, test_runner::WebTestProxyBase*)>& | 113 const base::Callback<void(RenderView*, test_runner::WebTestProxyBase*)>& |
117 callback) { | 114 callback) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 159 |
163 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { | 160 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) { |
164 RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(data); | 161 RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(data); |
165 } | 162 } |
166 | 163 |
167 void EnableRendererLayoutTestMode() { | 164 void EnableRendererLayoutTestMode() { |
168 RenderThreadImpl::current()->set_layout_test_mode(true); | 165 RenderThreadImpl::current()->set_layout_test_mode(true); |
169 | 166 |
170 #if defined(OS_WIN) | 167 #if defined(OS_WIN) |
171 if (gfx::win::ShouldUseDirectWrite()) { | 168 if (gfx::win::ShouldUseDirectWrite()) { |
172 if (ShouldUseDirectWriteFontProxyFieldTrial()) | 169 RegisterSideloadedTypefaces(SkFontMgr_New_DirectWrite()); |
173 RegisterSideloadedTypefaces(SkFontMgr_New_DirectWrite()); | |
174 else | |
175 RegisterSideloadedTypefaces(GetPreSandboxWarmupFontMgr()); | |
176 } | 170 } |
177 #endif | 171 #endif |
178 } | 172 } |
179 | 173 |
180 void EnableBrowserLayoutTestMode() { | 174 void EnableBrowserLayoutTestMode() { |
181 #if defined(OS_MACOSX) | 175 #if defined(OS_MACOSX) |
182 ImageTransportSurface::SetAllowOSMesaForTesting(true); | 176 ImageTransportSurface::SetAllowOSMesaForTesting(true); |
183 PopupMenuHelper::DontShowPopupMenuForTesting(); | 177 PopupMenuHelper::DontShowPopupMenuForTesting(); |
184 #endif | 178 #endif |
185 RenderWidgetHostImpl::DisableResizeAckCheckForTesting(); | 179 RenderWidgetHostImpl::DisableResizeAckCheckForTesting(); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 result.append( | 444 result.append( |
451 DumpHistoryItem(entry->root_history_node(), | 445 DumpHistoryItem(entry->root_history_node(), |
452 8, | 446 8, |
453 index == current_index)); | 447 index == current_index)); |
454 } | 448 } |
455 result.append("===============================================\n"); | 449 result.append("===============================================\n"); |
456 return result; | 450 return result; |
457 } | 451 } |
458 | 452 |
459 } // namespace content | 453 } // namespace content |
OLD | NEW |