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

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

Issue 21328: Add support to ProxyService for downloading a PAC script on behalf of the Pro... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add missing files (for constructor boolean flag fall-out) Created 11 years, 10 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
« no previous file with comments | « no previous file | net/proxy/proxy_resolver_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/waitable_event.h" 7 #include "base/waitable_event.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 // This ProxyConfigService always returns "http://pac" as the PAC url to use. 11 // This ProxyConfigService always returns "http://pac" as the PAC url to use.
12 class MockProxyConfigService: public net::ProxyConfigService { 12 class MockProxyConfigService: public net::ProxyConfigService {
13 public: 13 public:
14 virtual int GetProxyConfig(net::ProxyConfig* results) { 14 virtual int GetProxyConfig(net::ProxyConfig* results) {
15 results->pac_url = GURL("http://pac"); 15 results->pac_url = GURL("http://pac");
16 return net::OK; 16 return net::OK;
17 } 17 }
18 }; 18 };
19 19
20 // This PAC resolver always returns the hostname of the query URL as the 20 // This PAC resolver always returns the hostname of the query URL as the
21 // proxy to use. The Block() method will make GetProxyForURL() hang until 21 // proxy to use. The Block() method will make GetProxyForURL() hang until
22 // Unblock() is called. 22 // Unblock() is called.
23 class MockProxyResolver : public net::ProxyResolver { 23 class MockProxyResolver : public net::ProxyResolver {
24 public: 24 public:
25 explicit MockProxyResolver() : event_(false, false), is_blocked_(false) { 25 MockProxyResolver() : ProxyResolver(true), event_(false, false),
26 is_blocked_(false) {
26 } 27 }
27 28
28 virtual int GetProxyForURL(const GURL& query_url, 29 virtual int GetProxyForURL(const GURL& query_url,
29 const GURL& /*pac_url*/, 30 const GURL& /*pac_url*/,
30 net::ProxyInfo* results) { 31 net::ProxyInfo* results) {
31 if (is_blocked_) 32 if (is_blocked_)
32 event_.Wait(); 33 event_.Wait();
33 results->UseNamedProxy(query_url.host()); 34 results->UseNamedProxy(query_url.host());
34 return net::OK; 35 return net::OK;
35 } 36 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 result1->TimedWaitUntilDone(base::TimeDelta::FromMilliseconds(2))); 341 result1->TimedWaitUntilDone(base::TimeDelta::FromMilliseconds(2)));
341 EXPECT_FALSE( 342 EXPECT_FALSE(
342 result2->TimedWaitUntilDone(base::TimeDelta::FromMilliseconds(2))); 343 result2->TimedWaitUntilDone(base::TimeDelta::FromMilliseconds(2)));
343 EXPECT_FALSE( 344 EXPECT_FALSE(
344 result3->TimedWaitUntilDone(base::TimeDelta::FromMilliseconds(2))); 345 result3->TimedWaitUntilDone(base::TimeDelta::FromMilliseconds(2)));
345 346
346 // It should also be the case that msg1, msg2, msg3 were deleted by the 347 // It should also be the case that msg1, msg2, msg3 were deleted by the
347 // cancellation. (Else will show up as a leak in Purify). 348 // cancellation. (Else will show up as a leak in Purify).
348 } 349 }
349 350
OLDNEW
« no previous file with comments | « no previous file | net/proxy/proxy_resolver_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698