Commit fa4856f2 authored by Dmitry Gozman's avatar Dmitry Gozman Committed by Commit Bot

[web_test] Remove dumpResourceLoadCallbacks

There are jsut a handfull of tests which use it, and we only
dump wilLSendRequest anyway. All the tests do not gain any
meaningful results from it, while prefetch.html is completely
covered by prefetch-onload.html

Bug: none
Change-Id: I3cf80bee411fa94672f0585c7e38cdcad5806fad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1831466
Commit-Queue: Dmitry Gozman <dgozman@chromium.org>
Reviewed-by: default avatarNate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701344}
parent d99ca5d1
...@@ -176,7 +176,6 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> { ...@@ -176,7 +176,6 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> {
void DumpNavigationPolicy(); void DumpNavigationPolicy();
void DumpPermissionClientCallbacks(); void DumpPermissionClientCallbacks();
void DumpPingLoaderCallbacks(); void DumpPingLoaderCallbacks();
void DumpResourceLoadCallbacks();
void DumpSelectionRect(); void DumpSelectionRect();
void DumpSpellCheckCallbacks(); void DumpSpellCheckCallbacks();
void DumpTitleChanges(); void DumpTitleChanges();
...@@ -437,8 +436,6 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder( ...@@ -437,8 +436,6 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder(
&TestRunnerBindings::DumpPermissionClientCallbacks) &TestRunnerBindings::DumpPermissionClientCallbacks)
.SetMethod("dumpPingLoaderCallbacks", .SetMethod("dumpPingLoaderCallbacks",
&TestRunnerBindings::DumpPingLoaderCallbacks) &TestRunnerBindings::DumpPingLoaderCallbacks)
.SetMethod("dumpResourceLoadCallbacks",
&TestRunnerBindings::DumpResourceLoadCallbacks)
.SetMethod("dumpSelectionRect", &TestRunnerBindings::DumpSelectionRect) .SetMethod("dumpSelectionRect", &TestRunnerBindings::DumpSelectionRect)
.SetMethod("dumpSpellCheckCallbacks", .SetMethod("dumpSpellCheckCallbacks",
&TestRunnerBindings::DumpSpellCheckCallbacks) &TestRunnerBindings::DumpSpellCheckCallbacks)
...@@ -1039,11 +1036,6 @@ void TestRunnerBindings::SetCanOpenWindows() { ...@@ -1039,11 +1036,6 @@ void TestRunnerBindings::SetCanOpenWindows() {
runner_->SetCanOpenWindows(); runner_->SetCanOpenWindows();
} }
void TestRunnerBindings::DumpResourceLoadCallbacks() {
if (runner_)
runner_->DumpResourceLoadCallbacks();
}
void TestRunnerBindings::SetImagesAllowed(bool allowed) { void TestRunnerBindings::SetImagesAllowed(bool allowed) {
if (runner_) if (runner_)
runner_->SetImagesAllowed(allowed); runner_->SetImagesAllowed(allowed);
...@@ -1758,11 +1750,6 @@ bool TestRunner::CanOpenWindows() const { ...@@ -1758,11 +1750,6 @@ bool TestRunner::CanOpenWindows() const {
return web_test_runtime_flags_.can_open_windows(); return web_test_runtime_flags_.can_open_windows();
} }
bool TestRunner::ShouldDumpResourceLoadCallbacks() const {
return test_is_running_ &&
web_test_runtime_flags_.dump_resource_load_callbacks();
}
blink::WebContentSettingsClient* TestRunner::GetWebContentSettings() const { blink::WebContentSettingsClient* TestRunner::GetWebContentSettings() const {
return mock_content_settings_client_.get(); return mock_content_settings_client_.get();
} }
...@@ -2342,11 +2329,6 @@ void TestRunner::SetCanOpenWindows() { ...@@ -2342,11 +2329,6 @@ void TestRunner::SetCanOpenWindows() {
OnWebTestRuntimeFlagsChanged(); OnWebTestRuntimeFlagsChanged();
} }
void TestRunner::DumpResourceLoadCallbacks() {
web_test_runtime_flags_.set_dump_resource_load_callbacks(true);
OnWebTestRuntimeFlagsChanged();
}
void TestRunner::SetImagesAllowed(bool allowed) { void TestRunner::SetImagesAllowed(bool allowed) {
web_test_runtime_flags_.set_images_allowed(allowed); web_test_runtime_flags_.set_images_allowed(allowed);
OnWebTestRuntimeFlagsChanged(); OnWebTestRuntimeFlagsChanged();
......
...@@ -131,7 +131,6 @@ class TestRunner : public WebTestRunner { ...@@ -131,7 +131,6 @@ class TestRunner : public WebTestRunner {
bool ShouldDumpIconChanges() const; bool ShouldDumpIconChanges() const;
bool ShouldDumpCreateView() const; bool ShouldDumpCreateView() const;
bool CanOpenWindows() const; bool CanOpenWindows() const;
bool ShouldDumpResourceLoadCallbacks() const;
bool ShouldDumpSpellCheckCallbacks() const; bool ShouldDumpSpellCheckCallbacks() const;
bool ShouldWaitUntilExternalURLLoad() const; bool ShouldWaitUntilExternalURLLoad() const;
const std::set<std::string>* HttpHeadersToClear() const; const std::set<std::string>* HttpHeadersToClear() const;
...@@ -368,11 +367,6 @@ class TestRunner : public WebTestRunner { ...@@ -368,11 +367,6 @@ class TestRunner : public WebTestRunner {
void SetCanOpenWindows(); void SetCanOpenWindows();
// This function sets a flag that tells the test runner to dump a descriptive
// line for each resource load callback. It takes no arguments, and ignores
// any that may be present.
void DumpResourceLoadCallbacks();
// This function sets a flag that tells the test runner to dump the MIME type // This function sets a flag that tells the test runner to dump the MIME type
// for each resource that was loaded. It takes no arguments, and ignores any // for each resource that was loaded. It takes no arguments, and ignores any
// that may be present. // that may be present.
......
...@@ -409,20 +409,8 @@ void WebFrameTestClient::DidDispatchPingLoader(const blink::WebURL& url) { ...@@ -409,20 +409,8 @@ void WebFrameTestClient::DidDispatchPingLoader(const blink::WebURL& url) {
void WebFrameTestClient::WillSendRequest(blink::WebURLRequest& request) { void WebFrameTestClient::WillSendRequest(blink::WebURLRequest& request) {
// Need to use GURL for host() and SchemeIs() // Need to use GURL for host() and SchemeIs()
GURL url = request.Url(); GURL url = request.Url();
std::string request_url = url.possibly_invalid_spec();
GURL main_document_url = request.SiteForCookies(); GURL main_document_url = request.SiteForCookies();
if (test_runner()->ShouldDumpResourceLoadCallbacks()) {
delegate_->PrintMessage(DescriptionSuitableForTestResult(request_url));
delegate_->PrintMessage(" - willSendRequest <NSURLRequest URL ");
delegate_->PrintMessage(
DescriptionSuitableForTestResult(request_url).c_str());
delegate_->PrintMessage(", http method ");
delegate_->PrintMessage(request.HttpMethod().Utf8().data());
delegate_->PrintMessage(">\n");
}
if (test_runner()->HttpHeadersToClear()) { if (test_runner()->HttpHeadersToClear()) {
for (const std::string& header : *test_runner()->HttpHeadersToClear()) for (const std::string& header : *test_runner()->HttpHeadersToClear())
request.ClearHttpHeaderField(blink::WebString::FromUTF8(header)); request.ClearHttpHeaderField(blink::WebString::FromUTF8(header));
...@@ -438,7 +426,7 @@ void WebFrameTestClient::WillSendRequest(blink::WebURLRequest& request) { ...@@ -438,7 +426,7 @@ void WebFrameTestClient::WillSendRequest(blink::WebURLRequest& request) {
IsLocalHost(main_document_url.host())) && IsLocalHost(main_document_url.host())) &&
!delegate_->AllowExternalPages()) { !delegate_->AllowExternalPages()) {
delegate_->PrintMessage(std::string("Blocked access to external URL ") + delegate_->PrintMessage(std::string("Blocked access to external URL ") +
request_url + "\n"); url.possibly_invalid_spec() + "\n");
BlockRequest(request); BlockRequest(request);
return; return;
} }
......
HTMLLinkElement/prefetch.link - willSendRequest <NSURLRequest URL HTMLLinkElement/prefetch.link, http method GET>
This test requires DumpRenderTree to see the log of what resources are loaded.
SUCCESS! prefetch onload called.
<body>
<script>
function log(message) {
var item = document.createElement("li");
item.appendChild(document.createTextNode(message));
document.getElementById("console").appendChild(item);
}
function prefetch_onload() {
log("SUCCESS! prefetch onload called.");
testRunner.notifyDone();
}
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
testRunner.dumpResourceLoadCallbacks();
}
</script>
<html>
<p>This test requires DumpRenderTree to see the log of what resources are loaded.
<link href="prefetch.link" rel="prefetch" onload="prefetch_onload()">
<p><ol id="console"></ol>
</html>
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
if (window.testRunner) { if (window.testRunner) {
testRunner.dumpAsText(); testRunner.dumpAsText();
testRunner.waitUntilDone(); testRunner.waitUntilDone();
testRunner.dumpResourceLoadCallbacks();
} }
</script> </script>
</head> </head>
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
<script> <script>
if (window.testRunner) { if (window.testRunner) {
testRunner.dumpAsText(); testRunner.dumpAsText();
testRunner.dumpResourceLoadCallbacks();
testRunner.waitUntilDone(); testRunner.waitUntilDone();
} }
......
...@@ -5,7 +5,6 @@ function runTest() ...@@ -5,7 +5,6 @@ function runTest()
{ {
if (window.testRunner) { if (window.testRunner) {
testRunner.dumpAsText(); testRunner.dumpAsText();
testRunner.dumpResourceLoadCallbacks();
testRunner.setIconDatabaseEnabled(true); testRunner.setIconDatabaseEnabled(true);
testRunner.overridePreference("WebKitDisplayImagesKey", 0); testRunner.overridePreference("WebKitDisplayImagesKey", 0);
testRunner.queueReload(); testRunner.queueReload();
......
<html> <html>
<script> <script>
if (window.testRunner) { if (window.testRunner) {
testRunner.dumpResourceLoadCallbacks();
testRunner.waitUntilDone(); testRunner.waitUntilDone();
} }
</script> </script>
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
if (window.testRunner) { if (window.testRunner) {
testRunner.dumpAsText(); testRunner.dumpAsText();
testRunner.waitUntilDone(); testRunner.waitUntilDone();
testRunner.dumpResourceLoadCallbacks();
testRunner.dumpIconChanges(); testRunner.dumpIconChanges();
} }
......
CONSOLE ERROR: line 16: Refused to load the image 'http://localhost/foo?q=from_icon' because it violates the following Content Security Policy directive: "img-src 'none'". CONSOLE ERROR: line 15: Refused to load the image 'http://localhost/foo?q=from_icon' because it violates the following Content Security Policy directive: "img-src 'none'".
Use callbacks to show that favicons are not loaded in violation of CSP when link tags are dynamically added to the page. Use callbacks to show that favicons are not loaded in violation of CSP when link tags are dynamically added to the page.
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
if (window.testRunner) { if (window.testRunner) {
testRunner.dumpAsText(); testRunner.dumpAsText();
testRunner.waitUntilDone(); testRunner.waitUntilDone();
testRunner.dumpResourceLoadCallbacks();
testRunner.dumpIconChanges(); testRunner.dumpIconChanges();
} }
......
http://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255/test.jpg, http method GET>
This test attempts to change the src of an IMG tag to a blocked IP with no port to confirm that WebKit returns the correct error for it - blocked instead of cannot find. Due to the nature of this test, the results can only be processed automatically via DumpRenderTree. In addition, on some systems the results may depend on the behavior of the proxy. This test attempts to change the src of an IMG tag to a blocked IP with no port to confirm that WebKit returns the correct error for it - blocked instead of cannot find. Due to the nature of this test, the results can only be processed automatically via DumpRenderTree. In addition, on some systems the results may depend on the behavior of the proxy.
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
if (window.testRunner) { if (window.testRunner) {
testRunner.waitUntilDone(); testRunner.waitUntilDone();
testRunner.dumpResourceLoadCallbacks();
} }
function finishTesting() { function finishTesting() {
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
if (window.testRunner) { if (window.testRunner) {
testRunner.waitUntilDone(); testRunner.waitUntilDone();
testRunner.dumpResourceLoadCallbacks();
} }
function loadHandler(e) { function loadHandler(e) {
......
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