Commit d6e4e9c5 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Remove the legacy/innerText switch for web test text dump

Now that we've changed all web tests to use Element.innerText for text
dump, this patch removes the relevant plumbing code to finish.

Bug: 887148
Change-Id: Ic5e83d3cbeabaaba58927eb78e9977763867c7a6
Reviewed-on: https://chromium-review.googlesource.com/c/1366487
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614833}
parent 6f5f5a4d
...@@ -60,9 +60,7 @@ std::string DumpLayout(WebLocalFrame* frame, const WebTestRuntimeFlags& flags) { ...@@ -60,9 +60,7 @@ std::string DumpLayout(WebLocalFrame* frame, const WebTestRuntimeFlags& flags) {
if (flags.dump_as_text()) { if (flags.dump_as_text()) {
result = DumpFrameHeaderIfNeeded(frame); result = DumpFrameHeaderIfNeeded(frame);
result += frame->GetDocument() result += frame->GetDocument().ContentAsTextForTesting().Utf8();
.ContentAsTextForTesting(flags.should_use_inner_text_dump())
.Utf8();
result += "\n"; result += "\n";
} else if (flags.dump_as_markup()) { } else if (flags.dump_as_markup()) {
DCHECK(!flags.is_printing()); DCHECK(!flags.is_printing());
......
...@@ -25,17 +25,6 @@ ...@@ -25,17 +25,6 @@
namespace test_runner { namespace test_runner {
namespace {
bool ShouldUseInnerTextDump(const std::string& test_path) {
// We are switching the text dump implementation to spec-conformant
// Element.innerText. To avoid gigantic patch, we control the rebaseline
// progress here in a per-directory manner.
// TODO(xiaochengh): Progressively allow more tests to use innerText.
// Remove this function once rebaseline is complete.
return true;
}
} // namespace
TestInterfaces::TestInterfaces() TestInterfaces::TestInterfaces()
: gamepad_controller_(new GamepadController()), : gamepad_controller_(new GamepadController()),
test_runner_(new TestRunner(this)), test_runner_(new TestRunner(this)),
...@@ -134,9 +123,6 @@ void TestInterfaces::ConfigureForTestWithURL(const blink::WebURL& test_url, ...@@ -134,9 +123,6 @@ void TestInterfaces::ConfigureForTestWithURL(const blink::WebURL& test_url,
spec.find("://web-platform.test") != std::string::npos || spec.find("://web-platform.test") != std::string::npos ||
spec.find("/harness-tests/wpt/") != std::string::npos) spec.find("/harness-tests/wpt/") != std::string::npos)
test_runner_->set_is_web_platform_tests_mode(); test_runner_->set_is_web_platform_tests_mode();
const bool should_use_inner_text = ShouldUseInnerTextDump(spec);
test_runner_->SetShouldUseInnerTextDump(should_use_inner_text);
} }
void TestInterfaces::WindowOpened(WebViewTestProxyBase* proxy) { void TestInterfaces::WindowOpened(WebViewTestProxyBase* proxy) {
......
...@@ -2457,11 +2457,6 @@ void TestRunner::SetShouldStayOnPageAfterHandlingBeforeUnload(bool value) { ...@@ -2457,11 +2457,6 @@ void TestRunner::SetShouldStayOnPageAfterHandlingBeforeUnload(bool value) {
OnWebTestRuntimeFlagsChanged(); OnWebTestRuntimeFlagsChanged();
} }
void TestRunner::SetShouldUseInnerTextDump(bool value) {
web_test_runtime_flags_.set_should_use_inner_text_dump(value);
OnWebTestRuntimeFlagsChanged();
}
void TestRunner::SetWillSendRequestClearHeader(const std::string& header) { void TestRunner::SetWillSendRequestClearHeader(const std::string& header) {
if (!header.empty()) if (!header.empty())
http_headers_to_clear_.insert(header); http_headers_to_clear_.insert(header);
......
...@@ -168,8 +168,6 @@ class TestRunner : public WebTestRunner { ...@@ -168,8 +168,6 @@ class TestRunner : public WebTestRunner {
bool ShouldDumpJavaScriptDialogs() const; bool ShouldDumpJavaScriptDialogs() const;
void SetShouldUseInnerTextDump(bool value);
blink::WebEffectiveConnectionType effective_connection_type() const { blink::WebEffectiveConnectionType effective_connection_type() const {
return effective_connection_type_; return effective_connection_type_;
} }
......
...@@ -182,11 +182,6 @@ class TEST_RUNNER_EXPORT WebTestRuntimeFlags { ...@@ -182,11 +182,6 @@ class TEST_RUNNER_EXPORT WebTestRuntimeFlags {
// Contains text passed by the test to testRunner.setCustomTextOutput. // Contains text passed by the test to testRunner.setCustomTextOutput.
DEFINE_STRING_WEB_TEST_RUNTIME_FLAG(custom_text_output) DEFINE_STRING_WEB_TEST_RUNTIME_FLAG(custom_text_output)
// Controls which implementation to use for text dump, to help progressive
// rebaseline of web test text dumps.
// TODO(xiaochengh): Remove this flag when rebaseline is complete.
DEFINE_BOOL_WEB_TEST_RUNTIME_FLAG(should_use_inner_text_dump)
#undef DEFINE_BOOL_WEB_TEST_RUNTIME_FLAG #undef DEFINE_BOOL_WEB_TEST_RUNTIME_FLAG
#undef DEFINE_STRING_WEB_TEST_RUNTIME_FLAG #undef DEFINE_STRING_WEB_TEST_RUNTIME_FLAG
......
...@@ -95,13 +95,7 @@ class WebDocument : public WebNode { ...@@ -95,13 +95,7 @@ class WebDocument : public WebNode {
BLINK_EXPORT WebElement Body() const; BLINK_EXPORT WebElement Body() const;
BLINK_EXPORT WebElement Head(); BLINK_EXPORT WebElement Head();
BLINK_EXPORT WebString Title() const; BLINK_EXPORT WebString Title() const;
BLINK_EXPORT WebString ContentAsTextForTesting() const;
// |use_inner_text| controls which implementation to use for text dump,
// spec-conformant Element.innerText or legacy, to help progressive
// rebaseline of layout test text dumps.
// TODO(xiaochengh): Remove this flag when rebaseline is complete.
BLINK_EXPORT WebString ContentAsTextForTesting(bool use_inner_text) const;
BLINK_EXPORT WebElementCollection All(); BLINK_EXPORT WebElementCollection All();
BLINK_EXPORT void Forms(WebVector<WebFormElement>&) const; BLINK_EXPORT void Forms(WebVector<WebFormElement>&) const;
BLINK_EXPORT WebURL CompleteURL(const WebString&) const; BLINK_EXPORT WebURL CompleteURL(const WebString&) const;
......
...@@ -154,21 +154,11 @@ WebString WebDocument::Title() const { ...@@ -154,21 +154,11 @@ WebString WebDocument::Title() const {
return WebString(ConstUnwrap<Document>()->title()); return WebString(ConstUnwrap<Document>()->title());
} }
WebString WebDocument::ContentAsTextForTesting(bool use_inner_text) const { WebString WebDocument::ContentAsTextForTesting() const {
Element* document_element = ConstUnwrap<Document>()->documentElement(); Element* document_element = ConstUnwrap<Document>()->documentElement();
if (!document_element) if (!document_element)
return WebString(); return WebString();
if (use_inner_text) return document_element->innerText();
return document_element->innerText();
// TODO(editing-dev): We should use |Element::innerText()|.
const_cast<Document*>(ConstUnwrap<Document>())
->UpdateStyleAndLayoutIgnorePendingStylesheetsForNode(document_element);
if (!document_element->GetLayoutObject())
return document_element->textContent(true);
return WebString(
PlainText(EphemeralRange::RangeOfContents(*document_element),
TextIteratorBehavior::Builder().SetForInnerText(true).Build()));
} }
WebElementCollection WebDocument::All() { WebElementCollection WebDocument::All() {
......
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