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/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "net/base/net_log.h" | 15 #include "net/base/net_log.h" |
16 #include "net/base/net_log_unittest.h" | 16 #include "net/base/net_log_unittest.h" |
17 #include "net/base/test_completion_callback.h" | 17 #include "net/base/test_completion_callback.h" |
18 #include "net/proxy/proxy_info.h" | 18 #include "net/proxy/proxy_info.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
| 22 using base::ASCIIToUTF16; |
| 23 |
22 namespace net { | 24 namespace net { |
23 | 25 |
24 namespace { | 26 namespace { |
25 | 27 |
26 // A synchronous mock ProxyResolver implementation, which can be used in | 28 // A synchronous mock ProxyResolver implementation, which can be used in |
27 // conjunction with MultiThreadedProxyResolver. | 29 // conjunction with MultiThreadedProxyResolver. |
28 // - returns a single-item proxy list with the query's host. | 30 // - returns a single-item proxy list with the query's host. |
29 class MockProxyResolver : public ProxyResolver { | 31 class MockProxyResolver : public ProxyResolver { |
30 public: | 32 public: |
31 MockProxyResolver() | 33 MockProxyResolver() |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 // All in all, the first thread should have seen just 1 request. And the | 779 // All in all, the first thread should have seen just 1 request. And the |
778 // second thread 3 requests. | 780 // second thread 3 requests. |
779 ASSERT_EQ(2u, factory->resolvers().size()); | 781 ASSERT_EQ(2u, factory->resolvers().size()); |
780 EXPECT_EQ(1, factory->resolvers()[0]->request_count()); | 782 EXPECT_EQ(1, factory->resolvers()[0]->request_count()); |
781 EXPECT_EQ(3, factory->resolvers()[1]->request_count()); | 783 EXPECT_EQ(3, factory->resolvers()[1]->request_count()); |
782 } | 784 } |
783 | 785 |
784 } // namespace | 786 } // namespace |
785 | 787 |
786 } // namespace net | 788 } // namespace net |
OLD | NEW |