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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 base::RunLoop().RunUntilIdle(); | 1039 base::RunLoop().RunUntilIdle(); |
1040 EXPECT_TRUE(socket_data_raw_ptr->AllReadDataConsumed()); | 1040 EXPECT_TRUE(socket_data_raw_ptr->AllReadDataConsumed()); |
1041 EXPECT_TRUE(has_failed()); | 1041 EXPECT_TRUE(has_failed()); |
1042 EXPECT_FALSE(stream_); | 1042 EXPECT_FALSE(stream_); |
1043 EXPECT_FALSE(response_info_); | 1043 EXPECT_FALSE(response_info_); |
1044 EXPECT_EQ("Connection closed before receiving a handshake response", | 1044 EXPECT_EQ("Connection closed before receiving a handshake response", |
1045 failure_message()); | 1045 failure_message()); |
1046 } | 1046 } |
1047 | 1047 |
1048 TEST_F(WebSocketStreamCreateTest, SelfSignedCertificateFailure) { | 1048 TEST_F(WebSocketStreamCreateTest, SelfSignedCertificateFailure) { |
1049 ssl_data_.push_back(base::WrapUnique( | 1049 ssl_data_.push_back(base::MakeUnique<SSLSocketDataProvider>( |
1050 new SSLSocketDataProvider(ASYNC, ERR_CERT_AUTHORITY_INVALID))); | 1050 ASYNC, ERR_CERT_AUTHORITY_INVALID)); |
1051 ssl_data_[0]->cert = | 1051 ssl_data_[0]->cert = |
1052 ImportCertFromFile(GetTestCertsDirectory(), "unittest.selfsigned.der"); | 1052 ImportCertFromFile(GetTestCertsDirectory(), "unittest.selfsigned.der"); |
1053 ASSERT_TRUE(ssl_data_[0]->cert.get()); | 1053 ASSERT_TRUE(ssl_data_[0]->cert.get()); |
1054 std::unique_ptr<SequencedSocketData> raw_socket_data(BuildNullSocketData()); | 1054 std::unique_ptr<SequencedSocketData> raw_socket_data(BuildNullSocketData()); |
1055 CreateAndConnectRawExpectations("wss://localhost/", NoSubProtocols(), | 1055 CreateAndConnectRawExpectations("wss://localhost/", NoSubProtocols(), |
1056 LocalhostOrigin(), LocalhostUrl(), "", | 1056 LocalhostOrigin(), LocalhostUrl(), "", |
1057 std::move(raw_socket_data)); | 1057 std::move(raw_socket_data)); |
1058 // WaitUntilConnectDone doesn't work in this case. | 1058 // WaitUntilConnectDone doesn't work in this case. |
1059 base::RunLoop().RunUntilIdle(); | 1059 base::RunLoop().RunUntilIdle(); |
1060 EXPECT_FALSE(has_failed()); | 1060 EXPECT_FALSE(has_failed()); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 LocalhostOrigin(), LocalhostUrl(), "", | 1257 LocalhostOrigin(), LocalhostUrl(), "", |
1258 std::move(socket_data)); | 1258 std::move(socket_data)); |
1259 WaitUntilConnectDone(); | 1259 WaitUntilConnectDone(); |
1260 EXPECT_TRUE(has_failed()); | 1260 EXPECT_TRUE(has_failed()); |
1261 EXPECT_EQ("Establishing a tunnel via proxy server failed.", | 1261 EXPECT_EQ("Establishing a tunnel via proxy server failed.", |
1262 failure_message()); | 1262 failure_message()); |
1263 } | 1263 } |
1264 | 1264 |
1265 } // namespace | 1265 } // namespace |
1266 } // namespace net | 1266 } // namespace net |
OLD | NEW |