OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/waitable_event.h" | 5 #include "base/waitable_event.h" |
6 #include "googleurl/src/gurl.h" | 6 #include "googleurl/src/gurl.h" |
7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
8 #include "net/base/test_completion_callback.h" | 8 #include "net/base/test_completion_callback.h" |
9 #include "net/proxy/proxy_info.h" | 9 #include "net/proxy/proxy_info.h" |
10 #include "net/proxy/single_threaded_proxy_resolver.h" | 10 #include "net/proxy/single_threaded_proxy_resolver.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // ProxyResolver implementation: | 27 // ProxyResolver implementation: |
28 virtual int GetProxyForURL(const GURL& query_url, | 28 virtual int GetProxyForURL(const GURL& query_url, |
29 ProxyInfo* results, | 29 ProxyInfo* results, |
30 CompletionCallback* callback, | 30 CompletionCallback* callback, |
31 RequestHandle* request) { | 31 RequestHandle* request) { |
32 if (resolve_latency_ms_) | 32 if (resolve_latency_ms_) |
33 PlatformThread::Sleep(resolve_latency_ms_); | 33 PlatformThread::Sleep(resolve_latency_ms_); |
34 | 34 |
35 CheckIsOnWorkerThread(); | 35 CheckIsOnWorkerThread(); |
36 | 36 |
37 EXPECT_TRUE(NULL == callback); | 37 EXPECT_EQ(NULL, callback); |
38 EXPECT_TRUE(NULL == request); | 38 EXPECT_EQ(NULL, request); |
39 | 39 |
40 results->UseNamedProxy(query_url.host()); | 40 results->UseNamedProxy(query_url.host()); |
41 | 41 |
42 // Return a success code which represents the request's order. | 42 // Return a success code which represents the request's order. |
43 return request_count_++; | 43 return request_count_++; |
44 } | 44 } |
45 | 45 |
46 virtual void CancelRequest(RequestHandle request) { | 46 virtual void CancelRequest(RequestHandle request) { |
47 NOTREACHED(); | 47 NOTREACHED(); |
48 } | 48 } |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 rv = callback1.WaitForResult(); | 361 rv = callback1.WaitForResult(); |
362 EXPECT_EQ(1, rv); | 362 EXPECT_EQ(1, rv); |
363 EXPECT_EQ("PROXY request1:80", results1.ToPacString()); | 363 EXPECT_EQ("PROXY request1:80", results1.ToPacString()); |
364 | 364 |
365 // The SetPacScript callback should never have been completed. | 365 // The SetPacScript callback should never have been completed. |
366 EXPECT_FALSE(set_pac_script_callback.have_result()); | 366 EXPECT_FALSE(set_pac_script_callback.have_result()); |
367 } | 367 } |
368 | 368 |
369 } // namespace | 369 } // namespace |
370 } // namespace net | 370 } // namespace net |
OLD | NEW |