Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / content / test / layouttest_support.cc
blob74a2e8344b8a73934c17ec441b5b7a0cac2214e6
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/common/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 RenderThreadImpl::current()->EnsureWebKitInitialized();
96 std::vector<std::string> files = switches::GetSideloadFontFiles();
97 for (std::vector<std::string>::const_iterator i(files.begin());
98 i != files.end();
99 ++i) {
100 SkTypeface* typeface = fontmgr->createFromFile(i->c_str());
101 DoPreSandboxWarmupForTypeface(typeface);
102 blink::WebFontRendering::addSideloadedFontForTesting(typeface);
105 #endif // OS_WIN
107 } // namespace
109 void EnableWebTestProxyCreation(
110 const base::Callback<void(RenderView*, test_runner::WebTestProxyBase*)>&
111 callback) {
112 g_callback.Get() = callback;
113 RenderViewImpl::InstallCreateHook(CreateWebTestProxy);
114 RenderFrameImpl::InstallCreateHook(CreateWebFrameTestProxy);
117 void FetchManifestDoneCallback(
118 scoped_ptr<ManifestFetcher> fetcher,
119 const FetchManifestCallback& callback,
120 const blink::WebURLResponse& response,
121 const std::string& data) {
122 // |fetcher| will be autodeleted here as it is going out of scope.
123 callback.Run(response, data);
126 void FetchManifest(blink::WebView* view, const GURL& url,
127 const FetchManifestCallback& callback) {
128 ManifestFetcher* fetcher = new ManifestFetcher(url);
129 scoped_ptr<ManifestFetcher> autodeleter(fetcher);
131 // Start is called on fetcher which is also bound to the callback.
132 // A raw pointer is used instead of a scoped_ptr as base::Passes passes
133 // ownership and thus nulls the scoped_ptr. On MSVS this happens before
134 // the call to Start, resulting in a crash.
135 fetcher->Start(view->mainFrame(),
136 false,
137 base::Bind(&FetchManifestDoneCallback,
138 base::Passed(&autodeleter),
139 callback));
142 void SetMockGamepadProvider(scoped_ptr<RendererGamepadProvider> provider) {
143 RenderThreadImpl::current()
144 ->blink_platform_impl()
145 ->SetPlatformEventObserverForTesting(
146 blink::WebPlatformEventGamepad,
147 provider.Pass());
150 void SetMockDeviceLightData(const double data) {
151 RendererBlinkPlatformImpl::SetMockDeviceLightDataForTesting(data);
154 void SetMockDeviceMotionData(const WebDeviceMotionData& data) {
155 RendererBlinkPlatformImpl::SetMockDeviceMotionDataForTesting(data);
158 void SetMockDeviceOrientationData(const WebDeviceOrientationData& data) {
159 RendererBlinkPlatformImpl::SetMockDeviceOrientationDataForTesting(data);
162 void MockBatteryStatusChanged(const WebBatteryStatus& status) {
163 RenderThreadImpl::current()
164 ->blink_platform_impl()
165 ->MockBatteryStatusChangedForTesting(status);
168 void EnableRendererLayoutTestMode() {
169 RenderThreadImpl::current()->set_layout_test_mode(true);
171 #if defined(OS_WIN)
172 if (gfx::win::ShouldUseDirectWrite())
173 RegisterSideloadedTypefaces(GetPreSandboxWarmupFontMgr());
174 #endif
177 void EnableBrowserLayoutTestMode() {
178 #if defined(OS_MACOSX)
179 ImageTransportSurface::SetAllowOSMesaForTesting(true);
180 PopupMenuHelper::DontShowPopupMenuForTesting();
181 #endif
182 RenderWidgetHostImpl::DisableResizeAckCheckForTesting();
185 int GetLocalSessionHistoryLength(RenderView* render_view) {
186 return static_cast<RenderViewImpl*>(render_view)->
187 GetLocalSessionHistoryLengthForTesting();
190 void SyncNavigationState(RenderView* render_view) {
191 static_cast<RenderViewImpl*>(render_view)->SendUpdateState();
194 void SetFocusAndActivate(RenderView* render_view, bool enable) {
195 static_cast<RenderViewImpl*>(render_view)->
196 SetFocusAndActivateForTesting(enable);
199 void ForceResizeRenderView(RenderView* render_view,
200 const WebSize& new_size) {
201 RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view);
202 render_view_impl->ForceResizeForTesting(new_size);
205 void SetDeviceScaleFactor(RenderView* render_view, float factor) {
206 static_cast<RenderViewImpl*>(render_view)->
207 SetDeviceScaleFactorForTesting(factor);
210 void SetDeviceColorProfile(RenderView* render_view, const std::string& name) {
211 if (name == "reset") {
212 static_cast<RenderViewImpl*>(render_view)->
213 ResetDeviceColorProfileForTesting();
214 return;
217 std::vector<char> color_profile;
219 struct TestColorProfile {
220 char* data() {
221 static unsigned char color_profile_data[] = {
222 0x00,0x00,0x01,0xea,0x54,0x45,0x53,0x54,0x00,0x00,0x00,0x00,
223 0x6d,0x6e,0x74,0x72,0x52,0x47,0x42,0x20,0x58,0x59,0x5a,0x20,
224 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
225 0x61,0x63,0x73,0x70,0x74,0x65,0x73,0x74,0x00,0x00,0x00,0x00,
226 0x74,0x65,0x73,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
227 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf6,0xd6,
228 0x00,0x01,0x00,0x00,0x00,0x00,0xd3,0x2d,0x74,0x65,0x73,0x74,
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,0x00,
232 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x09,
233 0x63,0x70,0x72,0x74,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0x0d,
234 0x64,0x65,0x73,0x63,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x8c,
235 0x77,0x74,0x70,0x74,0x00,0x00,0x01,0x8c,0x00,0x00,0x00,0x14,
236 0x72,0x58,0x59,0x5a,0x00,0x00,0x01,0xa0,0x00,0x00,0x00,0x14,
237 0x67,0x58,0x59,0x5a,0x00,0x00,0x01,0xb4,0x00,0x00,0x00,0x14,
238 0x62,0x58,0x59,0x5a,0x00,0x00,0x01,0xc8,0x00,0x00,0x00,0x14,
239 0x72,0x54,0x52,0x43,0x00,0x00,0x01,0xdc,0x00,0x00,0x00,0x0e,
240 0x67,0x54,0x52,0x43,0x00,0x00,0x01,0xdc,0x00,0x00,0x00,0x0e,
241 0x62,0x54,0x52,0x43,0x00,0x00,0x01,0xdc,0x00,0x00,0x00,0x0e,
242 0x74,0x65,0x78,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
243 0x00,0x00,0x00,0x00,0x64,0x65,0x73,0x63,0x00,0x00,0x00,0x00,
244 0x00,0x00,0x00,0x10,0x77,0x68,0x61,0x63,0x6b,0x65,0x64,0x2e,
245 0x69,0x63,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
246 0x00,0x00,0x00,0x11,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 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
255 0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xf3,0x52,
256 0x00,0x01,0x00,0x00,0x00,0x01,0x16,0xcc,0x58,0x59,0x5a,0x20,
257 0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x8d,0x00,0x00,0xa0,0x2c,
258 0x00,0x00,0x0f,0x95,0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,
259 0x00,0x00,0x26,0x31,0x00,0x00,0x10,0x2f,0x00,0x00,0xbe,0x9b,
260 0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0x18,
261 0x00,0x00,0x4f,0xa5,0x00,0x00,0x04,0xfc,0x63,0x75,0x72,0x76,
262 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x33
265 return reinterpret_cast<char*>(color_profile_data);
268 size_t size() {
269 const size_t kTestColorProfileSizeInBytes = 490u;
270 return kTestColorProfileSizeInBytes;
274 struct AdobeRGBColorProfile {
275 char* data() {
276 static unsigned char color_profile_data[] = {
277 0x00,0x00,0x02,0x30,0x41,0x44,0x42,0x45,0x02,0x10,0x00,0x00,
278 0x6d,0x6e,0x74,0x72,0x52,0x47,0x42,0x20,0x58,0x59,0x5a,0x20,
279 0x07,0xd0,0x00,0x08,0x00,0x0b,0x00,0x13,0x00,0x33,0x00,0x3b,
280 0x61,0x63,0x73,0x70,0x41,0x50,0x50,0x4c,0x00,0x00,0x00,0x00,
281 0x6e,0x6f,0x6e,0x65,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
282 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf6,0xd6,
283 0x00,0x01,0x00,0x00,0x00,0x00,0xd3,0x2d,0x41,0x44,0x42,0x45,
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,0x00,
287 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0a,
288 0x63,0x70,0x72,0x74,0x00,0x00,0x00,0xfc,0x00,0x00,0x00,0x32,
289 0x64,0x65,0x73,0x63,0x00,0x00,0x01,0x30,0x00,0x00,0x00,0x6b,
290 0x77,0x74,0x70,0x74,0x00,0x00,0x01,0x9c,0x00,0x00,0x00,0x14,
291 0x62,0x6b,0x70,0x74,0x00,0x00,0x01,0xb0,0x00,0x00,0x00,0x14,
292 0x72,0x54,0x52,0x43,0x00,0x00,0x01,0xc4,0x00,0x00,0x00,0x0e,
293 0x67,0x54,0x52,0x43,0x00,0x00,0x01,0xd4,0x00,0x00,0x00,0x0e,
294 0x62,0x54,0x52,0x43,0x00,0x00,0x01,0xe4,0x00,0x00,0x00,0x0e,
295 0x72,0x58,0x59,0x5a,0x00,0x00,0x01,0xf4,0x00,0x00,0x00,0x14,
296 0x67,0x58,0x59,0x5a,0x00,0x00,0x02,0x08,0x00,0x00,0x00,0x14,
297 0x62,0x58,0x59,0x5a,0x00,0x00,0x02,0x1c,0x00,0x00,0x00,0x14,
298 0x74,0x65,0x78,0x74,0x00,0x00,0x00,0x00,0x43,0x6f,0x70,0x79,
299 0x72,0x69,0x67,0x68,0x74,0x20,0x32,0x30,0x30,0x30,0x20,0x41,
300 0x64,0x6f,0x62,0x65,0x20,0x53,0x79,0x73,0x74,0x65,0x6d,0x73,
301 0x20,0x49,0x6e,0x63,0x6f,0x72,0x70,0x6f,0x72,0x61,0x74,0x65,
302 0x64,0x00,0x00,0x00,0x64,0x65,0x73,0x63,0x00,0x00,0x00,0x00,
303 0x00,0x00,0x00,0x11,0x41,0x64,0x6f,0x62,0x65,0x20,0x52,0x47,
304 0x42,0x20,0x28,0x31,0x39,0x39,0x38,0x29,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,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
311 0x00,0x00,0x00,0x00,0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,
312 0x00,0x00,0xf3,0x51,0x00,0x01,0x00,0x00,0x00,0x01,0x16,0xcc,
313 0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
314 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x75,0x72,0x76,
315 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x33,0x00,0x00,
316 0x63,0x75,0x72,0x76,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
317 0x02,0x33,0x00,0x00,0x63,0x75,0x72,0x76,0x00,0x00,0x00,0x00,
318 0x00,0x00,0x00,0x01,0x02,0x33,0x00,0x00,0x58,0x59,0x5a,0x20,
319 0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0x18,0x00,0x00,0x4f,0xa5,
320 0x00,0x00,0x04,0xfc,0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,
321 0x00,0x00,0x34,0x8d,0x00,0x00,0xa0,0x2c,0x00,0x00,0x0f,0x95,
322 0x58,0x59,0x5a,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x31,
323 0x00,0x00,0x10,0x2f,0x00,0x00,0xbe,0x9c
326 return reinterpret_cast<char*>(color_profile_data);
329 size_t size() {
330 const size_t kAdobeRGBColorProfileSizeInBytes = 560u;
331 return kAdobeRGBColorProfileSizeInBytes;
335 if (name == "sRGB") {
336 color_profile.assign(name.data(), name.data() + name.size());
337 } else if (name == "test") {
338 TestColorProfile test;
339 color_profile.assign(test.data(), test.data() + test.size());
340 } else if (name == "adobeRGB") {
341 AdobeRGBColorProfile test;
342 color_profile.assign(test.data(), test.data() + test.size());
345 static_cast<RenderViewImpl*>(render_view)->
346 SetDeviceColorProfileForTesting(color_profile);
349 void SetBluetoothAdapter(int render_process_id,
350 scoped_refptr<device::BluetoothAdapter> adapter) {
351 RenderProcessHostImpl* render_process_host_impl =
352 static_cast<RenderProcessHostImpl*>(
353 RenderProcessHost::FromID(render_process_id));
355 BluetoothDispatcherHost* dispatcher_host =
356 render_process_host_impl->GetBluetoothDispatcherHost();
358 if (dispatcher_host != NULL)
359 dispatcher_host->SetBluetoothAdapterForTesting(adapter.Pass());
362 void SetGeofencingMockProvider(bool service_available) {
363 static_cast<WebGeofencingProviderImpl*>(
364 RenderThreadImpl::current()->blink_platform_impl()->geofencingProvider())
365 ->SetMockProvider(service_available);
368 void ClearGeofencingMockProvider() {
369 static_cast<WebGeofencingProviderImpl*>(
370 RenderThreadImpl::current()->blink_platform_impl()->geofencingProvider())
371 ->ClearMockProvider();
374 void SetGeofencingMockPosition(double latitude, double longitude) {
375 static_cast<WebGeofencingProviderImpl*>(
376 RenderThreadImpl::current()->blink_platform_impl()->geofencingProvider())
377 ->SetMockPosition(latitude, longitude);
380 void UseSynchronousResizeMode(RenderView* render_view, bool enable) {
381 static_cast<RenderViewImpl*>(render_view)->
382 UseSynchronousResizeModeForTesting(enable);
385 void EnableAutoResizeMode(RenderView* render_view,
386 const WebSize& min_size,
387 const WebSize& max_size) {
388 static_cast<RenderViewImpl*>(render_view)->
389 EnableAutoResizeForTesting(min_size, max_size);
392 void DisableAutoResizeMode(RenderView* render_view, const WebSize& new_size) {
393 static_cast<RenderViewImpl*>(render_view)->
394 DisableAutoResizeForTesting(new_size);
397 struct ToLower {
398 base::char16 operator()(base::char16 c) { return tolower(c); }
401 // Returns True if node1 < node2.
402 bool HistoryEntryCompareLess(HistoryEntry::HistoryNode* node1,
403 HistoryEntry::HistoryNode* node2) {
404 base::string16 target1 = node1->item().target();
405 base::string16 target2 = node2->item().target();
406 std::transform(target1.begin(), target1.end(), target1.begin(), ToLower());
407 std::transform(target2.begin(), target2.end(), target2.begin(), ToLower());
408 return target1 < target2;
411 std::string DumpHistoryItem(HistoryEntry::HistoryNode* node,
412 int indent,
413 bool is_current_index) {
414 std::string result;
416 const blink::WebHistoryItem& item = node->item();
417 if (is_current_index) {
418 result.append("curr->");
419 result.append(indent - 6, ' '); // 6 == "curr->".length()
420 } else {
421 result.append(indent, ' ');
424 std::string url =
425 test_runner::NormalizeLayoutTestURL(item.urlString().utf8());
426 result.append(url);
427 if (!item.target().isEmpty()) {
428 result.append(" (in frame \"");
429 result.append(item.target().utf8());
430 result.append("\")");
432 result.append("\n");
434 std::vector<HistoryEntry::HistoryNode*> children = node->children();
435 if (!children.empty()) {
436 std::sort(children.begin(), children.end(), HistoryEntryCompareLess);
437 for (size_t i = 0; i < children.size(); ++i)
438 result += DumpHistoryItem(children[i], indent + 4, false);
441 return result;
444 std::string DumpBackForwardList(std::vector<PageState>& page_state,
445 size_t current_index) {
446 std::string result;
447 result.append("\n============== Back Forward List ==============\n");
448 for (size_t index = 0; index < page_state.size(); ++index) {
449 scoped_ptr<HistoryEntry> entry(
450 PageStateToHistoryEntry(page_state[index]));
451 result.append(
452 DumpHistoryItem(entry->root_history_node(),
454 index == current_index));
456 result.append("===============================================\n");
457 return result;
460 } // namespace content