cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / content / test / layouttest_support.cc
blob3679432dc236ac8207e285b0ca4065c4c47bea67
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
3 // found in the LICENSE file.
5 #include "content/public/test/layouttest_support.h"
7 #include "base/callback.h"
8 #include "base/lazy_instance.h"
9 #include "components/test_runner/test_common.h"
10 #include "components/test_runner/web_frame_test_proxy.h"
11 #include "components/test_runner/web_test_proxy.h"
12 #include "content/browser/bluetooth/bluetooth_dispatcher_host.h"
13 #include "content/browser/renderer_host/render_process_host_impl.h"
14 #include "content/browser/renderer_host/render_widget_host_impl.h"
15 #include "content/child/geofencing/web_geofencing_provider_impl.h"
16 #include "content/common/gpu/image_transport_surface.h"
17 #include "content/public/common/page_state.h"
18 #include "content/public/renderer/renderer_gamepad_provider.h"
19 #include "content/renderer/fetchers/manifest_fetcher.h"
20 #include "content/renderer/history_entry.h"
21 #include "content/renderer/history_serialization.h"
22 #include "content/renderer/render_frame_impl.h"
23 #include "content/renderer/render_thread_impl.h"
24 #include "content/renderer/render_view_impl.h"
25 #include "content/renderer/renderer_blink_platform_impl.h"
26 #include "content/shell/common/shell_switches.h"
27 #include "device/bluetooth/bluetooth_adapter.h"
28 #include "third_party/WebKit/public/platform/WebBatteryStatus.h"
29 #include "third_party/WebKit/public/platform/WebGamepads.h"
30 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionData.h"
31 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationData.h"
32 #include "third_party/WebKit/public/web/WebHistoryItem.h"
33 #include "third_party/WebKit/public/web/WebView.h"
35 #if defined(OS_MACOSX)
36 #include "content/browser/frame_host/popup_menu_helper_mac.h"
37 #elif defined(OS_WIN)
38 #include "content/renderer/render_font_warmup_win.h"
39 #include "third_party/WebKit/public/web/win/WebFontRendering.h"
40 #include "third_party/skia/include/ports/SkFontMgr.h"
41 #include "ui/gfx/win/direct_write.h"
42 #endif
44 using blink::WebBatteryStatus;
45 using blink::WebDeviceMotionData;
46 using blink::WebDeviceOrientationData;
47 using blink::WebGamepad;
48 using blink::WebGamepads;
49 using blink::WebRect;
50 using blink::WebSize;
52 namespace content {
54 namespace {
56 base::LazyInstance<
57 base::Callback<void(RenderView*, test_runner::WebTestProxyBase*)>>::Leaky
58 g_callback = LAZY_INSTANCE_INITIALIZER;
60 RenderViewImpl* CreateWebTestProxy(CompositorDependencies* compositor_deps,
61 const ViewMsg_New_Params& params) {
62 typedef test_runner::WebTestProxy<RenderViewImpl, CompositorDependencies*,
63 const ViewMsg_New_Params&> ProxyType;
64 ProxyType* render_view_proxy = new ProxyType(compositor_deps, params);
65 if (g_callback == 0)
66 return render_view_proxy;
67 g_callback.Get().Run(render_view_proxy, render_view_proxy);
68 return render_view_proxy;
71 test_runner::WebTestProxyBase* GetWebTestProxyBase(
72 RenderViewImpl* render_view) {
73 typedef test_runner::WebTestProxy<RenderViewImpl, const ViewMsg_New_Params&>
74 ViewProxy;
76 ViewProxy* render_view_proxy = static_cast<ViewProxy*>(render_view);
77 return static_cast<test_runner::WebTestProxyBase*>(render_view_proxy);
80 RenderFrameImpl* CreateWebFrameTestProxy(
81 const RenderFrameImpl::CreateParams& params) {
82 typedef test_runner::WebFrameTestProxy<
83 RenderFrameImpl, const RenderFrameImpl::CreateParams&> FrameProxy;
85 FrameProxy* render_frame_proxy = new FrameProxy(params);
86 render_frame_proxy->set_base_proxy(GetWebTestProxyBase(params.render_view));
88 return render_frame_proxy;
91 #if defined(OS_WIN)
92 // DirectWrite only has access to %WINDIR%\Fonts by default. For developer
93 // side-loading, support kRegisterFontFiles to allow access to additional fonts.
94 void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) {
95 std::vector<std::string> files = switches::GetSideloadFontFiles();
96 for (std::vector<std::string>::const_iterator i(files.begin());
97 i != files.end();
98 ++i) {
99 SkTypeface* typeface = fontmgr->createFromFile(i->c_str());
100 DoPreSandboxWarmupForTypeface(typeface);
101 blink::WebFontRendering::addSideloadedFontForTesting(typeface);
104 #endif // OS_WIN
106 } // namespace
108 void EnableWebTestProxyCreation(
109 const base::Callback<void(RenderView*, test_runner::WebTestProxyBase*)>&
110 callback) {
111 g_callback.Get() = callback;
112 RenderViewImpl::InstallCreateHook(CreateWebTestProxy);
113 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy);
116 void FetchManifestDoneCallback(
117 scoped_ptr<ManifestFetcher> fetcher,
118 const FetchManifestCallback& callback,
119 const blink::WebURLResponse& response,
120 const std::string& data) {
121 // |fetcher| will be autodeleted here as it is going out of scope.
122 callback.Run(response, data);
125 void FetchManifest(blink::WebView* view, const GURL& url,
126 const FetchManifestCallback& callback) {
127 ManifestFetcher* fetcher = new ManifestFetcher(url);
128 scoped_ptr<ManifestFetcher> autodeleter(fetcher);
130 // Start is called on fetcher which is also bound to the callback.
131 // A raw pointer is used instead of a scoped_ptr as base::Passes passes
132 // ownership and thus nulls the scoped_ptr. On MSVS this happens before
133 // the call to Start, resulting in a crash.
134 fetcher->Start(view->mainFrame(),
135 false,
136 base::Bind(&FetchManifestDoneCallback,
137 base::Passed(&autodeleter),
138 callback));
141 void SetMockGamepadProvider(scoped_ptr<RendererGamepadProvider> provider) {
142 RenderThreadImpl::current()
143 ->blink_platform_impl()
144 ->SetPlatformEventObserverForTesting(
145 blink::WebPlatformEventGamepad,
146 provider.Pass());
149 void SetMockDeviceLightData(const double data) {
150 RendererBlinkPlatformImpl::SetMockDeviceLightDataForTesting(data);
153 void SetMockDeviceMotionData(const WebDeviceMotionData& data) {
154 RendererBlinkPlatformImpl::SetMockDeviceMotionDataForTesting(data);
157 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) {
158 RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(data);
161 void MockBatteryStatusChanged(const WebBatteryStatus& status) {
162 RenderThreadImpl::current()
163 ->blink_platform_impl()
164 ->MockBatteryStatusChangedForTesting(status);
167 void EnableRendererLayoutTestMode() {
168 RenderThreadImpl::current()->set_layout_test_mode(true);
170 #if defined(OS_WIN)
171 if (gfx::win::ShouldUseDirectWrite())
172 RegisterSideloadedTypefaces(GetPreSandboxWarmupFontMgr());
173 #endif
176 void EnableBrowserLayoutTestMode() {
177 #if defined(OS_MACOSX)
178 ImageTransportSurface::SetAllowOSMesaForTesting(true);
179 PopupMenuHelper::DontShowPopupMenuForTesting();
180 #endif
181 RenderWidgetHostImpl::DisableResizeAckCheckForTesting();
184 int GetLocalSessionHistoryLength(RenderView* render_view) {
185 return static_cast<RenderViewImpl*>(render_view)->
186 GetLocalSessionHistoryLengthForTesting();
189 void SyncNavigationState(RenderView* render_view) {
190 static_cast<RenderViewImpl*>(render_view)->SendUpdateState();
193 void SetFocusAndActivate(RenderView* render_view, bool enable) {
194 static_cast<RenderViewImpl*>(render_view)->
195 SetFocusAndActivateForTesting(enable);
198 void ForceResizeRenderView(RenderView* render_view,
199 const WebSize& new_size) {
200 RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view);
201 render_view_impl->ForceResizeForTesting(new_size);
204 void SetDeviceScaleFactor(RenderView* render_view, float factor) {
205 static_cast<RenderViewImpl*>(render_view)->
206 SetDeviceScaleFactorForTesting(factor);
209 void SetDeviceColorProfile(RenderView* render_view, const std::string& name) {
210 if (name == "reset") {
211 static_cast<RenderViewImpl*>(render_view)->
212 ResetDeviceColorProfileForTesting();
213 return;
216 std::vector<char> color_profile;
218 struct TestColorProfile {
219 char* data() {
220 static unsigned char color_profile_data[] = {
221 0x00,0x00,0x01,0xea,0x54,0x45,0x53,0x54,0x00,0x00,0x00,0x00,
222 0x6d,0x6e,0x74,0x72,0x52,0x47,0x42,0x20,0x58,0x59,0x5a,0x20,
223 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
224 0x61,0x63,0x73,0x70,0x74,0x65,0x73,0x74,0x00,0x00,0x00,0x00,
225 0x74,0x65,0x73,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
226 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf6,0xd6,
227 0x00,0x01,0x00,0x00,0x00,0x00,0xd3,0x2d,0x74,0x65,0x73,0x74,
228 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
229 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
230 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
231 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,
232 0x63,0x70,0x72,0x74,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x0d,
233 0x64,0x65,0x73,0x63,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x8c,
234 0x77,0x74,0x70,0x74,0x00,0x00,0x01,0x8c,0x00,0x00,0x00,0x14,
235 0x72,0x58,0x59,0x5a,0x00,0x00,0x01,0xa0,0x00,0x00,0x00,0x14,
236 0x67,0x58,0x59,0x5a,0x00,0x00,0x01,0xb4,0x00,0x00,0x00,0x14,
237 0x62,0x58,0x59,0x5a,0x00,0x00,0x01,0xc8,0x00,0x00,0x00,0x14,
238 0x72,0x54,0x52,0x43,0x00,0x00,0x01,0xdc,0x00,0x00,0x00,0x0e,
239 0x67,0x54,0x52,0x43,0x00,0x00,0x01,0xdc,0x00,0x00,0x00,0x0e,
240 0x62,0x54,0x52,0x43,0x00,0x00,0x01,0xdc,0x00,0x00,0x00,0x0e,
241 0x74,0x65,0x78,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
242 0x00,0x00,0x00,0x00,0x64,0x65,0x73,0x63,0x00,0x00,0x00,0x00,
243 0x00,0x00,0x00,0x10,0x77,0x68,0x61,0x63,0x6b,0x65,0x64,0x2e,
244 0x69,0x63,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
245 0x00,0x00,0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
246 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
247 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
248 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
249 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
250 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
251 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
252 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
253 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
254 0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xf3,0x52,
255 0x00,0x01,0x00,0x00,0x00,0x01,0x16,0xcc,0x58,0x59,0x5a,0x20,
256 0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x8d,0x00,0x00,0xa0,0x2c,
257 0x00,0x00,0x0f,0x95,0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,
258 0x00,0x00,0x26,0x31,0x00,0x00,0x10,0x2f,0x00,0x00,0xbe,0x9b,
259 0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0x18,
260 0x00,0x00,0x4f,0xa5,0x00,0x00,0x04,0xfc,0x63,0x75,0x72,0x76,
261 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x33
264 return reinterpret_cast<char*>(color_profile_data);
267 size_t size() {
268 const size_t kTestColorProfileSizeInBytes = 490u;
269 return kTestColorProfileSizeInBytes;
273 struct AdobeRGBColorProfile {
274 char* data() {
275 static unsigned char color_profile_data[] = {
276 0x00,0x00,0x02,0x30,0x41,0x44,0x42,0x45,0x02,0x10,0x00,0x00,
277 0x6d,0x6e,0x74,0x72,0x52,0x47,0x42,0x20,0x58,0x59,0x5a,0x20,
278 0x07,0xd0,0x00,0x08,0x00,0x0b,0x00,0x13,0x00,0x33,0x00,0x3b,
279 0x61,0x63,0x73,0x70,0x41,0x50,0x50,0x4c,0x00,0x00,0x00,0x00,
280 0x6e,0x6f,0x6e,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
281 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf6,0xd6,
282 0x00,0x01,0x00,0x00,0x00,0x00,0xd3,0x2d,0x41,0x44,0x42,0x45,
283 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
284 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
285 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
286 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,
287 0x63,0x70,0x72,0x74,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x32,
288 0x64,0x65,0x73,0x63,0x00,0x00,0x01,0x30,0x00,0x00,0x00,0x6b,
289 0x77,0x74,0x70,0x74,0x00,0x00,0x01,0x9c,0x00,0x00,0x00,0x14,
290 0x62,0x6b,0x70,0x74,0x00,0x00,0x01,0xb0,0x00,0x00,0x00,0x14,
291 0x72,0x54,0x52,0x43,0x00,0x00,0x01,0xc4,0x00,0x00,0x00,0x0e,
292 0x67,0x54,0x52,0x43,0x00,0x00,0x01,0xd4,0x00,0x00,0x00,0x0e,
293 0x62,0x54,0x52,0x43,0x00,0x00,0x01,0xe4,0x00,0x00,0x00,0x0e,
294 0x72,0x58,0x59,0x5a,0x00,0x00,0x01,0xf4,0x00,0x00,0x00,0x14,
295 0x67,0x58,0x59,0x5a,0x00,0x00,0x02,0x08,0x00,0x00,0x00,0x14,
296 0x62,0x58,0x59,0x5a,0x00,0x00,0x02,0x1c,0x00,0x00,0x00,0x14,
297 0x74,0x65,0x78,0x74,0x00,0x00,0x00,0x00,0x43,0x6f,0x70,0x79,
298 0x72,0x69,0x67,0x68,0x74,0x20,0x32,0x30,0x30,0x30,0x20,0x41,
299 0x64,0x6f,0x62,0x65,0x20,0x53,0x79,0x73,0x74,0x65,0x6d,0x73,
300 0x20,0x49,0x6e,0x63,0x6f,0x72,0x70,0x6f,0x72,0x61,0x74,0x65,
301 0x64,0x00,0x00,0x00,0x64,0x65,0x73,0x63,0x00,0x00,0x00,0x00,
302 0x00,0x00,0x00,0x11,0x41,0x64,0x6f,0x62,0x65,0x20,0x52,0x47,
303 0x42,0x20,0x28,0x31,0x39,0x39,0x38,0x29,0x00,0x00,0x00,0x00,
304 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
305 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
306 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
307 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
308 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
309 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
310 0x00,0x00,0x00,0x00,0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,
311 0x00,0x00,0xf3,0x51,0x00,0x01,0x00,0x00,0x00,0x01,0x16,0xcc,
312 0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
313 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x75,0x72,0x76,
314 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x33,0x00,0x00,
315 0x63,0x75,0x72,0x76,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
316 0x02,0x33,0x00,0x00,0x63,0x75,0x72,0x76,0x00,0x00,0x00,0x00,
317 0x00,0x00,0x00,0x01,0x02,0x33,0x00,0x00,0x58,0x59,0x5a,0x20,
318 0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0x18,0x00,0x00,0x4f,0xa5,
319 0x00,0x00,0x04,0xfc,0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,
320 0x00,0x00,0x34,0x8d,0x00,0x00,0xa0,0x2c,0x00,0x00,0x0f,0x95,
321 0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x31,
322 0x00,0x00,0x10,0x2f,0x00,0x00,0xbe,0x9c
325 return reinterpret_cast<char*>(color_profile_data);
328 size_t size() {
329 const size_t kAdobeRGBColorProfileSizeInBytes = 560u;
330 return kAdobeRGBColorProfileSizeInBytes;
334 if (name == "sRGB") {
335 color_profile.assign(name.data(), name.data() + name.size());
336 } else if (name == "test") {
337 TestColorProfile test;
338 color_profile.assign(test.data(), test.data() + test.size());
339 } else if (name == "adobeRGB") {
340 AdobeRGBColorProfile test;
341 color_profile.assign(test.data(), test.data() + test.size());
344 static_cast<RenderViewImpl*>(render_view)->
345 SetDeviceColorProfileForTesting(color_profile);
348 void SetBluetoothAdapter(int render_process_id,
349 scoped_refptr<device::BluetoothAdapter> adapter) {
350 RenderProcessHostImpl* render_process_host_impl =
351 static_cast<RenderProcessHostImpl*>(
352 RenderProcessHost::FromID(render_process_id));
354 BluetoothDispatcherHost* dispatcher_host =
355 render_process_host_impl->GetBluetoothDispatcherHost();
357 if (dispatcher_host != NULL)
358 dispatcher_host->SetBluetoothAdapterForTesting(adapter.Pass());
361 void SetGeofencingMockProvider(bool service_available) {
362 static_cast<WebGeofencingProviderImpl*>(
363 RenderThreadImpl::current()->blink_platform_impl()->geofencingProvider())
364 ->SetMockProvider(service_available);
367 void ClearGeofencingMockProvider() {
368 static_cast<WebGeofencingProviderImpl*>(
369 RenderThreadImpl::current()->blink_platform_impl()->geofencingProvider())
370 ->ClearMockProvider();
373 void SetGeofencingMockPosition(double latitude, double longitude) {
374 static_cast<WebGeofencingProviderImpl*>(
375 RenderThreadImpl::current()->blink_platform_impl()->geofencingProvider())
376 ->SetMockPosition(latitude, longitude);
379 void UseSynchronousResizeMode(RenderView* render_view, bool enable) {
380 static_cast<RenderViewImpl*>(render_view)->
381 UseSynchronousResizeModeForTesting(enable);
384 void EnableAutoResizeMode(RenderView* render_view,
385 const WebSize& min_size,
386 const WebSize& max_size) {
387 static_cast<RenderViewImpl*>(render_view)->
388 EnableAutoResizeForTesting(min_size, max_size);
391 void DisableAutoResizeMode(RenderView* render_view, const WebSize& new_size) {
392 static_cast<RenderViewImpl*>(render_view)->
393 DisableAutoResizeForTesting(new_size);
396 struct ToLower {
397 base::char16 operator()(base::char16 c) { return tolower(c); }
400 // Returns True if node1 < node2.
401 bool HistoryEntryCompareLess(HistoryEntry::HistoryNode* node1,
402 HistoryEntry::HistoryNode* node2) {
403 base::string16 target1 = node1->item().target();
404 base::string16 target2 = node2->item().target();
405 std::transform(target1.begin(), target1.end(), target1.begin(), ToLower());
406 std::transform(target2.begin(), target2.end(), target2.begin(), ToLower());
407 return target1 < target2;
410 std::string DumpHistoryItem(HistoryEntry::HistoryNode* node,
411 int indent,
412 bool is_current_index) {
413 std::string result;
415 const blink::WebHistoryItem& item = node->item();
416 if (is_current_index) {
417 result.append("curr->");
418 result.append(indent - 6, ' '); // 6 == "curr->".length()
419 } else {
420 result.append(indent, ' ');
423 std::string url =
424 test_runner::NormalizeLayoutTestURL(item.urlString().utf8());
425 result.append(url);
426 if (!item.target().isEmpty()) {
427 result.append(" (in frame \"");
428 result.append(item.target().utf8());
429 result.append("\")");
431 result.append("\n");
433 std::vector<HistoryEntry::HistoryNode*> children = node->children();
434 if (!children.empty()) {
435 std::sort(children.begin(), children.end(), HistoryEntryCompareLess);
436 for (size_t i = 0; i < children.size(); ++i)
437 result += DumpHistoryItem(children[i], indent + 4, false);
440 return result;
443 std::string DumpBackForwardList(std::vector<PageState>& page_state,
444 size_t current_index) {
445 std::string result;
446 result.append("\n============== Back Forward List ==============\n");
447 for (size_t index = 0; index < page_state.size(); ++index) {
448 scoped_ptr<HistoryEntry> entry(
449 PageStateToHistoryEntry(page_state[index]));
450 result.append(
451 DumpHistoryItem(entry->root_history_node(),
453 index == current_index));
455 result.append("===============================================\n");
456 return result;
459 } // namespace content