| 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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 | 697 |
| 698 predictor.Shutdown(); | 698 predictor.Shutdown(); |
| 699 } | 699 } |
| 700 | 700 |
| 701 class TestPredictorObserver : public PredictorObserver { | 701 class TestPredictorObserver : public PredictorObserver { |
| 702 public: | 702 public: |
| 703 // PredictorObserver implementation: | 703 // PredictorObserver implementation: |
| 704 virtual void OnPreconnectUrl(const GURL& url, | 704 virtual void OnPreconnectUrl(const GURL& url, |
| 705 const GURL& first_party_for_cookies, | 705 const GURL& first_party_for_cookies, |
| 706 UrlInfo::ResolutionMotivation motivation, | 706 UrlInfo::ResolutionMotivation motivation, |
| 707 int count) OVERRIDE { | 707 int count) override { |
| 708 preconnected_urls_.push_back(url); | 708 preconnected_urls_.push_back(url); |
| 709 } | 709 } |
| 710 | 710 |
| 711 std::vector<GURL> preconnected_urls_; | 711 std::vector<GURL> preconnected_urls_; |
| 712 }; | 712 }; |
| 713 | 713 |
| 714 // Tests that preconnects apply the HSTS list. | 714 // Tests that preconnects apply the HSTS list. |
| 715 TEST_F(PredictorTest, HSTSRedirect) { | 715 TEST_F(PredictorTest, HSTSRedirect) { |
| 716 const GURL kHttpUrl("http://example.com"); | 716 const GURL kHttpUrl("http://example.com"); |
| 717 const GURL kHttpsUrl("https://example.com"); | 717 const GURL kHttpsUrl("https://example.com"); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 : ProxyAdvisor(NULL, NULL), | 773 : ProxyAdvisor(NULL, NULL), |
| 774 would_proxy_(false), | 774 would_proxy_(false), |
| 775 advise_count_(0), | 775 advise_count_(0), |
| 776 would_proxy_count_(0) { | 776 would_proxy_count_(0) { |
| 777 } | 777 } |
| 778 | 778 |
| 779 virtual ~TestProxyAdvisor() {} | 779 virtual ~TestProxyAdvisor() {} |
| 780 | 780 |
| 781 virtual void Advise(const GURL& url, | 781 virtual void Advise(const GURL& url, |
| 782 UrlInfo::ResolutionMotivation motivation, | 782 UrlInfo::ResolutionMotivation motivation, |
| 783 bool is_preconnect) OVERRIDE { | 783 bool is_preconnect) override { |
| 784 ++advise_count_; | 784 ++advise_count_; |
| 785 } | 785 } |
| 786 | 786 |
| 787 virtual bool WouldProxyURL(const GURL& url) OVERRIDE { | 787 virtual bool WouldProxyURL(const GURL& url) override { |
| 788 ++would_proxy_count_; | 788 ++would_proxy_count_; |
| 789 return would_proxy_; | 789 return would_proxy_; |
| 790 } | 790 } |
| 791 | 791 |
| 792 bool would_proxy_; | 792 bool would_proxy_; |
| 793 int advise_count_; | 793 int advise_count_; |
| 794 int would_proxy_count_; | 794 int would_proxy_count_; |
| 795 }; | 795 }; |
| 796 | 796 |
| 797 TEST_F(PredictorTest, SingleLookupTestWithDisabledAdvisor) { | 797 TEST_F(PredictorTest, SingleLookupTestWithDisabledAdvisor) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 | 859 |
| 860 EXPECT_EQ(advisor->would_proxy_count_, 0); | 860 EXPECT_EQ(advisor->would_proxy_count_, 0); |
| 861 EXPECT_EQ(advisor->advise_count_, 1); | 861 EXPECT_EQ(advisor->advise_count_, 1); |
| 862 | 862 |
| 863 testing_master.Shutdown(); | 863 testing_master.Shutdown(); |
| 864 } | 864 } |
| 865 | 865 |
| 866 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 866 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
| 867 | 867 |
| 868 } // namespace chrome_browser_net | 868 } // namespace chrome_browser_net |
| OLD | NEW |