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

Side by Side Diff: net/url_request/url_request_http_job_unittest.cc

Issue 105833003: Fail WebSocket channel when handshake fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/url_request/url_request_http_job.h" 5 #include "net/url_request/url_request_http_job.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 virtual void Drain(HttpNetworkSession* session) OVERRIDE {} 251 virtual void Drain(HttpNetworkSession* session) OVERRIDE {}
252 252
253 virtual void SetPriority(RequestPriority priority) OVERRIDE {} 253 virtual void SetPriority(RequestPriority priority) OVERRIDE {}
254 254
255 // Fake implementation of WebSocketHandshakeStreamBase method(s) 255 // Fake implementation of WebSocketHandshakeStreamBase method(s)
256 virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE { 256 virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE {
257 return scoped_ptr<WebSocketStream>(); 257 return scoped_ptr<WebSocketStream>();
258 } 258 }
259 259
260 virtual std::string GetFailureMessage() const OVERRIDE {
261 return std::string();
262 }
263
260 private: 264 private:
261 bool initialize_stream_was_called_; 265 bool initialize_stream_was_called_;
262 }; 266 };
263 267
264 TEST_F(URLRequestHttpJobWebSocketTest, RejectedWithoutCreateHelper) { 268 TEST_F(URLRequestHttpJobWebSocketTest, RejectedWithoutCreateHelper) {
265 scoped_refptr<TestURLRequestHttpJob> job(new TestURLRequestHttpJob(&req_)); 269 scoped_refptr<TestURLRequestHttpJob> job(new TestURLRequestHttpJob(&req_));
266 job->Start(); 270 job->Start();
267 base::RunLoop().RunUntilIdle(); 271 base::RunLoop().RunUntilIdle();
268 EXPECT_EQ(URLRequestStatus::FAILED, req_.status().status()); 272 EXPECT_EQ(URLRequestStatus::FAILED, req_.status().status());
269 EXPECT_EQ(ERR_DISALLOWED_URL_SCHEME, req_.status().error()); 273 EXPECT_EQ(ERR_DISALLOWED_URL_SCHEME, req_.status().error());
(...skipping 14 matching lines...) Expand all
284 req_.SetLoadFlags(LOAD_DISABLE_CACHE); 288 req_.SetLoadFlags(LOAD_DISABLE_CACHE);
285 job->Start(); 289 job->Start();
286 base::RunLoop().RunUntilIdle(); 290 base::RunLoop().RunUntilIdle();
287 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_.status().status()); 291 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_.status().status());
288 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); 292 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called());
289 } 293 }
290 294
291 } // namespace 295 } // namespace
292 296
293 } // namespace net 297 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_unittest.cc ('k') | net/websockets/websocket_basic_handshake_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698