OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/shell/renderer/test_runner/web_test_proxy.h" | 5 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
6 | 6 |
7 #include <cctype> | 7 #include <cctype> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 return result; | 288 return result; |
289 } | 289 } |
290 | 290 |
291 std::string DumpFramesAsPrintedText(blink::WebFrame* frame, bool recursive) { | 291 std::string DumpFramesAsPrintedText(blink::WebFrame* frame, bool recursive) { |
292 // Cannot do printed format for anything other than HTML | 292 // Cannot do printed format for anything other than HTML |
293 if (!frame->document().isHTMLDocument()) | 293 if (!frame->document().isHTMLDocument()) |
294 return std::string(); | 294 return std::string(); |
295 | 295 |
296 std::string result = DumpFrameHeaderIfNeeded(frame); | 296 std::string result = DumpFrameHeaderIfNeeded(frame); |
297 result.append( | 297 result.append( |
298 frame->renderTreeAsText(blink::WebFrame::RenderAsTextPrinting).utf8()); | 298 frame->layoutTreeAsText(blink::WebFrame::LayoutAsTextPrinting).utf8()); |
299 result.append("\n"); | 299 result.append("\n"); |
300 | 300 |
301 if (recursive) { | 301 if (recursive) { |
302 for (blink::WebFrame* child = frame->firstChild(); child; | 302 for (blink::WebFrame* child = frame->firstChild(); child; |
303 child = child->nextSibling()) | 303 child = child->nextSibling()) |
304 result.append(DumpFramesAsPrintedText(child, recursive)); | 304 result.append(DumpFramesAsPrintedText(child, recursive)); |
305 } | 305 } |
306 | 306 |
307 return result; | 307 return result; |
308 } | 308 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 DumpFramesAsPrintedText(frame, recursive) : | 431 DumpFramesAsPrintedText(frame, recursive) : |
432 DumpFramesAsText(frame, recursive); | 432 DumpFramesAsText(frame, recursive); |
433 } else if (should_dump_as_markup) { | 433 } else if (should_dump_as_markup) { |
434 bool recursive = | 434 bool recursive = |
435 test_interfaces_->GetTestRunner()->shouldDumpChildFramesAsMarkup(); | 435 test_interfaces_->GetTestRunner()->shouldDumpChildFramesAsMarkup(); |
436 // Append a newline for the test driver. | 436 // Append a newline for the test driver. |
437 data_utf8 = DumpFramesAsMarkup(frame, recursive); | 437 data_utf8 = DumpFramesAsMarkup(frame, recursive); |
438 } else { | 438 } else { |
439 bool recursive = test_interfaces_->GetTestRunner() | 439 bool recursive = test_interfaces_->GetTestRunner() |
440 ->shouldDumpChildFrameScrollPositions(); | 440 ->shouldDumpChildFrameScrollPositions(); |
441 blink::WebFrame::RenderAsTextControls render_text_behavior = | 441 blink::WebFrame::LayoutAsTextControls layout_text_behavior = |
442 blink::WebFrame::RenderAsTextNormal; | 442 blink::WebFrame::LayoutAsTextNormal; |
443 if (should_dump_as_printed) | 443 if (should_dump_as_printed) |
444 render_text_behavior |= blink::WebFrame::RenderAsTextPrinting; | 444 layout_text_behavior |= blink::WebFrame::LayoutAsTextPrinting; |
445 if (debug_render_tree) | 445 if (debug_render_tree) |
446 render_text_behavior |= blink::WebFrame::RenderAsTextDebug; | 446 layout_text_behavior |= blink::WebFrame::LayoutAsTextDebug; |
447 data_utf8 = frame->renderTreeAsText(render_text_behavior).utf8(); | 447 data_utf8 = frame->layoutTreeAsText(layout_text_behavior).utf8(); |
448 data_utf8 += DumpFrameScrollPosition(frame, recursive); | 448 data_utf8 += DumpFrameScrollPosition(frame, recursive); |
449 } | 449 } |
450 | 450 |
451 if (test_interfaces_->GetTestRunner()->ShouldDumpBackForwardList()) | 451 if (test_interfaces_->GetTestRunner()->ShouldDumpBackForwardList()) |
452 data_utf8 += DumpAllBackForwardLists(test_interfaces_, delegate_); | 452 data_utf8 += DumpAllBackForwardLists(test_interfaces_, delegate_); |
453 | 453 |
454 return data_utf8; | 454 return data_utf8; |
455 } | 455 } |
456 | 456 |
457 void WebTestProxyBase::DrawSelectionRect(SkCanvas* canvas) { | 457 void WebTestProxyBase::DrawSelectionRect(SkCanvas* canvas) { |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 // to cancel the input method's ongoing composition session. | 1313 // to cancel the input method's ongoing composition session. |
1314 if (web_widget_) | 1314 if (web_widget_) |
1315 web_widget_->confirmComposition(); | 1315 web_widget_->confirmComposition(); |
1316 } | 1316 } |
1317 | 1317 |
1318 blink::WebString WebTestProxyBase::acceptLanguages() { | 1318 blink::WebString WebTestProxyBase::acceptLanguages() { |
1319 return blink::WebString::fromUTF8(accept_languages_); | 1319 return blink::WebString::fromUTF8(accept_languages_); |
1320 } | 1320 } |
1321 | 1321 |
1322 } // namespace content | 1322 } // namespace content |
OLD | NEW |