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

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

Issue 8400060: Switch content tests to use BrowserThreadImpl directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to lkgr 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 | Annotate | Revision Log
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/browser/browser_thread_impl.h"
7 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
8 #include "content/test/test_browser_thread.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"
11 #include "net/proxy/mock_proxy_resolver.h" 11 #include "net/proxy/mock_proxy_resolver.h"
12 #include "net/proxy/proxy_config_service.h" 12 #include "net/proxy/proxy_config_service.h"
13 #include "net/proxy/proxy_service.h" 13 #include "net/proxy/proxy_service.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 using content::BrowserThreadImpl;
17
16 // This ProxyConfigService always returns "http://pac" as the PAC url to use. 18 // This ProxyConfigService always returns "http://pac" as the PAC url to use.
17 class MockProxyConfigService : public net::ProxyConfigService { 19 class MockProxyConfigService : public net::ProxyConfigService {
18 public: 20 public:
19 virtual void AddObserver(Observer* observer) {} 21 virtual void AddObserver(Observer* observer) {}
20 virtual void RemoveObserver(Observer* observer) {} 22 virtual void RemoveObserver(Observer* observer) {}
21 virtual ConfigAvailability GetLatestProxyConfig(net::ProxyConfig* results) { 23 virtual ConfigAvailability GetLatestProxyConfig(net::ProxyConfig* results) {
22 *results = net::ProxyConfig::CreateFromCustomPacURL(GURL("http://pac")); 24 *results = net::ProxyConfig::CreateFromCustomPacURL(GURL("http://pac"));
23 return CONFIG_VALID; 25 return CONFIG_VALID;
24 } 26 }
25 }; 27 };
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 virtual bool OnMessageReceived(const IPC::Message& msg) { 73 virtual bool OnMessageReceived(const IPC::Message& msg) {
72 TupleTypes<ViewHostMsg_ResolveProxy::ReplyParam>::ValueTuple reply_data; 74 TupleTypes<ViewHostMsg_ResolveProxy::ReplyParam>::ValueTuple reply_data;
73 EXPECT_TRUE(ViewHostMsg_ResolveProxy::ReadReplyParam(&msg, &reply_data)); 75 EXPECT_TRUE(ViewHostMsg_ResolveProxy::ReadReplyParam(&msg, &reply_data));
74 DCHECK(!pending_result_.get()); 76 DCHECK(!pending_result_.get());
75 pending_result_.reset(new PendingResult(reply_data.a, reply_data.b)); 77 pending_result_.reset(new PendingResult(reply_data.a, reply_data.b));
76 test_sink_.ClearMessages(); 78 test_sink_.ClearMessages();
77 return true; 79 return true;
78 } 80 }
79 81
80 MessageLoop message_loop_; 82 MessageLoop message_loop_;
81 content::TestBrowserThread io_thread_; 83 BrowserThreadImpl io_thread_;
82 IPC::TestSink test_sink_; 84 IPC::TestSink test_sink_;
83 }; 85 };
84 86
85 // Issue three sequential requests -- each should succeed. 87 // Issue three sequential requests -- each should succeed.
86 TEST_F(ResolveProxyMsgHelperTest, Sequential) { 88 TEST_F(ResolveProxyMsgHelperTest, Sequential) {
87 GURL url1("http://www.google1.com/"); 89 GURL url1("http://www.google1.com/");
88 GURL url2("http://www.google2.com/"); 90 GURL url2("http://www.google2.com/");
89 GURL url3("http://www.google3.com/"); 91 GURL url3("http://www.google3.com/");
90 92
91 // Messages are deleted by the sink. 93 // Messages are deleted by the sink.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 228
227 // The pending requests sent to the proxy resolver should have been cancelled. 229 // The pending requests sent to the proxy resolver should have been cancelled.
228 230
229 EXPECT_EQ(0u, resolver_->pending_requests().size()); 231 EXPECT_EQ(0u, resolver_->pending_requests().size());
230 232
231 EXPECT_TRUE(pending_result() == NULL); 233 EXPECT_TRUE(pending_result() == NULL);
232 234
233 // It should also be the case that msg1, msg2, msg3 were deleted by the 235 // It should also be the case that msg1, msg2, msg3 were deleted by the
234 // cancellation. (Else will show up as a leak in Valgrind). 236 // cancellation. (Else will show up as a leak in Valgrind).
235 } 237 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/resource_queue_unittest.cc ('k') | content/browser/site_instance_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698