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

Side by Side Diff: net/proxy/proxy_service_unittest.cc

Issue 6322003: net: Remove prefix net:: from some places that already are in namespace net. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | « net/proxy/proxy_script_fetcher_impl_unittest.cc ('k') | net/socket_stream/socket_stream.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) 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 "net/proxy/proxy_service.h" 5 #include "net/proxy/proxy_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void NotifyFetchCompletion(int result, const std::string& ascii_text) { 91 void NotifyFetchCompletion(int result, const std::string& ascii_text) {
92 DCHECK(has_pending_request()); 92 DCHECK(has_pending_request());
93 *pending_request_text_ = ASCIIToUTF16(ascii_text); 93 *pending_request_text_ = ASCIIToUTF16(ascii_text);
94 CompletionCallback* callback = pending_request_callback_; 94 CompletionCallback* callback = pending_request_callback_;
95 pending_request_callback_ = NULL; 95 pending_request_callback_ = NULL;
96 callback->Run(result); 96 callback->Run(result);
97 } 97 }
98 98
99 virtual void Cancel() {} 99 virtual void Cancel() {}
100 100
101 virtual net::URLRequestContext* GetRequestContext() { return NULL; } 101 virtual URLRequestContext* GetRequestContext() { return NULL; }
102 102
103 const GURL& pending_request_url() const { 103 const GURL& pending_request_url() const {
104 return pending_request_url_; 104 return pending_request_url_;
105 } 105 }
106 106
107 bool has_pending_request() const { 107 bool has_pending_request() const {
108 return pending_request_callback_ != NULL; 108 return pending_request_callback_ != NULL;
109 } 109 }
110 110
111 private: 111 private:
(...skipping 13 matching lines...) Expand all
125 ProxyInfo info; 125 ProxyInfo info;
126 TestCompletionCallback callback; 126 TestCompletionCallback callback;
127 CapturingBoundNetLog log(CapturingNetLog::kUnbounded); 127 CapturingBoundNetLog log(CapturingNetLog::kUnbounded);
128 int rv = service->ResolveProxy(url, &info, &callback, NULL, log.bound()); 128 int rv = service->ResolveProxy(url, &info, &callback, NULL, log.bound());
129 EXPECT_EQ(OK, rv); 129 EXPECT_EQ(OK, rv);
130 EXPECT_TRUE(resolver->pending_requests().empty()); 130 EXPECT_TRUE(resolver->pending_requests().empty());
131 131
132 EXPECT_TRUE(info.is_direct()); 132 EXPECT_TRUE(info.is_direct());
133 133
134 // Check the NetLog was filled correctly. 134 // Check the NetLog was filled correctly.
135 net::CapturingNetLog::EntryList entries; 135 CapturingNetLog::EntryList entries;
136 log.GetEntries(&entries); 136 log.GetEntries(&entries);
137 137
138 EXPECT_EQ(3u, entries.size()); 138 EXPECT_EQ(3u, entries.size());
139 EXPECT_TRUE(LogContainsBeginEvent( 139 EXPECT_TRUE(LogContainsBeginEvent(
140 entries, 0, NetLog::TYPE_PROXY_SERVICE)); 140 entries, 0, NetLog::TYPE_PROXY_SERVICE));
141 EXPECT_TRUE(LogContainsEvent( 141 EXPECT_TRUE(LogContainsEvent(
142 entries, 1, NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, 142 entries, 1, NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST,
143 NetLog::PHASE_NONE)); 143 NetLog::PHASE_NONE));
144 EXPECT_TRUE(LogContainsEndEvent( 144 EXPECT_TRUE(LogContainsEndEvent(
145 entries, 2, NetLog::TYPE_PROXY_SERVICE)); 145 entries, 2, NetLog::TYPE_PROXY_SERVICE));
(...skipping 26 matching lines...) Expand all
172 172
173 // Set the result in proxy resolver. 173 // Set the result in proxy resolver.
174 resolver->pending_requests()[0]->results()->UseNamedProxy("foopy"); 174 resolver->pending_requests()[0]->results()->UseNamedProxy("foopy");
175 resolver->pending_requests()[0]->CompleteNow(OK); 175 resolver->pending_requests()[0]->CompleteNow(OK);
176 176
177 EXPECT_EQ(OK, callback.WaitForResult()); 177 EXPECT_EQ(OK, callback.WaitForResult());
178 EXPECT_FALSE(info.is_direct()); 178 EXPECT_FALSE(info.is_direct());
179 EXPECT_EQ("foopy:80", info.proxy_server().ToURI()); 179 EXPECT_EQ("foopy:80", info.proxy_server().ToURI());
180 180
181 // Check the NetLog was filled correctly. 181 // Check the NetLog was filled correctly.
182 net::CapturingNetLog::EntryList entries; 182 CapturingNetLog::EntryList entries;
183 log.GetEntries(&entries); 183 log.GetEntries(&entries);
184 184
185 EXPECT_EQ(5u, entries.size()); 185 EXPECT_EQ(5u, entries.size());
186 EXPECT_TRUE(LogContainsBeginEvent( 186 EXPECT_TRUE(LogContainsBeginEvent(
187 entries, 0, NetLog::TYPE_PROXY_SERVICE)); 187 entries, 0, NetLog::TYPE_PROXY_SERVICE));
188 EXPECT_TRUE(LogContainsBeginEvent( 188 EXPECT_TRUE(LogContainsBeginEvent(
189 entries, 1, NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC)); 189 entries, 1, NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC));
190 EXPECT_TRUE(LogContainsEndEvent( 190 EXPECT_TRUE(LogContainsEndEvent(
191 entries, 2, NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC)); 191 entries, 2, NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC));
192 EXPECT_TRUE(LogContainsEndEvent( 192 EXPECT_TRUE(LogContainsEndEvent(
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 resolver->pending_requests()[0]->CompleteNow(OK); 1150 resolver->pending_requests()[0]->CompleteNow(OK);
1151 1151
1152 EXPECT_EQ(OK, callback3.WaitForResult()); 1152 EXPECT_EQ(OK, callback3.WaitForResult());
1153 EXPECT_EQ("request3:80", info3.proxy_server().ToURI()); 1153 EXPECT_EQ("request3:80", info3.proxy_server().ToURI());
1154 1154
1155 EXPECT_TRUE(resolver->cancelled_requests().empty()); 1155 EXPECT_TRUE(resolver->cancelled_requests().empty());
1156 1156
1157 EXPECT_FALSE(callback1.have_result()); // Cancelled. 1157 EXPECT_FALSE(callback1.have_result()); // Cancelled.
1158 EXPECT_FALSE(callback2.have_result()); // Cancelled. 1158 EXPECT_FALSE(callback2.have_result()); // Cancelled.
1159 1159
1160 net::CapturingNetLog::EntryList entries1; 1160 CapturingNetLog::EntryList entries1;
1161 log1.GetEntries(&entries1); 1161 log1.GetEntries(&entries1);
1162 1162
1163 // Check the NetLog for request 1 (which was cancelled) got filled properly. 1163 // Check the NetLog for request 1 (which was cancelled) got filled properly.
1164 EXPECT_EQ(4u, entries1.size()); 1164 EXPECT_EQ(4u, entries1.size());
1165 EXPECT_TRUE(LogContainsBeginEvent( 1165 EXPECT_TRUE(LogContainsBeginEvent(
1166 entries1, 0, NetLog::TYPE_PROXY_SERVICE)); 1166 entries1, 0, NetLog::TYPE_PROXY_SERVICE));
1167 EXPECT_TRUE(LogContainsBeginEvent( 1167 EXPECT_TRUE(LogContainsBeginEvent(
1168 entries1, 1, NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC)); 1168 entries1, 1, NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC));
1169 // Note that TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC is never completed before 1169 // Note that TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC is never completed before
1170 // the cancellation occured. 1170 // the cancellation occured.
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 resolver->pending_requests()[0]->CompleteNow(OK); 1683 resolver->pending_requests()[0]->CompleteNow(OK);
1684 1684
1685 // Wait for completion callback, and verify that the request ran as expected. 1685 // Wait for completion callback, and verify that the request ran as expected.
1686 EXPECT_EQ(OK, callback2.WaitForResult()); 1686 EXPECT_EQ(OK, callback2.WaitForResult());
1687 EXPECT_EQ("request2:80", info2.proxy_server().ToURI()); 1687 EXPECT_EQ("request2:80", info2.proxy_server().ToURI());
1688 1688
1689 // Check that the expected events were outputted to the log stream. 1689 // Check that the expected events were outputted to the log stream.
1690 // In particular, PROXY_CONFIG_CHANGED should have only been emitted once 1690 // In particular, PROXY_CONFIG_CHANGED should have only been emitted once
1691 // (for the initial setup), and NOT a second time when the IP address 1691 // (for the initial setup), and NOT a second time when the IP address
1692 // changed. 1692 // changed.
1693 net::CapturingNetLog::EntryList entries; 1693 CapturingNetLog::EntryList entries;
1694 log.GetEntries(&entries); 1694 log.GetEntries(&entries);
1695 1695
1696 EXPECT_TRUE(LogContainsEntryWithType(entries, 0, 1696 EXPECT_TRUE(LogContainsEntryWithType(entries, 0,
1697 NetLog::TYPE_PROXY_CONFIG_CHANGED)); 1697 NetLog::TYPE_PROXY_CONFIG_CHANGED));
1698 ASSERT_EQ(13u, entries.size()); 1698 ASSERT_EQ(13u, entries.size());
1699 for (size_t i = 1; i < entries.size(); ++i) 1699 for (size_t i = 1; i < entries.size(); ++i)
1700 EXPECT_NE(NetLog::TYPE_PROXY_CONFIG_CHANGED, entries[i].type); 1700 EXPECT_NE(NetLog::TYPE_PROXY_CONFIG_CHANGED, entries[i].type);
1701 } 1701 }
1702 1702
1703 } // namespace net 1703 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_script_fetcher_impl_unittest.cc ('k') | net/socket_stream/socket_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698