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

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

Issue 1290243007: Shift URLRequestContextStorage over to taking scoped_ptrs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Paul_BuilderGrab
Patch Set: Sync'd to revision p349162. Created 5 years, 3 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
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/proxy_service_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 } 784 }
785 785
786 TEST_F(PredictorTest, ProxyDefinitelyEnabled) { 786 TEST_F(PredictorTest, ProxyDefinitelyEnabled) {
787 // Don't actually try to resolve names. 787 // Don't actually try to resolve names.
788 Predictor::set_max_parallel_resolves(0); 788 Predictor::set_max_parallel_resolves(0);
789 789
790 Predictor testing_master(true, true); 790 Predictor testing_master(true, true);
791 791
792 net::ProxyConfig config; 792 net::ProxyConfig config;
793 config.proxy_rules().ParseFromString("http=socks://localhost:12345"); 793 config.proxy_rules().ParseFromString("http=socks://localhost:12345");
794 testing_master.proxy_service_ = net::ProxyService::CreateFixed(config); 794 scoped_ptr<net::ProxyService> proxy_service(
795 net::ProxyService::CreateFixed(config));
796 testing_master.proxy_service_ = proxy_service.get();
795 797
796 GURL goog("http://www.google.com:80"); 798 GURL goog("http://www.google.com:80");
797 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED); 799 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED);
798 800
799 // Proxy is definitely in use, so there is no need to pre-resolve the domain. 801 // Proxy is definitely in use, so there is no need to pre-resolve the domain.
800 EXPECT_TRUE(testing_master.work_queue_.IsEmpty()); 802 EXPECT_TRUE(testing_master.work_queue_.IsEmpty());
801 803
802 delete testing_master.proxy_service_;
803 testing_master.Shutdown(); 804 testing_master.Shutdown();
804 } 805 }
805 806
806 TEST_F(PredictorTest, ProxyDefinitelyNotEnabled) { 807 TEST_F(PredictorTest, ProxyDefinitelyNotEnabled) {
807 // Don't actually try to resolve names. 808 // Don't actually try to resolve names.
808 Predictor::set_max_parallel_resolves(0); 809 Predictor::set_max_parallel_resolves(0);
809 810
810 Predictor testing_master(true, true); 811 Predictor testing_master(true, true);
811 net::ProxyConfig config = net::ProxyConfig::CreateDirect(); 812 net::ProxyConfig config = net::ProxyConfig::CreateDirect();
812 testing_master.proxy_service_ = net::ProxyService::CreateFixed(config); 813 scoped_ptr<net::ProxyService> proxy_service(
814 net::ProxyService::CreateFixed(config));
815 testing_master.proxy_service_ = proxy_service.get();
813 816
814 GURL goog("http://www.google.com:80"); 817 GURL goog("http://www.google.com:80");
815 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED); 818 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED);
816 819
817 // Proxy is not in use, so the name has been registered for pre-resolve. 820 // Proxy is not in use, so the name has been registered for pre-resolve.
818 EXPECT_FALSE(testing_master.work_queue_.IsEmpty()); 821 EXPECT_FALSE(testing_master.work_queue_.IsEmpty());
819 822
820 delete testing_master.proxy_service_;
821 testing_master.Shutdown(); 823 testing_master.Shutdown();
822 } 824 }
823 825
824 TEST_F(PredictorTest, ProxyMaybeEnabled) { 826 TEST_F(PredictorTest, ProxyMaybeEnabled) {
825 // Don't actually try to resolve names. 827 // Don't actually try to resolve names.
826 Predictor::set_max_parallel_resolves(0); 828 Predictor::set_max_parallel_resolves(0);
827 829
828 Predictor testing_master(true, true); 830 Predictor testing_master(true, true);
829 net::ProxyConfig config = net::ProxyConfig::CreateFromCustomPacURL(GURL( 831 net::ProxyConfig config = net::ProxyConfig::CreateFromCustomPacURL(GURL(
830 "http://foopy/proxy.pac")); 832 "http://foopy/proxy.pac"));
831 testing_master.proxy_service_ = net::ProxyService::CreateFixed(config); 833 scoped_ptr<net::ProxyService> proxy_service(
834 net::ProxyService::CreateFixed(config));
835 testing_master.proxy_service_ = proxy_service.get();
832 836
833 GURL goog("http://www.google.com:80"); 837 GURL goog("http://www.google.com:80");
834 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED); 838 testing_master.Resolve(goog, UrlInfo::OMNIBOX_MOTIVATED);
835 839
836 // Proxy may not be in use (the PAC script has not yet been evaluated), so the 840 // Proxy may not be in use (the PAC script has not yet been evaluated), so the
837 // name has been registered for pre-resolve. 841 // name has been registered for pre-resolve.
838 EXPECT_FALSE(testing_master.work_queue_.IsEmpty()); 842 EXPECT_FALSE(testing_master.work_queue_.IsEmpty());
839 843
840 delete testing_master.proxy_service_;
841 testing_master.Shutdown(); 844 testing_master.Shutdown();
842 } 845 }
843 846
844 } // namespace chrome_browser_net 847 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.cc ('k') | chrome/browser/net/proxy_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698