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

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 Eric's comments. Created 9 years, 8 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) 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 "chrome/browser/net/resolve_proxy_msg_helper.h" 5 #include "chrome/browser/net/resolve_proxy_msg_helper.h"
6 6
7 #include "content/common/child_process_messages.h" 7 #include "content/common/child_process_messages.h"
8 #include "ipc/ipc_test_sink.h" 8 #include "ipc/ipc_test_sink.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/proxy/mock_proxy_resolver.h" 10 #include "net/proxy/mock_proxy_resolver.h"
11 #include "net/proxy/proxy_config_service.h" 11 #include "net/proxy/proxy_config_service.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 // This ProxyConfigService always returns "http://pac" as the PAC url to use. 14 // This ProxyConfigService always returns "http://pac" as the PAC url to use.
15 class MockProxyConfigService : public net::ProxyConfigService { 15 class MockProxyConfigService : public net::ProxyConfigService {
16 public: 16 public:
17 virtual void AddObserver(Observer* observer) {} 17 virtual void AddObserver(Observer* observer) {}
18 virtual void RemoveObserver(Observer* observer) {} 18 virtual void RemoveObserver(Observer* observer) {}
19 virtual bool GetLatestProxyConfig(net::ProxyConfig* results) { 19 virtual ConfigAvailability GetLatestProxyConfig(net::ProxyConfig* results) {
20 *results = net::ProxyConfig::CreateFromCustomPacURL(GURL("http://pac")); 20 *results = net::ProxyConfig::CreateFromCustomPacURL(GURL("http://pac"));
21 return true; 21 return CONFIG_VALID;
22 } 22 }
23 }; 23 };
24 24
25 class ResolveProxyMsgHelperTest : public testing::Test, 25 class ResolveProxyMsgHelperTest : public testing::Test,
26 public IPC::Channel::Listener { 26 public IPC::Channel::Listener {
27 public: 27 public:
28 struct PendingResult { 28 struct PendingResult {
29 PendingResult(int error_code, 29 PendingResult(int error_code,
30 const std::string& proxy_list) 30 const std::string& proxy_list)
31 : error_code(error_code), proxy_list(proxy_list) { 31 : error_code(error_code), proxy_list(proxy_list) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 // 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.
228 228
229 EXPECT_EQ(0u, resolver_->pending_requests().size()); 229 EXPECT_EQ(0u, resolver_->pending_requests().size());
230 230
231 EXPECT_TRUE(pending_result() == NULL); 231 EXPECT_TRUE(pending_result() == NULL);
232 232
233 // 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
234 // cancellation. (Else will show up as a leak in Purify/Valgrind). 234 // cancellation. (Else will show up as a leak in Purify/Valgrind).
235 } 235 }
OLDNEW
« no previous file with comments | « chrome/browser/net/pref_proxy_config_service_unittest.cc ('k') | chrome/test/testing_pref_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698