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/run_loop.h" | 7 #include "base/run_loop.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/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 MockProxyScriptFetcher* fetcher_; | 137 MockProxyScriptFetcher* fetcher_; |
138 base::OneShotTimer fetcher_timer_; | 138 base::OneShotTimer fetcher_timer_; |
139 scoped_refptr<DelayingDhcpQuery> dhcp_query_; | 139 scoped_refptr<DelayingDhcpQuery> dhcp_query_; |
140 }; | 140 }; |
141 | 141 |
142 class FetcherClient { | 142 class FetcherClient { |
143 public: | 143 public: |
144 FetcherClient() | 144 FetcherClient() |
145 : url_request_context_(new TestURLRequestContext()), | 145 : url_request_context_(new TestURLRequestContext()), |
146 worker_pool_( | 146 worker_pool_( |
147 new base::SequencedWorkerPool(4, "DhcpAdapterFetcherTest")), | 147 new base::SequencedWorkerPool(4, |
| 148 "DhcpAdapterFetcherTest", |
| 149 base::TaskPriority::USER_VISIBLE)), |
148 fetcher_(new MockDhcpProxyScriptAdapterFetcher( | 150 fetcher_(new MockDhcpProxyScriptAdapterFetcher( |
149 url_request_context_.get(), | 151 url_request_context_.get(), |
150 worker_pool_->GetTaskRunnerWithShutdownBehavior( | 152 worker_pool_->GetTaskRunnerWithShutdownBehavior( |
151 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN))) { | 153 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN))) {} |
152 } | |
153 | 154 |
154 ~FetcherClient() { | 155 ~FetcherClient() { |
155 worker_pool_->Shutdown(); | 156 worker_pool_->Shutdown(); |
156 } | 157 } |
157 | 158 |
158 void WaitForResult(int expected_error) { | 159 void WaitForResult(int expected_error) { |
159 EXPECT_EQ(expected_error, callback_.WaitForResult()); | 160 EXPECT_EQ(expected_error, callback_.WaitForResult()); |
160 } | 161 } |
161 | 162 |
162 void RunTest() { | 163 void RunTest() { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 EXPECT_EQ(BASE_URL, | 336 EXPECT_EQ(BASE_URL, |
336 DhcpProxyScriptAdapterFetcher::SanitizeDhcpApiString( | 337 DhcpProxyScriptAdapterFetcher::SanitizeDhcpApiString( |
337 BASE_URL "\0foo\0blat", kBaseUrlLen + 9)); | 338 BASE_URL "\0foo\0blat", kBaseUrlLen + 9)); |
338 } | 339 } |
339 | 340 |
340 #undef BASE_URL | 341 #undef BASE_URL |
341 | 342 |
342 } // namespace | 343 } // namespace |
343 | 344 |
344 } // namespace net | 345 } // namespace net |
OLD | NEW |