OLD | NEW |
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 const std::vector<std::string>& sub_protocols, | 122 const std::vector<std::string>& sub_protocols, |
123 const std::string& origin) { | 123 const std::string& origin) { |
124 scoped_ptr<WebSocketStream::ConnectDelegate> connect_delegate( | 124 scoped_ptr<WebSocketStream::ConnectDelegate> connect_delegate( |
125 new TestConnectDelegate(this)); | 125 new TestConnectDelegate(this)); |
126 WebSocketStream::ConnectDelegate* delegate = connect_delegate.get(); | 126 WebSocketStream::ConnectDelegate* delegate = connect_delegate.get(); |
127 stream_request_ = ::net::CreateAndConnectStreamForTesting( | 127 stream_request_ = ::net::CreateAndConnectStreamForTesting( |
128 GURL(socket_url), | 128 GURL(socket_url), |
129 scoped_ptr<WebSocketHandshakeStreamCreateHelper>( | 129 scoped_ptr<WebSocketHandshakeStreamCreateHelper>( |
130 new DeterministicKeyWebSocketHandshakeStreamCreateHelper( | 130 new DeterministicKeyWebSocketHandshakeStreamCreateHelper( |
131 delegate, sub_protocols)), | 131 delegate, sub_protocols)), |
132 GURL(origin), | 132 origin, |
133 url_request_context_host_.GetURLRequestContext(), | 133 url_request_context_host_.GetURLRequestContext(), |
134 BoundNetLog(), | 134 BoundNetLog(), |
135 connect_delegate.Pass()); | 135 connect_delegate.Pass()); |
136 } | 136 } |
137 | 137 |
138 static void RunUntilIdle() { base::RunLoop().RunUntilIdle(); } | 138 static void RunUntilIdle() { base::RunLoop().RunUntilIdle(); } |
139 | 139 |
140 // A simple function to make the tests more readable. Creates an empty vector. | 140 // A simple function to make the tests more readable. Creates an empty vector. |
141 static std::vector<std::string> NoSubProtocols() { | 141 static std::vector<std::string> NoSubProtocols() { |
142 return std::vector<std::string>(); | 142 return std::vector<std::string>(); |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 socket_data->RunFor(2); | 1001 socket_data->RunFor(2); |
1002 EXPECT_TRUE(has_failed()); | 1002 EXPECT_TRUE(has_failed()); |
1003 EXPECT_FALSE(stream_); | 1003 EXPECT_FALSE(stream_); |
1004 EXPECT_FALSE(response_info_); | 1004 EXPECT_FALSE(response_info_); |
1005 EXPECT_EQ("Connection closed before receiving a handshake response", | 1005 EXPECT_EQ("Connection closed before receiving a handshake response", |
1006 failure_message()); | 1006 failure_message()); |
1007 } | 1007 } |
1008 | 1008 |
1009 } // namespace | 1009 } // namespace |
1010 } // namespace net | 1010 } // namespace net |
OLD | NEW |