| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 net::TestServer::kLocalhost, |
| 275 base::FilePath( | 275 net::TestServer::GetSourceRelativePath(base::FilePath(FILE_PATH_LITERAL( |
| 276 FILE_PATH_LITERAL("net/data/proxy_script_fetcher_unittest"))); | 276 "net/data/proxy_script_fetcher_unittest")))); |
| 277 ASSERT_TRUE(test_server.Start()); | 277 ASSERT_TRUE(test_server.Start()); |
| 278 | 278 |
| 279 GURL configured_url = test_server.GetURL("files/downloadable.pac"); | 279 GURL configured_url = test_server.GetURL("files/downloadable.pac"); |
| 280 | 280 |
| 281 FetcherClient client; | 281 FetcherClient client; |
| 282 TestURLRequestContext url_request_context; | 282 TestURLRequestContext url_request_context; |
| 283 client.fetcher_.reset( | 283 client.fetcher_.reset( |
| 284 new MockDhcpRealFetchProxyScriptAdapterFetcher( | 284 new MockDhcpRealFetchProxyScriptAdapterFetcher( |
| 285 &url_request_context)); | 285 &url_request_context)); |
| 286 client.fetcher_->configured_url_ = configured_url.spec(); | 286 client.fetcher_->configured_url_ = configured_url.spec(); |
| 287 client.RunTest(); | 287 client.RunTest(); |
| 288 client.WaitForResult(OK); | 288 client.WaitForResult(OK); |
| 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 |