OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/resolve_proxy_msg_helper.h" | 5 #include "content/browser/resolve_proxy_msg_helper.h" |
6 | 6 |
| 7 #include <tuple> |
| 8 |
7 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
8 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
9 #include "content/common/view_messages.h" | 11 #include "content/common/view_messages.h" |
10 #include "ipc/ipc_test_sink.h" | 12 #include "ipc/ipc_test_sink.h" |
11 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
12 #include "net/proxy/mock_proxy_resolver.h" | 14 #include "net/proxy/mock_proxy_resolver.h" |
13 #include "net/proxy/proxy_config_service.h" | 15 #include "net/proxy/proxy_config_service.h" |
14 #include "net/proxy/proxy_service.h" | 16 #include "net/proxy/proxy_service.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
16 | 18 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 std::unique_ptr<net::ProxyService> service_; | 90 std::unique_ptr<net::ProxyService> service_; |
89 scoped_refptr<ResolveProxyMsgHelper> helper_; | 91 scoped_refptr<ResolveProxyMsgHelper> helper_; |
90 std::unique_ptr<PendingResult> pending_result_; | 92 std::unique_ptr<PendingResult> pending_result_; |
91 | 93 |
92 private: | 94 private: |
93 bool OnMessageReceived(const IPC::Message& msg) override { | 95 bool OnMessageReceived(const IPC::Message& msg) override { |
94 ViewHostMsg_ResolveProxy::ReplyParam reply_data; | 96 ViewHostMsg_ResolveProxy::ReplyParam reply_data; |
95 EXPECT_TRUE(ViewHostMsg_ResolveProxy::ReadReplyParam(&msg, &reply_data)); | 97 EXPECT_TRUE(ViewHostMsg_ResolveProxy::ReadReplyParam(&msg, &reply_data)); |
96 DCHECK(!pending_result_.get()); | 98 DCHECK(!pending_result_.get()); |
97 pending_result_.reset( | 99 pending_result_.reset( |
98 new PendingResult(base::get<0>(reply_data), base::get<1>(reply_data))); | 100 new PendingResult(std::get<0>(reply_data), std::get<1>(reply_data))); |
99 test_sink_.ClearMessages(); | 101 test_sink_.ClearMessages(); |
100 return true; | 102 return true; |
101 } | 103 } |
102 | 104 |
103 base::MessageLoopForIO message_loop_; | 105 base::MessageLoopForIO message_loop_; |
104 BrowserThreadImpl io_thread_; | 106 BrowserThreadImpl io_thread_; |
105 IPC::TestSink test_sink_; | 107 IPC::TestSink test_sink_; |
106 }; | 108 }; |
107 | 109 |
108 // Issue three sequential requests -- each should succeed. | 110 // Issue three sequential requests -- each should succeed. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 259 |
258 EXPECT_EQ(0u, resolver_.pending_requests().size()); | 260 EXPECT_EQ(0u, resolver_.pending_requests().size()); |
259 | 261 |
260 EXPECT_TRUE(pending_result() == NULL); | 262 EXPECT_TRUE(pending_result() == NULL); |
261 | 263 |
262 // It should also be the case that msg1, msg2, msg3 were deleted by the | 264 // It should also be the case that msg1, msg2, msg3 were deleted by the |
263 // cancellation. (Else will show up as a leak in Valgrind). | 265 // cancellation. (Else will show up as a leak in Valgrind). |
264 } | 266 } |
265 | 267 |
266 } // namespace content | 268 } // namespace content |
OLD | NEW |