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

Side by Side Diff: net/proxy/proxy_service_unittest.cc

Issue 1157163003: Remove ProxyResolver::(Cancel)SetPacScript and LegacyProxyResolverFactory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8-proxy-resolver-refactor
Patch Set: Created 5 years, 6 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 | « net/proxy/proxy_service.cc ('k') | no next file » | 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 "net/proxy/proxy_service.h" 5 #include "net/proxy/proxy_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 1845
1846 EXPECT_EQ(OK, callback3.WaitForResult()); 1846 EXPECT_EQ(OK, callback3.WaitForResult());
1847 EXPECT_EQ("request3:80", info3.proxy_server().ToURI()); 1847 EXPECT_EQ("request3:80", info3.proxy_server().ToURI());
1848 } 1848 }
1849 1849
1850 // Test the initial PAC download for resolver that expects bytes. 1850 // Test the initial PAC download for resolver that expects bytes.
1851 TEST_F(ProxyServiceTest, InitialPACScriptDownload) { 1851 TEST_F(ProxyServiceTest, InitialPACScriptDownload) {
1852 MockProxyConfigService* config_service = 1852 MockProxyConfigService* config_service =
1853 new MockProxyConfigService("http://foopy/proxy.pac"); 1853 new MockProxyConfigService("http://foopy/proxy.pac");
1854 1854
1855 MockAsyncProxyResolverExpectsBytes resolver; 1855 MockAsyncProxyResolver resolver;
1856 MockAsyncProxyResolverFactory* factory = 1856 MockAsyncProxyResolverFactory* factory =
1857 new MockAsyncProxyResolverFactory(true); 1857 new MockAsyncProxyResolverFactory(true);
1858 1858
1859 ProxyService service(config_service, make_scoped_ptr(factory), NULL); 1859 ProxyService service(config_service, make_scoped_ptr(factory), NULL);
1860 1860
1861 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 1861 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
1862 service.SetProxyScriptFetchers(fetcher, 1862 service.SetProxyScriptFetchers(fetcher,
1863 new DoNothingDhcpProxyScriptFetcher()); 1863 new DoNothingDhcpProxyScriptFetcher());
1864 1864
1865 // Start 3 requests. 1865 // Start 3 requests.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 EXPECT_FALSE(info3.proxy_resolve_start_time().is_null()); 1952 EXPECT_FALSE(info3.proxy_resolve_start_time().is_null());
1953 EXPECT_FALSE(info3.proxy_resolve_end_time().is_null()); 1953 EXPECT_FALSE(info3.proxy_resolve_end_time().is_null());
1954 EXPECT_LE(info3.proxy_resolve_start_time(), info3.proxy_resolve_end_time()); 1954 EXPECT_LE(info3.proxy_resolve_start_time(), info3.proxy_resolve_end_time());
1955 } 1955 }
1956 1956
1957 // Test changing the ProxyScriptFetcher while PAC download is in progress. 1957 // Test changing the ProxyScriptFetcher while PAC download is in progress.
1958 TEST_F(ProxyServiceTest, ChangeScriptFetcherWhilePACDownloadInProgress) { 1958 TEST_F(ProxyServiceTest, ChangeScriptFetcherWhilePACDownloadInProgress) {
1959 MockProxyConfigService* config_service = 1959 MockProxyConfigService* config_service =
1960 new MockProxyConfigService("http://foopy/proxy.pac"); 1960 new MockProxyConfigService("http://foopy/proxy.pac");
1961 1961
1962 MockAsyncProxyResolverExpectsBytes resolver; 1962 MockAsyncProxyResolver resolver;
1963 MockAsyncProxyResolverFactory* factory = 1963 MockAsyncProxyResolverFactory* factory =
1964 new MockAsyncProxyResolverFactory(true); 1964 new MockAsyncProxyResolverFactory(true);
1965 1965
1966 ProxyService service(config_service, make_scoped_ptr(factory), NULL); 1966 ProxyService service(config_service, make_scoped_ptr(factory), NULL);
1967 1967
1968 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 1968 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
1969 service.SetProxyScriptFetchers(fetcher, 1969 service.SetProxyScriptFetchers(fetcher,
1970 new DoNothingDhcpProxyScriptFetcher()); 1970 new DoNothingDhcpProxyScriptFetcher());
1971 1971
1972 // Start 2 requests. 1972 // Start 2 requests.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 ASSERT_EQ(2u, resolver.pending_requests().size()); 2013 ASSERT_EQ(2u, resolver.pending_requests().size());
2014 EXPECT_EQ(GURL("http://request1"), resolver.pending_requests()[0]->url()); 2014 EXPECT_EQ(GURL("http://request1"), resolver.pending_requests()[0]->url());
2015 EXPECT_EQ(GURL("http://request2"), resolver.pending_requests()[1]->url()); 2015 EXPECT_EQ(GURL("http://request2"), resolver.pending_requests()[1]->url());
2016 } 2016 }
2017 2017
2018 // Test cancellation of a request, while the PAC script is being fetched. 2018 // Test cancellation of a request, while the PAC script is being fetched.
2019 TEST_F(ProxyServiceTest, CancelWhilePACFetching) { 2019 TEST_F(ProxyServiceTest, CancelWhilePACFetching) {
2020 MockProxyConfigService* config_service = 2020 MockProxyConfigService* config_service =
2021 new MockProxyConfigService("http://foopy/proxy.pac"); 2021 new MockProxyConfigService("http://foopy/proxy.pac");
2022 2022
2023 MockAsyncProxyResolverExpectsBytes resolver; 2023 MockAsyncProxyResolver resolver;
2024 MockAsyncProxyResolverFactory* factory = 2024 MockAsyncProxyResolverFactory* factory =
2025 new MockAsyncProxyResolverFactory(true); 2025 new MockAsyncProxyResolverFactory(true);
2026 2026
2027 ProxyService service(config_service, make_scoped_ptr(factory), NULL); 2027 ProxyService service(config_service, make_scoped_ptr(factory), NULL);
2028 2028
2029 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 2029 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
2030 service.SetProxyScriptFetchers(fetcher, 2030 service.SetProxyScriptFetchers(fetcher,
2031 new DoNothingDhcpProxyScriptFetcher()); 2031 new DoNothingDhcpProxyScriptFetcher());
2032 2032
2033 // Start 3 requests. 2033 // Start 3 requests.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 } 2109 }
2110 2110
2111 // Test that if auto-detect fails, we fall-back to the custom pac. 2111 // Test that if auto-detect fails, we fall-back to the custom pac.
2112 TEST_F(ProxyServiceTest, FallbackFromAutodetectToCustomPac) { 2112 TEST_F(ProxyServiceTest, FallbackFromAutodetectToCustomPac) {
2113 ProxyConfig config; 2113 ProxyConfig config;
2114 config.set_auto_detect(true); 2114 config.set_auto_detect(true);
2115 config.set_pac_url(GURL("http://foopy/proxy.pac")); 2115 config.set_pac_url(GURL("http://foopy/proxy.pac"));
2116 config.proxy_rules().ParseFromString("http=foopy:80"); // Won't be used. 2116 config.proxy_rules().ParseFromString("http=foopy:80"); // Won't be used.
2117 2117
2118 MockProxyConfigService* config_service = new MockProxyConfigService(config); 2118 MockProxyConfigService* config_service = new MockProxyConfigService(config);
2119 MockAsyncProxyResolverExpectsBytes resolver; 2119 MockAsyncProxyResolver resolver;
2120 MockAsyncProxyResolverFactory* factory = 2120 MockAsyncProxyResolverFactory* factory =
2121 new MockAsyncProxyResolverFactory(true); 2121 new MockAsyncProxyResolverFactory(true);
2122 ProxyService service(config_service, make_scoped_ptr(factory), NULL); 2122 ProxyService service(config_service, make_scoped_ptr(factory), NULL);
2123 2123
2124 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 2124 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
2125 service.SetProxyScriptFetchers(fetcher, 2125 service.SetProxyScriptFetchers(fetcher,
2126 new DoNothingDhcpProxyScriptFetcher()); 2126 new DoNothingDhcpProxyScriptFetcher());
2127 2127
2128 // Start 2 requests. 2128 // Start 2 requests.
2129 2129
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2189 2189
2190 // This is the same test as FallbackFromAutodetectToCustomPac, except 2190 // This is the same test as FallbackFromAutodetectToCustomPac, except
2191 // the auto-detect script fails parsing rather than downloading. 2191 // the auto-detect script fails parsing rather than downloading.
2192 TEST_F(ProxyServiceTest, FallbackFromAutodetectToCustomPac2) { 2192 TEST_F(ProxyServiceTest, FallbackFromAutodetectToCustomPac2) {
2193 ProxyConfig config; 2193 ProxyConfig config;
2194 config.set_auto_detect(true); 2194 config.set_auto_detect(true);
2195 config.set_pac_url(GURL("http://foopy/proxy.pac")); 2195 config.set_pac_url(GURL("http://foopy/proxy.pac"));
2196 config.proxy_rules().ParseFromString("http=foopy:80"); // Won't be used. 2196 config.proxy_rules().ParseFromString("http=foopy:80"); // Won't be used.
2197 2197
2198 MockProxyConfigService* config_service = new MockProxyConfigService(config); 2198 MockProxyConfigService* config_service = new MockProxyConfigService(config);
2199 MockAsyncProxyResolverExpectsBytes resolver; 2199 MockAsyncProxyResolver resolver;
2200 MockAsyncProxyResolverFactory* factory = 2200 MockAsyncProxyResolverFactory* factory =
2201 new MockAsyncProxyResolverFactory(true); 2201 new MockAsyncProxyResolverFactory(true);
2202 ProxyService service(config_service, make_scoped_ptr(factory), NULL); 2202 ProxyService service(config_service, make_scoped_ptr(factory), NULL);
2203 2203
2204 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 2204 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
2205 service.SetProxyScriptFetchers(fetcher, 2205 service.SetProxyScriptFetchers(fetcher,
2206 new DoNothingDhcpProxyScriptFetcher()); 2206 new DoNothingDhcpProxyScriptFetcher());
2207 2207
2208 // Start 2 requests. 2208 // Start 2 requests.
2209 2209
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 2325
2326 // Test that the bypass rules are NOT applied when using autodetect. 2326 // Test that the bypass rules are NOT applied when using autodetect.
2327 TEST_F(ProxyServiceTest, BypassDoesntApplyToPac) { 2327 TEST_F(ProxyServiceTest, BypassDoesntApplyToPac) {
2328 ProxyConfig config; 2328 ProxyConfig config;
2329 config.set_auto_detect(true); 2329 config.set_auto_detect(true);
2330 config.set_pac_url(GURL("http://foopy/proxy.pac")); 2330 config.set_pac_url(GURL("http://foopy/proxy.pac"));
2331 config.proxy_rules().ParseFromString("http=foopy:80"); // Not used. 2331 config.proxy_rules().ParseFromString("http=foopy:80"); // Not used.
2332 config.proxy_rules().bypass_rules.ParseFromString("www.google.com"); 2332 config.proxy_rules().bypass_rules.ParseFromString("www.google.com");
2333 2333
2334 MockProxyConfigService* config_service = new MockProxyConfigService(config); 2334 MockProxyConfigService* config_service = new MockProxyConfigService(config);
2335 MockAsyncProxyResolverExpectsBytes resolver; 2335 MockAsyncProxyResolver resolver;
2336 MockAsyncProxyResolverFactory* factory = 2336 MockAsyncProxyResolverFactory* factory =
2337 new MockAsyncProxyResolverFactory(true); 2337 new MockAsyncProxyResolverFactory(true);
2338 ProxyService service(config_service, make_scoped_ptr(factory), NULL); 2338 ProxyService service(config_service, make_scoped_ptr(factory), NULL);
2339 2339
2340 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 2340 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
2341 service.SetProxyScriptFetchers(fetcher, 2341 service.SetProxyScriptFetchers(fetcher,
2342 new DoNothingDhcpProxyScriptFetcher()); 2342 new DoNothingDhcpProxyScriptFetcher());
2343 2343
2344 // Start 1 requests. 2344 // Start 1 requests.
2345 2345
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 callback2.callback(), NULL, NULL, BoundNetLog()); 2526 callback2.callback(), NULL, NULL, BoundNetLog());
2527 EXPECT_EQ(OK, rv); 2527 EXPECT_EQ(OK, rv);
2528 2528
2529 EXPECT_TRUE(info2.is_direct()); 2529 EXPECT_TRUE(info2.is_direct());
2530 } 2530 }
2531 2531
2532 TEST_F(ProxyServiceTest, NetworkChangeTriggersPacRefetch) { 2532 TEST_F(ProxyServiceTest, NetworkChangeTriggersPacRefetch) {
2533 MockProxyConfigService* config_service = 2533 MockProxyConfigService* config_service =
2534 new MockProxyConfigService("http://foopy/proxy.pac"); 2534 new MockProxyConfigService("http://foopy/proxy.pac");
2535 2535
2536 MockAsyncProxyResolverExpectsBytes resolver; 2536 MockAsyncProxyResolver resolver;
2537 MockAsyncProxyResolverFactory* factory = 2537 MockAsyncProxyResolverFactory* factory =
2538 new MockAsyncProxyResolverFactory(true); 2538 new MockAsyncProxyResolverFactory(true);
2539 2539
2540 TestNetLog log; 2540 TestNetLog log;
2541 2541
2542 ProxyService service(config_service, make_scoped_ptr(factory), &log); 2542 ProxyService service(config_service, make_scoped_ptr(factory), &log);
2543 2543
2544 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 2544 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
2545 service.SetProxyScriptFetchers(fetcher, 2545 service.SetProxyScriptFetchers(fetcher,
2546 new DoNothingDhcpProxyScriptFetcher()); 2546 new DoNothingDhcpProxyScriptFetcher());
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
2648 // script once it becomes available. 2648 // script once it becomes available.
2649 TEST_F(ProxyServiceTest, PACScriptRefetchAfterFailure) { 2649 TEST_F(ProxyServiceTest, PACScriptRefetchAfterFailure) {
2650 // Change the retry policy to wait a mere 1 ms before retrying, so the test 2650 // Change the retry policy to wait a mere 1 ms before retrying, so the test
2651 // runs quickly. 2651 // runs quickly.
2652 ImmediatePollPolicy poll_policy; 2652 ImmediatePollPolicy poll_policy;
2653 ProxyService::set_pac_script_poll_policy(&poll_policy); 2653 ProxyService::set_pac_script_poll_policy(&poll_policy);
2654 2654
2655 MockProxyConfigService* config_service = 2655 MockProxyConfigService* config_service =
2656 new MockProxyConfigService("http://foopy/proxy.pac"); 2656 new MockProxyConfigService("http://foopy/proxy.pac");
2657 2657
2658 MockAsyncProxyResolverExpectsBytes resolver; 2658 MockAsyncProxyResolver resolver;
2659 MockAsyncProxyResolverFactory* factory = 2659 MockAsyncProxyResolverFactory* factory =
2660 new MockAsyncProxyResolverFactory(true); 2660 new MockAsyncProxyResolverFactory(true);
2661 2661
2662 ProxyService service(config_service, make_scoped_ptr(factory), NULL); 2662 ProxyService service(config_service, make_scoped_ptr(factory), NULL);
2663 2663
2664 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 2664 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
2665 service.SetProxyScriptFetchers(fetcher, 2665 service.SetProxyScriptFetchers(fetcher,
2666 new DoNothingDhcpProxyScriptFetcher()); 2666 new DoNothingDhcpProxyScriptFetcher());
2667 2667
2668 // Start 1 request. 2668 // Start 1 request.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 // re-configure the service to use the new script. 2753 // re-configure the service to use the new script.
2754 TEST_F(ProxyServiceTest, PACScriptRefetchAfterContentChange) { 2754 TEST_F(ProxyServiceTest, PACScriptRefetchAfterContentChange) {
2755 // Change the retry policy to wait a mere 1 ms before retrying, so the test 2755 // Change the retry policy to wait a mere 1 ms before retrying, so the test
2756 // runs quickly. 2756 // runs quickly.
2757 ImmediatePollPolicy poll_policy; 2757 ImmediatePollPolicy poll_policy;
2758 ProxyService::set_pac_script_poll_policy(&poll_policy); 2758 ProxyService::set_pac_script_poll_policy(&poll_policy);
2759 2759
2760 MockProxyConfigService* config_service = 2760 MockProxyConfigService* config_service =
2761 new MockProxyConfigService("http://foopy/proxy.pac"); 2761 new MockProxyConfigService("http://foopy/proxy.pac");
2762 2762
2763 MockAsyncProxyResolverExpectsBytes resolver; 2763 MockAsyncProxyResolver resolver;
2764 MockAsyncProxyResolverFactory* factory = 2764 MockAsyncProxyResolverFactory* factory =
2765 new MockAsyncProxyResolverFactory(true); 2765 new MockAsyncProxyResolverFactory(true);
2766 2766
2767 ProxyService service(config_service, make_scoped_ptr(factory), NULL); 2767 ProxyService service(config_service, make_scoped_ptr(factory), NULL);
2768 2768
2769 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 2769 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
2770 service.SetProxyScriptFetchers(fetcher, 2770 service.SetProxyScriptFetchers(fetcher,
2771 new DoNothingDhcpProxyScriptFetcher()); 2771 new DoNothingDhcpProxyScriptFetcher());
2772 2772
2773 // Start 1 request. 2773 // Start 1 request.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2864 // have NOT changed, then we do not bother to re-initialize the proxy resolver. 2864 // have NOT changed, then we do not bother to re-initialize the proxy resolver.
2865 TEST_F(ProxyServiceTest, PACScriptRefetchAfterContentUnchanged) { 2865 TEST_F(ProxyServiceTest, PACScriptRefetchAfterContentUnchanged) {
2866 // Change the retry policy to wait a mere 1 ms before retrying, so the test 2866 // Change the retry policy to wait a mere 1 ms before retrying, so the test
2867 // runs quickly. 2867 // runs quickly.
2868 ImmediatePollPolicy poll_policy; 2868 ImmediatePollPolicy poll_policy;
2869 ProxyService::set_pac_script_poll_policy(&poll_policy); 2869 ProxyService::set_pac_script_poll_policy(&poll_policy);
2870 2870
2871 MockProxyConfigService* config_service = 2871 MockProxyConfigService* config_service =
2872 new MockProxyConfigService("http://foopy/proxy.pac"); 2872 new MockProxyConfigService("http://foopy/proxy.pac");
2873 2873
2874 MockAsyncProxyResolverExpectsBytes resolver; 2874 MockAsyncProxyResolver resolver;
2875 MockAsyncProxyResolverFactory* factory = 2875 MockAsyncProxyResolverFactory* factory =
2876 new MockAsyncProxyResolverFactory(true); 2876 new MockAsyncProxyResolverFactory(true);
2877 2877
2878 ProxyService service(config_service, make_scoped_ptr(factory), NULL); 2878 ProxyService service(config_service, make_scoped_ptr(factory), NULL);
2879 2879
2880 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 2880 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
2881 service.SetProxyScriptFetchers(fetcher, 2881 service.SetProxyScriptFetchers(fetcher,
2882 new DoNothingDhcpProxyScriptFetcher()); 2882 new DoNothingDhcpProxyScriptFetcher());
2883 2883
2884 // Start 1 request. 2884 // Start 1 request.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
2972 // ProxyService to stop using that PAC script. 2972 // ProxyService to stop using that PAC script.
2973 TEST_F(ProxyServiceTest, PACScriptRefetchAfterSuccess) { 2973 TEST_F(ProxyServiceTest, PACScriptRefetchAfterSuccess) {
2974 // Change the retry policy to wait a mere 1 ms before retrying, so the test 2974 // Change the retry policy to wait a mere 1 ms before retrying, so the test
2975 // runs quickly. 2975 // runs quickly.
2976 ImmediatePollPolicy poll_policy; 2976 ImmediatePollPolicy poll_policy;
2977 ProxyService::set_pac_script_poll_policy(&poll_policy); 2977 ProxyService::set_pac_script_poll_policy(&poll_policy);
2978 2978
2979 MockProxyConfigService* config_service = 2979 MockProxyConfigService* config_service =
2980 new MockProxyConfigService("http://foopy/proxy.pac"); 2980 new MockProxyConfigService("http://foopy/proxy.pac");
2981 2981
2982 MockAsyncProxyResolverExpectsBytes resolver; 2982 MockAsyncProxyResolver resolver;
2983 MockAsyncProxyResolverFactory* factory = 2983 MockAsyncProxyResolverFactory* factory =
2984 new MockAsyncProxyResolverFactory(true); 2984 new MockAsyncProxyResolverFactory(true);
2985 2985
2986 ProxyService service(config_service, make_scoped_ptr(factory), NULL); 2986 ProxyService service(config_service, make_scoped_ptr(factory), NULL);
2987 2987
2988 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 2988 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
2989 service.SetProxyScriptFetchers(fetcher, 2989 service.SetProxyScriptFetchers(fetcher,
2990 new DoNothingDhcpProxyScriptFetcher()); 2990 new DoNothingDhcpProxyScriptFetcher());
2991 2991
2992 // Start 1 request. 2992 // Start 1 request.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3125 3125
3126 // This tests the polling of the PAC script. Specifically, it tests that 3126 // This tests the polling of the PAC script. Specifically, it tests that
3127 // polling occurs in response to user activity. 3127 // polling occurs in response to user activity.
3128 TEST_F(ProxyServiceTest, PACScriptRefetchAfterActivity) { 3128 TEST_F(ProxyServiceTest, PACScriptRefetchAfterActivity) {
3129 ImmediateAfterActivityPollPolicy poll_policy; 3129 ImmediateAfterActivityPollPolicy poll_policy;
3130 ProxyService::set_pac_script_poll_policy(&poll_policy); 3130 ProxyService::set_pac_script_poll_policy(&poll_policy);
3131 3131
3132 MockProxyConfigService* config_service = 3132 MockProxyConfigService* config_service =
3133 new MockProxyConfigService("http://foopy/proxy.pac"); 3133 new MockProxyConfigService("http://foopy/proxy.pac");
3134 3134
3135 MockAsyncProxyResolverExpectsBytes resolver; 3135 MockAsyncProxyResolver resolver;
3136 MockAsyncProxyResolverFactory* factory = 3136 MockAsyncProxyResolverFactory* factory =
3137 new MockAsyncProxyResolverFactory(true); 3137 new MockAsyncProxyResolverFactory(true);
3138 3138
3139 ProxyService service(config_service, make_scoped_ptr(factory), NULL); 3139 ProxyService service(config_service, make_scoped_ptr(factory), NULL);
3140 3140
3141 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher; 3141 MockProxyScriptFetcher* fetcher = new MockProxyScriptFetcher;
3142 service.SetProxyScriptFetchers(fetcher, 3142 service.SetProxyScriptFetchers(fetcher,
3143 new DoNothingDhcpProxyScriptFetcher()); 3143 new DoNothingDhcpProxyScriptFetcher());
3144 3144
3145 // Start 1 request. 3145 // Start 1 request.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
3273 url, LOAD_NORMAL, &info, NULL, log.bound()); 3273 url, LOAD_NORMAL, &info, NULL, log.bound());
3274 EXPECT_TRUE(synchronous_success); 3274 EXPECT_TRUE(synchronous_success);
3275 EXPECT_FALSE(info.is_direct()); 3275 EXPECT_FALSE(info.is_direct());
3276 EXPECT_EQ("foopy1", info.proxy_server().host_port_pair().host()); 3276 EXPECT_EQ("foopy1", info.proxy_server().host_port_pair().host());
3277 3277
3278 // No request should have been queued. 3278 // No request should have been queued.
3279 EXPECT_EQ(0u, factory->pending_requests().size()); 3279 EXPECT_EQ(0u, factory->pending_requests().size());
3280 } 3280 }
3281 3281
3282 } // namespace net 3282 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698