Commit 877ca101 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Stop proper code paths from using WebFrameContentDumper::DeprecatedDumpFrameTreeAsText

This patch removes all call sites of DeprecatedDumpFrameTreeAsText, except
the only one in ChromeRenderFrameObserver, which is improper. This is
a preparation for fixing ChromeRenderFrameObserver without affecting
other code paths.

Bug: 803403
Change-Id: I1873f3759533873a3068b45cc55743b4bb9758d6
Reviewed-on: https://chromium-review.googlesource.com/891543Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533186}
parent d39417a5
...@@ -228,9 +228,16 @@ WebString WebFrameContentDumper::DeprecatedDumpFrameTreeAsText( ...@@ -228,9 +228,16 @@ WebString WebFrameContentDumper::DeprecatedDumpFrameTreeAsText(
WebString WebFrameContentDumper::DumpWebViewAsText(WebView* web_view, WebString WebFrameContentDumper::DumpWebViewAsText(WebView* web_view,
size_t max_chars) { size_t max_chars) {
DCHECK(web_view); DCHECK(web_view);
WebLocalFrame* frame = web_view->MainFrame()->ToWebLocalFrame();
if (!frame)
return WebString();
web_view->UpdateAllLifecyclePhases(); web_view->UpdateAllLifecyclePhases();
return WebFrameContentDumper::DeprecatedDumpFrameTreeAsText(
web_view->MainFrame()->ToWebLocalFrame(), max_chars); StringBuilder text;
FrameContentAsPlainText(max_chars, ToWebLocalFrameImpl(frame)->GetFrame(),
text);
return text.ToString();
} }
WebString WebFrameContentDumper::DumpAsMarkup(WebLocalFrame* frame) { WebString WebFrameContentDumper::DumpAsMarkup(WebLocalFrame* frame) {
......
...@@ -891,8 +891,7 @@ TEST_P(FrameThrottlingTest, DumpThrottledFrame) { ...@@ -891,8 +891,7 @@ TEST_P(FrameThrottlingTest, DumpThrottledFrame) {
// The dumped contents should not include the throttled frame. // The dumped contents should not include the throttled frame.
DocumentLifecycle::AllowThrottlingScope throttling_scope( DocumentLifecycle::AllowThrottlingScope throttling_scope(
GetDocument().Lifecycle()); GetDocument().Lifecycle());
WebString result = WebFrameContentDumper::DeprecatedDumpFrameTreeAsText( WebString result = WebFrameContentDumper::DumpWebViewAsText(&WebView(), 1024);
WebView().MainFrameImpl(), 1024);
EXPECT_NE(std::string::npos, result.Utf8().find("main")); EXPECT_NE(std::string::npos, result.Utf8().find("main"));
EXPECT_EQ(std::string::npos, result.Utf8().find("throttled")); EXPECT_EQ(std::string::npos, result.Utf8().find("throttled"));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment