| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 new ProxyScriptFetcherImpl(url_request_context_); | 264 new ProxyScriptFetcherImpl(url_request_context_); |
| 265 return fetcher; | 265 return fetcher; |
| 266 } | 266 } |
| 267 | 267 |
| 268 URLRequestContext* url_request_context_; | 268 URLRequestContext* url_request_context_; |
| 269 }; | 269 }; |
| 270 | 270 |
| 271 TEST(DhcpProxyScriptAdapterFetcher, MockDhcpRealFetch) { | 271 TEST(DhcpProxyScriptAdapterFetcher, MockDhcpRealFetch) { |
| 272 TestServer test_server( | 272 TestServer test_server( |
| 273 TestServer::TYPE_HTTP, | 273 TestServer::TYPE_HTTP, |
| 274 net::TestServer::kLocalhost, |
| 274 FilePath(FILE_PATH_LITERAL("net/data/proxy_script_fetcher_unittest"))); | 275 FilePath(FILE_PATH_LITERAL("net/data/proxy_script_fetcher_unittest"))); |
| 275 ASSERT_TRUE(test_server.Start()); | 276 ASSERT_TRUE(test_server.Start()); |
| 276 | 277 |
| 277 GURL configured_url = test_server.GetURL("files/downloadable.pac"); | 278 GURL configured_url = test_server.GetURL("files/downloadable.pac"); |
| 278 | 279 |
| 279 FetcherClient client; | 280 FetcherClient client; |
| 280 scoped_refptr<URLRequestContext> url_request_context( | 281 scoped_refptr<URLRequestContext> url_request_context( |
| 281 new TestURLRequestContext()); | 282 new TestURLRequestContext()); |
| 282 client.fetcher_.reset( | 283 client.fetcher_.reset( |
| 283 new MockDhcpRealFetchProxyScriptAdapterFetcher( | 284 new MockDhcpRealFetchProxyScriptAdapterFetcher( |
| 284 url_request_context.get())); | 285 url_request_context.get())); |
| 285 client.fetcher_->configured_url_ = configured_url.spec(); | 286 client.fetcher_->configured_url_ = configured_url.spec(); |
| 286 client.RunTest(); | 287 client.RunTest(); |
| 287 client.WaitForResult(OK); | 288 client.WaitForResult(OK); |
| 288 ASSERT_TRUE(client.fetcher_->DidFinish()); | 289 ASSERT_TRUE(client.fetcher_->DidFinish()); |
| 289 EXPECT_EQ(OK, client.fetcher_->GetResult()); | 290 EXPECT_EQ(OK, client.fetcher_->GetResult()); |
| 290 EXPECT_EQ(string16(L"-downloadable.pac-\n"), client.fetcher_->GetPacScript()); | 291 EXPECT_EQ(string16(L"-downloadable.pac-\n"), client.fetcher_->GetPacScript()); |
| 291 EXPECT_EQ(configured_url, | 292 EXPECT_EQ(configured_url, |
| 292 client.fetcher_->GetPacURL()); | 293 client.fetcher_->GetPacURL()); |
| 293 } | 294 } |
| 294 | 295 |
| 295 } // namespace | 296 } // namespace |
| 296 | 297 |
| 297 } // namespace net | 298 } // namespace net |
| OLD | NEW |