| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 "HTTP/1.1 101 WebSocket Protocol Handshake\r\n" | 321 "HTTP/1.1 101 WebSocket Protocol Handshake\r\n" |
| 322 "Upgrade: WebSocket\r\n" | 322 "Upgrade: WebSocket\r\n" |
| 323 "Connection: Upgrade\r\n" | 323 "Connection: Upgrade\r\n" |
| 324 "Sec-WebSocket-Origin: http://example.com\r\n" | 324 "Sec-WebSocket-Origin: http://example.com\r\n" |
| 325 "Sec-WebSocket-Location: ws://example.com/demo\r\n" | 325 "Sec-WebSocket-Location: ws://example.com/demo\r\n" |
| 326 "Sec-WebSocket-Protocol: sample\r\n" | 326 "Sec-WebSocket-Protocol: sample\r\n" |
| 327 "\r\n" | 327 "\r\n" |
| 328 "8jKS'y:G*Co,Wxa-"; | 328 "8jKS'y:G*Co,Wxa-"; |
| 329 | 329 |
| 330 std::vector<std::string> lines; | 330 std::vector<std::string> lines; |
| 331 SplitString(kHandshakeResponseMessage, '\n', &lines); | 331 base::SplitString(kHandshakeResponseMessage, '\n', &lines); |
| 332 for (size_t i = 0; i < lines.size() - 2; i++) { | 332 for (size_t i = 0; i < lines.size() - 2; i++) { |
| 333 std::string line = lines[i] + "\r\n"; | 333 std::string line = lines[i] + "\r\n"; |
| 334 SCOPED_TRACE("Line: " + line); | 334 SCOPED_TRACE("Line: " + line); |
| 335 websocket_->OnReceivedData(socket_, | 335 websocket_->OnReceivedData(socket_, |
| 336 line.c_str(), | 336 line.c_str(), |
| 337 line.size()); | 337 line.size()); |
| 338 MessageLoop::current()->RunAllPending(); | 338 MessageLoop::current()->RunAllPending(); |
| 339 EXPECT_TRUE(delegate.received_data().empty()); | 339 EXPECT_TRUE(delegate.received_data().empty()); |
| 340 EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); | 340 EXPECT_EQ(WebSocketJob::CONNECTING, GetWebSocketJobState()); |
| 341 } | 341 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 EXPECT_EQ(2U, cookie_store_->entries().size()); | 515 EXPECT_EQ(2U, cookie_store_->entries().size()); |
| 516 EXPECT_EQ(cookieUrl, cookie_store_->entries()[0].url); | 516 EXPECT_EQ(cookieUrl, cookie_store_->entries()[0].url); |
| 517 EXPECT_EQ("CR-test=1", cookie_store_->entries()[0].cookie_line); | 517 EXPECT_EQ("CR-test=1", cookie_store_->entries()[0].cookie_line); |
| 518 EXPECT_EQ(cookieUrl, cookie_store_->entries()[1].url); | 518 EXPECT_EQ(cookieUrl, cookie_store_->entries()[1].url); |
| 519 EXPECT_EQ("CR-test-httponly=1", cookie_store_->entries()[1].cookie_line); | 519 EXPECT_EQ("CR-test-httponly=1", cookie_store_->entries()[1].cookie_line); |
| 520 | 520 |
| 521 CloseWebSocketJob(); | 521 CloseWebSocketJob(); |
| 522 } | 522 } |
| 523 | 523 |
| 524 } // namespace net | 524 } // namespace net |
| OLD | NEW |