Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: content/browser/resolve_proxy_msg_helper_unittest.cc

Issue 8340028: Salient parts of http://codereview.chromium.org/8392042/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/common/view_messages.h" 7 #include "content/common/view_messages.h"
8 #include "content/test/test_browser_thread.h"
8 #include "ipc/ipc_test_sink.h" 9 #include "ipc/ipc_test_sink.h"
9 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
10 #include "net/proxy/mock_proxy_resolver.h" 11 #include "net/proxy/mock_proxy_resolver.h"
11 #include "net/proxy/proxy_config_service.h" 12 #include "net/proxy/proxy_config_service.h"
12 #include "net/proxy/proxy_service.h" 13 #include "net/proxy/proxy_service.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 // This ProxyConfigService always returns "http://pac" as the PAC url to use. 16 // This ProxyConfigService always returns "http://pac" as the PAC url to use.
16 class MockProxyConfigService : public net::ProxyConfigService { 17 class MockProxyConfigService : public net::ProxyConfigService {
17 public: 18 public:
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 virtual bool OnMessageReceived(const IPC::Message& msg) { 71 virtual bool OnMessageReceived(const IPC::Message& msg) {
71 TupleTypes<ViewHostMsg_ResolveProxy::ReplyParam>::ValueTuple reply_data; 72 TupleTypes<ViewHostMsg_ResolveProxy::ReplyParam>::ValueTuple reply_data;
72 EXPECT_TRUE(ViewHostMsg_ResolveProxy::ReadReplyParam(&msg, &reply_data)); 73 EXPECT_TRUE(ViewHostMsg_ResolveProxy::ReadReplyParam(&msg, &reply_data));
73 DCHECK(!pending_result_.get()); 74 DCHECK(!pending_result_.get());
74 pending_result_.reset(new PendingResult(reply_data.a, reply_data.b)); 75 pending_result_.reset(new PendingResult(reply_data.a, reply_data.b));
75 test_sink_.ClearMessages(); 76 test_sink_.ClearMessages();
76 return true; 77 return true;
77 } 78 }
78 79
79 MessageLoop message_loop_; 80 MessageLoop message_loop_;
80 BrowserThread io_thread_; 81 content::TestBrowserThread io_thread_;
81 IPC::TestSink test_sink_; 82 IPC::TestSink test_sink_;
82 }; 83 };
83 84
84 // Issue three sequential requests -- each should succeed. 85 // Issue three sequential requests -- each should succeed.
85 TEST_F(ResolveProxyMsgHelperTest, Sequential) { 86 TEST_F(ResolveProxyMsgHelperTest, Sequential) {
86 GURL url1("http://www.google1.com/"); 87 GURL url1("http://www.google1.com/");
87 GURL url2("http://www.google2.com/"); 88 GURL url2("http://www.google2.com/");
88 GURL url3("http://www.google3.com/"); 89 GURL url3("http://www.google3.com/");
89 90
90 // Messages are deleted by the sink. 91 // Messages are deleted by the sink.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 226
226 // The pending requests sent to the proxy resolver should have been cancelled. 227 // The pending requests sent to the proxy resolver should have been cancelled.
227 228
228 EXPECT_EQ(0u, resolver_->pending_requests().size()); 229 EXPECT_EQ(0u, resolver_->pending_requests().size());
229 230
230 EXPECT_TRUE(pending_result() == NULL); 231 EXPECT_TRUE(pending_result() == NULL);
231 232
232 // It should also be the case that msg1, msg2, msg3 were deleted by the 233 // It should also be the case that msg1, msg2, msg3 were deleted by the
233 // cancellation. (Else will show up as a leak in Valgrind). 234 // cancellation. (Else will show up as a leak in Valgrind).
234 } 235 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/text_input_client_message_filter.mm ('k') | content/browser/resource_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698