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

Side by Side Diff: chrome/browser/net/predictor_unittest.cc

Issue 1131293004: Add cross origin to Blink-driven preconnect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Ryan's concerns Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <time.h> 5 #include <time.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <sstream> 8 #include <sstream>
9 #include <string> 9 #include <string>
10 10
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 const base::Time expiry = 724 const base::Time expiry =
725 base::Time::Now() + base::TimeDelta::FromSeconds(1000); 725 base::Time::Now() + base::TimeDelta::FromSeconds(1000);
726 net::TransportSecurityState state; 726 net::TransportSecurityState state;
727 state.AddHSTS(kHttpUrl.host(), expiry, false); 727 state.AddHSTS(kHttpUrl.host(), expiry, false);
728 728
729 Predictor predictor(true, true); 729 Predictor predictor(true, true);
730 TestPredictorObserver observer; 730 TestPredictorObserver observer;
731 predictor.SetObserver(&observer); 731 predictor.SetObserver(&observer);
732 predictor.SetTransportSecurityState(&state); 732 predictor.SetTransportSecurityState(&state);
733 733
734 predictor.PreconnectUrl(kHttpUrl, GURL(), UrlInfo::OMNIBOX_MOTIVATED, 2); 734 predictor.PreconnectUrl(kHttpUrl, GURL(), UrlInfo::OMNIBOX_MOTIVATED, true,
735 2);
735 ASSERT_EQ(1u, observer.preconnected_urls_.size()); 736 ASSERT_EQ(1u, observer.preconnected_urls_.size());
736 EXPECT_EQ(kHttpsUrl, observer.preconnected_urls_[0]); 737 EXPECT_EQ(kHttpsUrl, observer.preconnected_urls_[0]);
737 738
738 predictor.Shutdown(); 739 predictor.Shutdown();
739 } 740 }
740 741
741 // Tests that preconnecting a URL on the HSTS list preconnects the subresources 742 // Tests that preconnecting a URL on the HSTS list preconnects the subresources
742 // for the SSL version. 743 // for the SSL version.
743 TEST_F(PredictorTest, HSTSRedirectSubresources) { 744 TEST_F(PredictorTest, HSTSRedirectSubresources) {
744 const GURL kHttpUrl("http://example.com"); 745 const GURL kHttpUrl("http://example.com");
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 835
835 // Proxy may not be in use (the PAC script has not yet been evaluated), so the 836 // Proxy may not be in use (the PAC script has not yet been evaluated), so the
836 // name has been registered for pre-resolve. 837 // name has been registered for pre-resolve.
837 EXPECT_FALSE(testing_master.work_queue_.IsEmpty()); 838 EXPECT_FALSE(testing_master.work_queue_.IsEmpty());
838 839
839 delete testing_master.proxy_service_; 840 delete testing_master.proxy_service_;
840 testing_master.Shutdown(); 841 testing_master.Shutdown();
841 } 842 }
842 843
843 } // namespace chrome_browser_net 844 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698