| 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/multi_threaded_proxy_resolver.h" | 5 #include "net/proxy/multi_threaded_proxy_resolver.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 const BoundNetLog& net_log) OVERRIDE { | 42 const BoundNetLog& net_log) OVERRIDE { |
| 43 if (resolve_latency_ != base::TimeDelta()) | 43 if (resolve_latency_ != base::TimeDelta()) |
| 44 base::PlatformThread::Sleep(resolve_latency_); | 44 base::PlatformThread::Sleep(resolve_latency_); |
| 45 | 45 |
| 46 CheckIsOnWorkerThread(); | 46 CheckIsOnWorkerThread(); |
| 47 | 47 |
| 48 EXPECT_TRUE(callback.is_null()); | 48 EXPECT_TRUE(callback.is_null()); |
| 49 EXPECT_TRUE(request == NULL); | 49 EXPECT_TRUE(request == NULL); |
| 50 | 50 |
| 51 // Write something into |net_log| (doesn't really have any meaning.) | 51 // Write something into |net_log| (doesn't really have any meaning.) |
| 52 net_log.BeginEvent(NetLog::TYPE_PAC_JAVASCRIPT_DNS_RESOLVE, NULL); | 52 net_log.BeginEvent(NetLog::TYPE_PAC_JAVASCRIPT_DNS_RESOLVE); |
| 53 | 53 |
| 54 results->UseNamedProxy(query_url.host()); | 54 results->UseNamedProxy(query_url.host()); |
| 55 | 55 |
| 56 // Return a success code which represents the request's order. | 56 // Return a success code which represents the request's order. |
| 57 return request_count_++; | 57 return request_count_++; |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void CancelRequest(RequestHandle request) OVERRIDE { | 60 virtual void CancelRequest(RequestHandle request) OVERRIDE { |
| 61 NOTREACHED(); | 61 NOTREACHED(); |
| 62 } | 62 } |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 // All in all, the first thread should have seen just 1 request. And the | 789 // All in all, the first thread should have seen just 1 request. And the |
| 790 // second thread 3 requests. | 790 // second thread 3 requests. |
| 791 ASSERT_EQ(2u, factory->resolvers().size()); | 791 ASSERT_EQ(2u, factory->resolvers().size()); |
| 792 EXPECT_EQ(1, factory->resolvers()[0]->request_count()); | 792 EXPECT_EQ(1, factory->resolvers()[0]->request_count()); |
| 793 EXPECT_EQ(3, factory->resolvers()[1]->request_count()); | 793 EXPECT_EQ(3, factory->resolvers()[1]->request_count()); |
| 794 } | 794 } |
| 795 | 795 |
| 796 } // namespace | 796 } // namespace |
| 797 | 797 |
| 798 } // namespace net | 798 } // namespace net |
| OLD | NEW |