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

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

Issue 1007323003: DNS Prefetch fix: renderer shouldn't send long hostnames to browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 94d389ff2ac4065dbbc1863dafd942c65d8286ae..de11dfc6e39063844d769202e047833674c15e0f 100644
--- a/chrome/browser/net/predictor_browsertest.cc
+++ b/chrome/browser/net/predictor_browsertest.cc
@@ -54,6 +54,10 @@ class HostResolutionRequestRecorder : public net::HostResolverProc {
return net::ERR_NAME_NOT_RESOLVED;
}
+ int RequestedHostnameCount() const {
+ return requested_hostnames_.size();
+ }
+
bool HasHostBeenRequested(const std::string& hostname) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
return std::find(requested_hostnames_.begin(),
@@ -214,6 +218,10 @@ class PredictorBrowserTest : public InProcessBrowserTest {
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_;
@@ -254,10 +262,12 @@ 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_EQ(hostnames_requested_before_load + 1, RequestedHostnameCount());
}
IN_PROC_BROWSER_TEST_F(PredictorBrowserTest, Preconnect) {
« 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