| 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/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
| 9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
| 10 #include "base/timer/elapsed_timer.h" | 10 #include "base/timer/elapsed_timer.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 base::TimeDelta::FromMilliseconds(fetcher_delay_ms_), | 60 base::TimeDelta::FromMilliseconds(fetcher_delay_ms_), |
| 61 this, &MockDhcpProxyScriptAdapterFetcher::OnFetcherTimer); | 61 this, &MockDhcpProxyScriptAdapterFetcher::OnFetcherTimer); |
| 62 } | 62 } |
| 63 return fetcher_; | 63 return fetcher_; |
| 64 } | 64 } |
| 65 | 65 |
| 66 class DelayingDhcpQuery : public DhcpQuery { | 66 class DelayingDhcpQuery : public DhcpQuery { |
| 67 public: | 67 public: |
| 68 explicit DelayingDhcpQuery() | 68 explicit DelayingDhcpQuery() |
| 69 : DhcpQuery(), | 69 : DhcpQuery(), |
| 70 test_finished_event_(true, false) { | 70 test_finished_event_( |
| 71 } | 71 base::WaitableEvent::ResetPolicy::MANUAL, |
| 72 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
| 72 | 73 |
| 73 std::string ImplGetPacURLFromDhcp( | 74 std::string ImplGetPacURLFromDhcp( |
| 74 const std::string& adapter_name) override { | 75 const std::string& adapter_name) override { |
| 75 base::ElapsedTimer timer; | 76 base::ElapsedTimer timer; |
| 76 test_finished_event_.TimedWait(dhcp_delay_); | 77 test_finished_event_.TimedWait(dhcp_delay_); |
| 77 return configured_url_; | 78 return configured_url_; |
| 78 } | 79 } |
| 79 | 80 |
| 80 base::WaitableEvent test_finished_event_; | 81 base::WaitableEvent test_finished_event_; |
| 81 base::TimeDelta dhcp_delay_; | 82 base::TimeDelta dhcp_delay_; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 EXPECT_EQ(BASE_URL, | 329 EXPECT_EQ(BASE_URL, |
| 329 DhcpProxyScriptAdapterFetcher::SanitizeDhcpApiString( | 330 DhcpProxyScriptAdapterFetcher::SanitizeDhcpApiString( |
| 330 BASE_URL "\0foo\0blat", kBaseUrlLen + 9)); | 331 BASE_URL "\0foo\0blat", kBaseUrlLen + 9)); |
| 331 } | 332 } |
| 332 | 333 |
| 333 #undef BASE_URL | 334 #undef BASE_URL |
| 334 | 335 |
| 335 } // namespace | 336 } // namespace |
| 336 | 337 |
| 337 } // namespace net | 338 } // namespace net |
| OLD | NEW |