| OLD | NEW |
| 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 Loading... |
| 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, 2, |
| 735 true); |
| 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 Loading... |
| 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 |
| OLD | NEW |