Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Unified Diff: chrome/browser/net/predictor_browsertest.cc

Issue 1004223003: Revert "DNS Prefetch fix: renderer shouldn't send long hostnames to browser." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2311
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/predictor/dns_prefetch.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/predictor_browsertest.cc
diff --git a/chrome/browser/net/predictor_browsertest.cc b/chrome/browser/net/predictor_browsertest.cc
index c6762b8d816477a42682f6655740952ea68f8d77..307c61c25604fb0f7ceb9c9982de881fc264bf9c 100644
--- a/chrome/browser/net/predictor_browsertest.cc
+++ b/chrome/browser/net/predictor_browsertest.cc
@@ -22,11 +22,6 @@ using testing::HasSubstr;
namespace {
const char kChromiumHostname[] = "chromium.org";
-const char kInvalidLongHostname[] = "illegally-long-hostname-over-255-"
- "characters-should-not-send-an-ipc-message-to-the-browser-"
- "0000000000000000000000000000000000000000000000000000000000000000000000000"
- "0000000000000000000000000000000000000000000000000000000000000000000000000"
- "000000000000000000000000000000000000000000000000000000.org";
// Records a history of all hostnames for which resolving has been requested,
// and immediately fails the resolution requests themselves.
@@ -51,11 +46,7 @@ class HostResolutionRequestRecorder : public net::HostResolverProc {
return net::ERR_NAME_NOT_RESOLVED;
}
- int RequestedHostnameCount() const {
- return requested_hostnames_.size();
- }
-
- bool HasHostBeenRequested(const std::string& hostname) const {
+ bool HasHostBeenRequested(const std::string& hostname) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
return std::find(requested_hostnames_.begin(),
requested_hostnames_.end(),
@@ -159,18 +150,10 @@ class PredictorBrowserTest : public InProcessBrowserTest {
serializer.Serialize(*list_value);
}
- bool HasHostBeenRequested(const std::string& hostname) const {
- return host_resolution_request_recorder_->HasHostBeenRequested(hostname);
- }
-
void WaitUntilHostHasBeenRequested(const std::string& hostname) {
host_resolution_request_recorder_->WaitUntilHostHasBeenRequested(hostname);
}
- int RequestedHostnameCount() const {
- return host_resolution_request_recorder_->RequestedHostnameCount();
- }
-
const GURL startup_url_;
const GURL referring_url_;
const GURL target_url_;
@@ -211,13 +194,10 @@ IN_PROC_BROWSER_TEST_F(PredictorBrowserTest, ShutdownStartupCycle) {
IN_PROC_BROWSER_TEST_F(PredictorBrowserTest, DnsPrefetch) {
ASSERT_TRUE(test_server()->Start());
- int hostnames_requested_before_load = RequestedHostnameCount();
ui_test_utils::NavigateToURL(
browser(),
GURL(test_server()->GetURL("files/predictor/dns_prefetch.html")));
WaitUntilHostHasBeenRequested(kChromiumHostname);
- ASSERT_FALSE(HasHostBeenRequested(kInvalidLongHostname));
- ASSERT_EQ(hostnames_requested_before_load + 1, RequestedHostnameCount());
}
} // namespace chrome_browser_net
« no previous file with comments | « no previous file | chrome/test/data/predictor/dns_prefetch.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698