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

Side by Side Diff: chrome/browser/net/resolve_proxy_msg_helper_unittest.cc

Issue 6597070: Allow ProxyConfigService to report "no configuration set" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment Created 9 years, 9 months 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) 2010 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 "chrome/browser/net/resolve_proxy_msg_helper.h" 5 #include "chrome/browser/net/resolve_proxy_msg_helper.h"
6 6
7 #include "net/base/net_errors.h" 7 #include "net/base/net_errors.h"
8 #include "net/proxy/mock_proxy_resolver.h" 8 #include "net/proxy/mock_proxy_resolver.h"
9 #include "net/proxy/proxy_config_service.h" 9 #include "net/proxy/proxy_config_service.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 // This ProxyConfigService always returns "http://pac" as the PAC url to use. 12 // This ProxyConfigService always returns "http://pac" as the PAC url to use.
13 class MockProxyConfigService : public net::ProxyConfigService { 13 class MockProxyConfigService : public net::ProxyConfigService {
14 public: 14 public:
15 virtual void AddObserver(Observer* observer) {} 15 virtual void AddObserver(Observer* observer) {}
16 virtual void RemoveObserver(Observer* observer) {} 16 virtual void RemoveObserver(Observer* observer) {}
17 virtual bool GetLatestProxyConfig(net::ProxyConfig* results) { 17 virtual ConfigAvailability GetLatestProxyConfig(net::ProxyConfig* results) {
18 *results = net::ProxyConfig::CreateFromCustomPacURL(GURL("http://pac")); 18 *results = net::ProxyConfig::CreateFromCustomPacURL(GURL("http://pac"));
19 return true; 19 return CONFIG_VALID;
20 } 20 }
21 }; 21 };
22 22
23 class MyDelegate : public ResolveProxyMsgHelper::Delegate { 23 class MyDelegate : public ResolveProxyMsgHelper::Delegate {
24 public: 24 public:
25 struct PendingResult { 25 struct PendingResult {
26 PendingResult(IPC::Message* msg, 26 PendingResult(IPC::Message* msg,
27 int error_code, 27 int error_code,
28 const std::string& proxy_list) 28 const std::string& proxy_list)
29 : msg(msg), error_code(error_code), proxy_list(proxy_list) { 29 : msg(msg), error_code(error_code), proxy_list(proxy_list) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 // The pending requests sent to the proxy resolver should have been cancelled. 225 // The pending requests sent to the proxy resolver should have been cancelled.
226 226
227 EXPECT_EQ(0u, resolver->pending_requests().size()); 227 EXPECT_EQ(0u, resolver->pending_requests().size());
228 228
229 EXPECT_TRUE(delegate.pending_result() == NULL); 229 EXPECT_TRUE(delegate.pending_result() == NULL);
230 230
231 // It should also be the case that msg1, msg2, msg3 were deleted by the 231 // It should also be the case that msg1, msg2, msg3 were deleted by the
232 // cancellation. (Else will show up as a leak in Purify/Valgrind). 232 // cancellation. (Else will show up as a leak in Purify/Valgrind).
233 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698