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

Side by Side Diff: net/websockets/websocket_stream_test.cc

Issue 2397393002: Provide child/frame IDs for WebSocket handshake request (Closed)
Patch Set: fix Created 4 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/websockets/websocket_stream.h" 5 #include "net/websockets/websocket_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 std::unique_ptr<base::HistogramSamples> GetSamples(const std::string& name) { 318 std::unique_ptr<base::HistogramSamples> GetSamples(const std::string& name) {
319 base::HistogramBase* histogram = 319 base::HistogramBase* histogram =
320 base::StatisticsRecorder::FindHistogram(name); 320 base::StatisticsRecorder::FindHistogram(name);
321 return histogram ? histogram->SnapshotSamples() 321 return histogram ? histogram->SnapshotSamples()
322 : std::unique_ptr<base::HistogramSamples>(); 322 : std::unique_ptr<base::HistogramSamples>();
323 } 323 }
324 }; 324 };
325 325
326 // Confirm that the basic case works as expected. 326 // Confirm that the basic case works as expected.
327 TEST_F(WebSocketStreamCreateTest, SimpleSuccess) { 327 TEST_F(WebSocketStreamCreateTest, SimpleSuccess) {
328 EXPECT_FALSE(url_request_);
328 CreateAndConnectStandard("ws://localhost/", "localhost", "/", 329 CreateAndConnectStandard("ws://localhost/", "localhost", "/",
329 NoSubProtocols(), LocalhostOrigin(), LocalhostUrl(), 330 NoSubProtocols(), LocalhostOrigin(), LocalhostUrl(),
330 "", "", ""); 331 "", "", "");
331 EXPECT_FALSE(request_info_); 332 EXPECT_FALSE(request_info_);
332 EXPECT_FALSE(response_info_); 333 EXPECT_FALSE(response_info_);
334 EXPECT_TRUE(url_request_);
333 WaitUntilConnectDone(); 335 WaitUntilConnectDone();
334 EXPECT_FALSE(has_failed()); 336 EXPECT_FALSE(has_failed());
335 EXPECT_TRUE(stream_); 337 EXPECT_TRUE(stream_);
336 EXPECT_TRUE(request_info_); 338 EXPECT_TRUE(request_info_);
337 EXPECT_TRUE(response_info_); 339 EXPECT_TRUE(response_info_);
338 } 340 }
339 341
340 TEST_F(WebSocketStreamCreateTest, HandshakeInfo) { 342 TEST_F(WebSocketStreamCreateTest, HandshakeInfo) {
341 static const char kResponse[] = 343 static const char kResponse[] =
342 "HTTP/1.1 101 Switching Protocols\r\n" 344 "HTTP/1.1 101 Switching Protocols\r\n"
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 LocalhostOrigin(), LocalhostUrl(), "", 1259 LocalhostOrigin(), LocalhostUrl(), "",
1258 std::move(socket_data)); 1260 std::move(socket_data));
1259 WaitUntilConnectDone(); 1261 WaitUntilConnectDone();
1260 EXPECT_TRUE(has_failed()); 1262 EXPECT_TRUE(has_failed());
1261 EXPECT_EQ("Establishing a tunnel via proxy server failed.", 1263 EXPECT_EQ("Establishing a tunnel via proxy server failed.",
1262 failure_message()); 1264 failure_message());
1263 } 1265 }
1264 1266
1265 } // namespace 1267 } // namespace
1266 } // namespace net 1268 } // namespace net
OLDNEW
« net/websockets/websocket_stream.h ('K') | « net/websockets/websocket_stream_create_test_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698