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

Side by Side Diff: net/socket_stream/socket_stream_unittest.cc

Issue 11369179: Move url_request_test_util into net namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/socket_stream/socket_stream.h" 5 #include "net/socket_stream/socket_stream.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 base::Callback<void(SocketStreamEvent*)> on_close_; 172 base::Callback<void(SocketStreamEvent*)> on_close_;
173 base::Callback<void(SocketStreamEvent*)> on_auth_required_; 173 base::Callback<void(SocketStreamEvent*)> on_auth_required_;
174 base::Callback<void(SocketStreamEvent*)> on_error_; 174 base::Callback<void(SocketStreamEvent*)> on_error_;
175 const net::CompletionCallback callback_; 175 const net::CompletionCallback callback_;
176 net::CompletionCallback connection_callback_; 176 net::CompletionCallback connection_callback_;
177 net::AuthCredentials credentials_; 177 net::AuthCredentials credentials_;
178 178
179 DISALLOW_COPY_AND_ASSIGN(SocketStreamEventRecorder); 179 DISALLOW_COPY_AND_ASSIGN(SocketStreamEventRecorder);
180 }; 180 };
181 181
182 class TestURLRequestContextWithProxy : public TestURLRequestContext { 182 class TestURLRequestContextWithProxy : public net::TestURLRequestContext {
183 public: 183 public:
184 explicit TestURLRequestContextWithProxy(const std::string& proxy) 184 explicit TestURLRequestContextWithProxy(const std::string& proxy)
185 : TestURLRequestContext(true) { 185 : TestURLRequestContext(true) {
186 context_storage_.set_proxy_service(net::ProxyService::CreateFixed(proxy)); 186 context_storage_.set_proxy_service(net::ProxyService::CreateFixed(proxy));
187 Init(); 187 Init();
188 } 188 }
189 virtual ~TestURLRequestContextWithProxy() {} 189 virtual ~TestURLRequestContextWithProxy() {}
190 }; 190 };
191 191
192 class TestSocketStreamNetworkDelegate : public TestNetworkDelegate { 192 class TestSocketStreamNetworkDelegate : public net::TestNetworkDelegate {
193 public: 193 public:
194 TestSocketStreamNetworkDelegate() 194 TestSocketStreamNetworkDelegate()
195 : before_connect_result_(net::OK) {} 195 : before_connect_result_(net::OK) {}
196 virtual ~TestSocketStreamNetworkDelegate() {} 196 virtual ~TestSocketStreamNetworkDelegate() {}
197 197
198 virtual int OnBeforeSocketStreamConnect( 198 virtual int OnBeforeSocketStreamConnect(
199 net::SocketStream* stream, 199 net::SocketStream* stream,
200 const net::CompletionCallback& callback) OVERRIDE { 200 const net::CompletionCallback& callback) OVERRIDE {
201 return before_connect_result_; 201 return before_connect_result_;
202 } 202 }
203 203
204 void SetBeforeConnectResult(int result) { 204 void SetBeforeConnectResult(int result) {
205 before_connect_result_ = result; 205 before_connect_result_ = result;
206 } 206 }
207 207
208 private: 208 private:
209 int before_connect_result_; 209 int before_connect_result_;
210 }; 210 };
211 211
212 } // namespace 212 } // namespace
213 213
214 namespace net { 214 namespace net {
wtc 2012/11/12 21:50:49 We can also consider putting this whole file insid
jochen (gone - plz use gerrit) 2012/11/13 09:17:57 Done.
215 215
216 class SocketStreamTest : public PlatformTest { 216 class SocketStreamTest : public PlatformTest {
217 public: 217 public:
218 virtual ~SocketStreamTest() {} 218 virtual ~SocketStreamTest() {}
219 virtual void SetUp() { 219 virtual void SetUp() {
220 mock_socket_factory_.reset(); 220 mock_socket_factory_.reset();
221 handshake_request_ = kWebSocketHandshakeRequest; 221 handshake_request_ = kWebSocketHandshakeRequest;
222 handshake_response_ = kWebSocketHandshakeResponse; 222 handshake_response_ = kWebSocketHandshakeResponse;
223 } 223 }
224 virtual void TearDown() { 224 virtual void TearDown() {
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 800
801 const std::vector<SocketStreamEvent>& events = delegate->GetSeenEvents(); 801 const std::vector<SocketStreamEvent>& events = delegate->GetSeenEvents();
802 ASSERT_EQ(2U, events.size()); 802 ASSERT_EQ(2U, events.size());
803 803
804 EXPECT_EQ(SocketStreamEvent::EVENT_ERROR, events[0].event_type); 804 EXPECT_EQ(SocketStreamEvent::EVENT_ERROR, events[0].event_type);
805 EXPECT_EQ(net::ERR_ACCESS_DENIED, events[0].error_code); 805 EXPECT_EQ(net::ERR_ACCESS_DENIED, events[0].error_code);
806 EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[1].event_type); 806 EXPECT_EQ(SocketStreamEvent::EVENT_CLOSE, events[1].event_type);
807 } 807 }
808 808
809 } // namespace net 809 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698