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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // CreateBasicStream() changes. | 75 // CreateBasicStream() changes. |
76 static_cast<WebSocketBasicHandshakeStream*>(stream()) | 76 static_cast<WebSocketBasicHandshakeStream*>(stream()) |
77 ->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); | 77 ->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); |
78 return stream(); | 78 return stream(); |
79 } | 79 } |
80 }; | 80 }; |
81 | 81 |
82 class WebSocketStreamCreateTest : public ::testing::Test { | 82 class WebSocketStreamCreateTest : public ::testing::Test { |
83 public: | 83 public: |
84 WebSocketStreamCreateTest() : has_failed_(false), ssl_fatal_(false) {} | 84 WebSocketStreamCreateTest() : has_failed_(false), ssl_fatal_(false) {} |
| 85 virtual ~WebSocketStreamCreateTest() { |
| 86 url_request_context_host_.GetURLRequestContext() |
| 87 ->http_transaction_factory() |
| 88 ->GetCache() |
| 89 ->CloseAllConnections(); |
| 90 } |
85 | 91 |
86 void CreateAndConnectCustomResponse( | 92 void CreateAndConnectCustomResponse( |
87 const std::string& socket_url, | 93 const std::string& socket_url, |
88 const std::string& socket_path, | 94 const std::string& socket_path, |
89 const std::vector<std::string>& sub_protocols, | 95 const std::vector<std::string>& sub_protocols, |
90 const std::string& origin, | 96 const std::string& origin, |
91 const std::string& extra_request_headers, | 97 const std::string& extra_request_headers, |
92 const std::string& response_body) { | 98 const std::string& response_body) { |
93 url_request_context_host_.SetExpectations( | 99 url_request_context_host_.SetExpectations( |
94 WebSocketStandardRequest(socket_path, origin, extra_request_headers), | 100 WebSocketStandardRequest(socket_path, origin, extra_request_headers), |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1170 if (original) { | 1176 if (original) { |
1171 samples->Subtract(*original); // Cancel the original values. | 1177 samples->Subtract(*original); // Cancel the original values. |
1172 } | 1178 } |
1173 EXPECT_EQ(1, samples->GetCount(INCOMPLETE)); | 1179 EXPECT_EQ(1, samples->GetCount(INCOMPLETE)); |
1174 EXPECT_EQ(0, samples->GetCount(CONNECTED)); | 1180 EXPECT_EQ(0, samples->GetCount(CONNECTED)); |
1175 EXPECT_EQ(0, samples->GetCount(FAILED)); | 1181 EXPECT_EQ(0, samples->GetCount(FAILED)); |
1176 } | 1182 } |
1177 | 1183 |
1178 } // namespace | 1184 } // namespace |
1179 } // namespace net | 1185 } // namespace net |
OLD | NEW |