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 "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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // | 91 // |
92 // We disable the polling in order to avoid any timing dependencies in the | 92 // We disable the polling in order to avoid any timing dependencies in the |
93 // tests. If the bot were to run the tests very slowly and we hadn't disabled | 93 // tests. If the bot were to run the tests very slowly and we hadn't disabled |
94 // polling, then it might start a background re-try in the middle of our test | 94 // polling, then it might start a background re-try in the middle of our test |
95 // and confuse our expectations leading to flaky failures. | 95 // and confuse our expectations leading to flaky failures. |
96 // | 96 // |
97 // The tests which verify the polling code re-enable the polling behavior but | 97 // The tests which verify the polling code re-enable the polling behavior but |
98 // are careful to avoid timing problems. | 98 // are careful to avoid timing problems. |
99 class ProxyServiceTest : public testing::Test { | 99 class ProxyServiceTest : public testing::Test { |
100 protected: | 100 protected: |
101 virtual void SetUp() override { | 101 void SetUp() override { |
102 testing::Test::SetUp(); | 102 testing::Test::SetUp(); |
103 previous_policy_ = | 103 previous_policy_ = |
104 ProxyService::set_pac_script_poll_policy(&never_poll_policy_); | 104 ProxyService::set_pac_script_poll_policy(&never_poll_policy_); |
105 } | 105 } |
106 | 106 |
107 virtual void TearDown() override { | 107 void TearDown() override { |
108 // Restore the original policy. | 108 // Restore the original policy. |
109 ProxyService::set_pac_script_poll_policy(previous_policy_); | 109 ProxyService::set_pac_script_poll_policy(previous_policy_); |
110 testing::Test::TearDown(); | 110 testing::Test::TearDown(); |
111 } | 111 } |
112 | 112 |
113 private: | 113 private: |
114 NeverPollPolicy never_poll_policy_; | 114 NeverPollPolicy never_poll_policy_; |
115 const ProxyService::PacPollPolicy* previous_policy_; | 115 const ProxyService::PacPollPolicy* previous_policy_; |
116 }; | 116 }; |
117 | 117 |
(...skipping 3011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3129 url, net::LOAD_NORMAL, &info, NULL, log.bound()); | 3129 url, net::LOAD_NORMAL, &info, NULL, log.bound()); |
3130 EXPECT_TRUE(synchronous_success); | 3130 EXPECT_TRUE(synchronous_success); |
3131 EXPECT_FALSE(info.is_direct()); | 3131 EXPECT_FALSE(info.is_direct()); |
3132 EXPECT_EQ("foopy1", info.proxy_server().host_port_pair().host()); | 3132 EXPECT_EQ("foopy1", info.proxy_server().host_port_pair().host()); |
3133 | 3133 |
3134 // No request should have been queued. | 3134 // No request should have been queued. |
3135 EXPECT_EQ(0u, resolver->pending_requests().size()); | 3135 EXPECT_EQ(0u, resolver->pending_requests().size()); |
3136 } | 3136 } |
3137 | 3137 |
3138 } // namespace net | 3138 } // namespace net |
OLD | NEW |