OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/cast_channel/cast_socket.h" | 5 #include "extensions/browser/api/cast_channel/cast_socket.h" |
6 | 6 |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 // Create a test auth reply. | 379 // Create a test auth reply. |
380 MessageInfo reply; | 380 MessageInfo reply; |
381 CreateBinaryMessage( | 381 CreateBinaryMessage( |
382 auth_namespace, "sender-0", "receiver-0", "abcd", &reply); | 382 auth_namespace, "sender-0", "receiver-0", "abcd", &reply); |
383 CastMessage reply_msg; | 383 CastMessage reply_msg; |
384 ASSERT_TRUE(MessageInfoToCastMessage(reply, &reply_msg)); | 384 ASSERT_TRUE(MessageInfoToCastMessage(reply, &reply_msg)); |
385 ASSERT_TRUE(CastSocket::Serialize(reply_msg, &auth_reply_)); | 385 ASSERT_TRUE(CastSocket::Serialize(reply_msg, &auth_reply_)); |
386 } | 386 } |
387 | 387 |
388 void CreateCastSocket() { | 388 void CreateCastSocket() { |
389 socket_ = TestCastSocket::Create(&mock_delegate_, logger_); | 389 socket_ = TestCastSocket::Create(&mock_delegate_, logger_.get()); |
390 } | 390 } |
391 | 391 |
392 void CreateCastSocketSecure() { | 392 void CreateCastSocketSecure() { |
393 socket_ = TestCastSocket::CreateSecure(&mock_delegate_, logger_); | 393 socket_ = TestCastSocket::CreateSecure(&mock_delegate_, logger_.get()); |
394 } | 394 } |
395 | 395 |
396 // Sets up CastSocket::Connect to succeed. | 396 // Sets up CastSocket::Connect to succeed. |
397 // Connecting the socket also starts the read loop; so we add a mock | 397 // Connecting the socket also starts the read loop; so we add a mock |
398 // read result that returns IO_PENDING and callback is never fired. | 398 // read result that returns IO_PENDING and callback is never fired. |
399 void ConnectHelper() { | 399 void ConnectHelper() { |
400 socket_->SetupTcp1Connect(net::SYNCHRONOUS, net::OK); | 400 socket_->SetupTcp1Connect(net::SYNCHRONOUS, net::OK); |
401 socket_->SetupSsl1Connect(net::SYNCHRONOUS, net::OK); | 401 socket_->SetupSsl1Connect(net::SYNCHRONOUS, net::OK); |
402 socket_->AddReadResult(net::ASYNC, net::ERR_IO_PENDING); | 402 socket_->AddReadResult(net::ASYNC, net::ERR_IO_PENDING); |
403 | 403 |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 ConnectHelper(); | 1197 ConnectHelper(); |
1198 | 1198 |
1199 EXPECT_EQ(cast_channel::READY_STATE_CLOSED, socket_->ready_state()); | 1199 EXPECT_EQ(cast_channel::READY_STATE_CLOSED, socket_->ready_state()); |
1200 EXPECT_EQ(cast_channel::CHANNEL_ERROR_INVALID_MESSAGE, | 1200 EXPECT_EQ(cast_channel::CHANNEL_ERROR_INVALID_MESSAGE, |
1201 socket_->error_state()); | 1201 socket_->error_state()); |
1202 } | 1202 } |
1203 | 1203 |
1204 } // namespace cast_channel | 1204 } // namespace cast_channel |
1205 } // namespace core_api | 1205 } // namespace core_api |
1206 } // namespace extensions | 1206 } // namespace extensions |
OLD | NEW |