| 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 "content/browser/browser_thread_impl.h" | 7 #include "content/browser/browser_thread_impl.h" |
| 8 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
| 9 #include "ipc/ipc_test_sink.h" | 9 #include "ipc/ipc_test_sink.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 net::MockAsyncProxyResolver* resolver_; | 83 net::MockAsyncProxyResolver* resolver_; |
| 84 scoped_ptr<net::ProxyService> service_; | 84 scoped_ptr<net::ProxyService> service_; |
| 85 scoped_refptr<ResolveProxyMsgHelper> helper_; | 85 scoped_refptr<ResolveProxyMsgHelper> helper_; |
| 86 scoped_ptr<PendingResult> pending_result_; | 86 scoped_ptr<PendingResult> pending_result_; |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 bool OnMessageReceived(const IPC::Message& msg) override { | 89 bool OnMessageReceived(const IPC::Message& msg) override { |
| 90 TupleTypes<ViewHostMsg_ResolveProxy::ReplyParam>::ValueTuple reply_data; | 90 TupleTypes<ViewHostMsg_ResolveProxy::ReplyParam>::ValueTuple reply_data; |
| 91 EXPECT_TRUE(ViewHostMsg_ResolveProxy::ReadReplyParam(&msg, &reply_data)); | 91 EXPECT_TRUE(ViewHostMsg_ResolveProxy::ReadReplyParam(&msg, &reply_data)); |
| 92 DCHECK(!pending_result_.get()); | 92 DCHECK(!pending_result_.get()); |
| 93 pending_result_.reset(new PendingResult(reply_data.a, reply_data.b)); | 93 pending_result_.reset( |
| 94 new PendingResult(get<0>(reply_data), get<1>(reply_data))); |
| 94 test_sink_.ClearMessages(); | 95 test_sink_.ClearMessages(); |
| 95 return true; | 96 return true; |
| 96 } | 97 } |
| 97 | 98 |
| 98 base::MessageLoopForIO message_loop_; | 99 base::MessageLoopForIO message_loop_; |
| 99 BrowserThreadImpl io_thread_; | 100 BrowserThreadImpl io_thread_; |
| 100 IPC::TestSink test_sink_; | 101 IPC::TestSink test_sink_; |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 // Issue three sequential requests -- each should succeed. | 104 // Issue three sequential requests -- each should succeed. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 | 247 |
| 247 EXPECT_EQ(0u, resolver_->pending_requests().size()); | 248 EXPECT_EQ(0u, resolver_->pending_requests().size()); |
| 248 | 249 |
| 249 EXPECT_TRUE(pending_result() == NULL); | 250 EXPECT_TRUE(pending_result() == NULL); |
| 250 | 251 |
| 251 // It should also be the case that msg1, msg2, msg3 were deleted by the | 252 // It should also be the case that msg1, msg2, msg3 were deleted by the |
| 252 // cancellation. (Else will show up as a leak in Valgrind). | 253 // cancellation. (Else will show up as a leak in Valgrind). |
| 253 } | 254 } |
| 254 | 255 |
| 255 } // namespace content | 256 } // namespace content |
| OLD | NEW |