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/dhcp_proxy_script_adapter_fetcher_win.h" | 5 #include "net/proxy/dhcp_proxy_script_adapter_fetcher_win.h" |
6 | 6 |
7 #include "base/perftimer.h" | 7 #include "base/perftimer.h" |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
10 #include "base/timer.h" | 10 #include "base/timer.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void RunTest() { | 143 void RunTest() { |
144 fetcher_->Fetch("adapter name", callback_.callback()); | 144 fetcher_->Fetch("adapter name", callback_.callback()); |
145 } | 145 } |
146 | 146 |
147 void FinishTestAllowCleanup() { | 147 void FinishTestAllowCleanup() { |
148 fetcher_->FinishTest(); | 148 fetcher_->FinishTest(); |
149 MessageLoop::current()->RunAllPending(); | 149 MessageLoop::current()->RunAllPending(); |
150 } | 150 } |
151 | 151 |
152 TestCompletionCallback callback_; | 152 TestCompletionCallback callback_; |
153 scoped_refptr<URLRequestContext> url_request_context_; | 153 scoped_ptr<URLRequestContext> url_request_context_; |
154 scoped_ptr<MockDhcpProxyScriptAdapterFetcher> fetcher_; | 154 scoped_ptr<MockDhcpProxyScriptAdapterFetcher> fetcher_; |
155 string16 pac_text_; | 155 string16 pac_text_; |
156 }; | 156 }; |
157 | 157 |
158 TEST(DhcpProxyScriptAdapterFetcher, NormalCaseURLNotInDhcp) { | 158 TEST(DhcpProxyScriptAdapterFetcher, NormalCaseURLNotInDhcp) { |
159 FetcherClient client; | 159 FetcherClient client; |
160 client.fetcher_->configured_url_ = ""; | 160 client.fetcher_->configured_url_ = ""; |
161 client.RunTest(); | 161 client.RunTest(); |
162 client.WaitForResult(ERR_PAC_NOT_IN_DHCP); | 162 client.WaitForResult(ERR_PAC_NOT_IN_DHCP); |
163 ASSERT_TRUE(client.fetcher_->DidFinish()); | 163 ASSERT_TRUE(client.fetcher_->DidFinish()); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 ASSERT_TRUE(client.fetcher_->DidFinish()); | 289 ASSERT_TRUE(client.fetcher_->DidFinish()); |
290 EXPECT_EQ(OK, client.fetcher_->GetResult()); | 290 EXPECT_EQ(OK, client.fetcher_->GetResult()); |
291 EXPECT_EQ(string16(L"-downloadable.pac-\n"), client.fetcher_->GetPacScript()); | 291 EXPECT_EQ(string16(L"-downloadable.pac-\n"), client.fetcher_->GetPacScript()); |
292 EXPECT_EQ(configured_url, | 292 EXPECT_EQ(configured_url, |
293 client.fetcher_->GetPacURL()); | 293 client.fetcher_->GetPacURL()); |
294 } | 294 } |
295 | 295 |
296 } // namespace | 296 } // namespace |
297 | 297 |
298 } // namespace net | 298 } // namespace net |
OLD | NEW |