OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 void Cancel() { | 46 void Cancel() { |
47 DhcpProxyScriptAdapterFetcher::Cancel(); | 47 DhcpProxyScriptAdapterFetcher::Cancel(); |
48 fetcher_ = NULL; | 48 fetcher_ = NULL; |
49 } | 49 } |
50 | 50 |
51 virtual ProxyScriptFetcher* ImplCreateScriptFetcher() OVERRIDE { | 51 virtual ProxyScriptFetcher* ImplCreateScriptFetcher() OVERRIDE { |
52 // We don't maintain ownership of the fetcher, it is transferred to | 52 // We don't maintain ownership of the fetcher, it is transferred to |
53 // the caller. | 53 // the caller. |
54 fetcher_ = new MockProxyScriptFetcher(); | 54 fetcher_ = new MockProxyScriptFetcher(); |
55 if (fetcher_delay_ms_ != -1) { | 55 if (fetcher_delay_ms_ != -1) { |
56 fetcher_timer_.Start(FROM_HERE, | 56 fetcher_timer_.Start( |
57 base::TimeDelta::FromMilliseconds(fetcher_delay_ms_), | 57 base::TimeDelta::FromMilliseconds(fetcher_delay_ms_), |
58 this, &MockDhcpProxyScriptAdapterFetcher::OnFetcherTimer); | 58 this, &MockDhcpProxyScriptAdapterFetcher::OnFetcherTimer); |
59 } | 59 } |
60 return fetcher_; | 60 return fetcher_; |
61 } | 61 } |
62 | 62 |
63 class DelayingWorkerThread : public WorkerThread { | 63 class DelayingWorkerThread : public WorkerThread { |
64 public: | 64 public: |
65 explicit DelayingWorkerThread( | 65 explicit DelayingWorkerThread( |
66 const base::WeakPtr<DhcpProxyScriptAdapterFetcher>& owner) | 66 const base::WeakPtr<DhcpProxyScriptAdapterFetcher>& owner) |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 ASSERT_TRUE(client.fetcher_->DidFinish()); | 290 ASSERT_TRUE(client.fetcher_->DidFinish()); |
291 EXPECT_EQ(OK, client.fetcher_->GetResult()); | 291 EXPECT_EQ(OK, client.fetcher_->GetResult()); |
292 EXPECT_EQ(string16(L"-downloadable.pac-\n"), client.fetcher_->GetPacScript()); | 292 EXPECT_EQ(string16(L"-downloadable.pac-\n"), client.fetcher_->GetPacScript()); |
293 EXPECT_EQ(configured_url, | 293 EXPECT_EQ(configured_url, |
294 client.fetcher_->GetPacURL()); | 294 client.fetcher_->GetPacURL()); |
295 } | 295 } |
296 | 296 |
297 } // namespace | 297 } // namespace |
298 | 298 |
299 } // namespace net | 299 } // namespace net |
OLD | NEW |