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

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 7 years 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 virtual void Drain(HttpNetworkSession* session) OVERRIDE {} 249 virtual void Drain(HttpNetworkSession* session) OVERRIDE {}
250 250
251 virtual void SetPriority(RequestPriority priority) OVERRIDE {} 251 virtual void SetPriority(RequestPriority priority) OVERRIDE {}
252 252
253 // Fake implementation of WebSocketHandshakeStreamBase method(s) 253 // Fake implementation of WebSocketHandshakeStreamBase method(s)
254 virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE { 254 virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE {
255 return scoped_ptr<WebSocketStream>(); 255 return scoped_ptr<WebSocketStream>();
256 } 256 }
257 257
258 virtual std::string FailureMessage() const OVERRIDE {
259 return std::string();
260 }
261
258 private: 262 private:
259 bool initialize_stream_was_called_; 263 bool initialize_stream_was_called_;
260 }; 264 };
261 265
262 TEST_F(URLRequestHttpJobWebSocketTest, RejectedWithoutCreateHelper) { 266 TEST_F(URLRequestHttpJobWebSocketTest, RejectedWithoutCreateHelper) {
263 scoped_refptr<TestURLRequestHttpJob> job(new TestURLRequestHttpJob(&req_)); 267 scoped_refptr<TestURLRequestHttpJob> job(new TestURLRequestHttpJob(&req_));
264 job->Start(); 268 job->Start();
265 base::RunLoop().RunUntilIdle(); 269 base::RunLoop().RunUntilIdle();
266 EXPECT_EQ(URLRequestStatus::FAILED, req_.status().status()); 270 EXPECT_EQ(URLRequestStatus::FAILED, req_.status().status());
267 EXPECT_EQ(ERR_DISALLOWED_URL_SCHEME, req_.status().error()); 271 EXPECT_EQ(ERR_DISALLOWED_URL_SCHEME, req_.status().error());
(...skipping 14 matching lines...) Expand all
282 req_.SetLoadFlags(LOAD_DISABLE_CACHE); 286 req_.SetLoadFlags(LOAD_DISABLE_CACHE);
283 job->Start(); 287 job->Start();
284 base::RunLoop().RunUntilIdle(); 288 base::RunLoop().RunUntilIdle();
285 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_.status().status()); 289 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_.status().status());
286 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); 290 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called());
287 } 291 }
288 292
289 } // namespace 293 } // namespace
290 294
291 } // namespace net 295 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698