| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 if (recursive) { | 304 if (recursive) { |
| 305 for (blink::WebFrame* child = frame->firstChild(); child; | 305 for (blink::WebFrame* child = frame->firstChild(); child; |
| 306 child = child->nextSibling()) | 306 child = child->nextSibling()) |
| 307 result.append(DumpFramesAsMarkup(child, recursive)); | 307 result.append(DumpFramesAsMarkup(child, recursive)); |
| 308 } | 308 } |
| 309 | 309 |
| 310 return result; | 310 return result; |
| 311 } | 311 } |
| 312 | 312 |
| 313 std::string DumpDocumentText(blink::WebFrame* frame) { | 313 std::string DumpDocumentText(blink::WebFrame* frame) { |
| 314 // We use the document element's text instead of the body text here because | 314 return frame->document().contentAsTextForTesting().utf8(); |
| 315 // not all documents have a body, such as XML documents. | |
| 316 blink::WebElement document_element = frame->document().documentElement(); | |
| 317 if (document_element.isNull()) | |
| 318 return std::string(); | |
| 319 return document_element.innerText().utf8(); | |
| 320 } | 315 } |
| 321 | 316 |
| 322 std::string DumpFramesAsText(blink::WebFrame* frame, bool recursive) { | 317 std::string DumpFramesAsText(blink::WebFrame* frame, bool recursive) { |
| 323 std::string result = DumpFrameHeaderIfNeeded(frame); | 318 std::string result = DumpFrameHeaderIfNeeded(frame); |
| 324 result.append(DumpDocumentText(frame)); | 319 result.append(DumpDocumentText(frame)); |
| 325 result.append("\n"); | 320 result.append("\n"); |
| 326 | 321 |
| 327 if (recursive) { | 322 if (recursive) { |
| 328 for (blink::WebFrame* child = frame->firstChild(); child; | 323 for (blink::WebFrame* child = frame->firstChild(); child; |
| 329 child = child->nextSibling()) | 324 child = child->nextSibling()) |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 // to cancel the input method's ongoing composition session. | 1384 // to cancel the input method's ongoing composition session. |
| 1390 if (web_widget_) | 1385 if (web_widget_) |
| 1391 web_widget_->confirmComposition(); | 1386 web_widget_->confirmComposition(); |
| 1392 } | 1387 } |
| 1393 | 1388 |
| 1394 blink::WebString WebTestProxyBase::acceptLanguages() { | 1389 blink::WebString WebTestProxyBase::acceptLanguages() { |
| 1395 return blink::WebString::fromUTF8(accept_languages_); | 1390 return blink::WebString::fromUTF8(accept_languages_); |
| 1396 } | 1391 } |
| 1397 | 1392 |
| 1398 } // namespace content | 1393 } // namespace content |
| OLD | NEW |