| Index: chrome/browser/net/predictor_browsertest.cc
|
| diff --git a/chrome/browser/net/predictor_browsertest.cc b/chrome/browser/net/predictor_browsertest.cc
|
| index 85c5f63dbb6fa8f8ac84f09d072fc16faa853ae4..60b264f2c31cc6c5132d90d7914a5ea07763079b 100644
|
| --- a/chrome/browser/net/predictor_browsertest.cc
|
| +++ b/chrome/browser/net/predictor_browsertest.cc
|
| @@ -320,6 +320,7 @@ class CrossSitePredictorObserver
|
| chrome_browser_net::UrlInfo::ResolutionMotivation motivation,
|
| int count) override {
|
| base::AutoLock lock(lock_);
|
| + preconnect_url_attempts_.insert(original_url);
|
| if (original_url == cross_site_host_) {
|
| cross_site_preconnected_ = std::max(cross_site_preconnected_, count);
|
| } else if (original_url == source_host_) {
|
| @@ -411,6 +412,11 @@ class CrossSitePredictorObserver
|
| return HasHostBeenLookedUpLocked(url);
|
| }
|
|
|
| + bool HasHostAttemptedToPreconnect(const GURL& url) {
|
| + base::AutoLock lock(lock_);
|
| + return base::ContainsKey(preconnect_url_attempts_, url);
|
| + }
|
| +
|
| void CheckForWaitingLoop() {
|
| lock_.AssertAcquired();
|
| if (waiting_on_dns_.is_empty())
|
| @@ -465,6 +471,7 @@ class CrossSitePredictorObserver
|
| int cross_site_preconnected_;
|
| int same_site_preconnected_;
|
|
|
| + std::set<GURL> preconnect_url_attempts_;
|
| std::set<GURL> successful_dns_lookups_;
|
| std::set<GURL> unsuccessful_dns_lookups_;
|
| base::RunLoop* dns_run_loop_;
|
| @@ -875,6 +882,18 @@ IN_PROC_BROWSER_TEST_F(PredictorBrowserTest, SimplePreconnectFour) {
|
| connection_listener_->WaitForAcceptedConnectionsOnUI(4u);
|
| }
|
|
|
| +// Regression test for crbug.com/721981.
|
| +IN_PROC_BROWSER_TEST_F(PredictorBrowserTest, PreconnectNonHttpScheme) {
|
| + GURL url("chrome-native://dummyurl");
|
| + predictor()->PreconnectUrlAndSubresources(url, GURL());
|
| + base::RunLoop().RunUntilIdle();
|
| + // Since |url| is non-HTTP(s) scheme, Predictor will canonicalize it to an
|
| + // empty url. Make sure that there is no attempt to preconnect |url| or an
|
| + // empty url.
|
| + EXPECT_FALSE(observer()->HasHostAttemptedToPreconnect(url));
|
| + EXPECT_FALSE(observer()->HasHostAttemptedToPreconnect(GURL()));
|
| +}
|
| +
|
| // Test the html test harness used to initiate cross site fetches. These
|
| // initiate cross site subresource requests to the cross site test server.
|
| // Inspect the predictor's internal state to make sure that they are properly
|
|
|