| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 using ::testing::SaveArg; | 53 using ::testing::SaveArg; |
| 54 | 54 |
| 55 namespace extensions { | 55 namespace extensions { |
| 56 namespace api { | 56 namespace api { |
| 57 namespace cast_channel { | 57 namespace cast_channel { |
| 58 const char kAuthNamespace[] = "urn:x-cast:com.google.cast.tp.deviceauth"; | 58 const char kAuthNamespace[] = "urn:x-cast:com.google.cast.tp.deviceauth"; |
| 59 | 59 |
| 60 // Returns an auth challenge message inline. | 60 // Returns an auth challenge message inline. |
| 61 CastMessage CreateAuthChallenge() { | 61 CastMessage CreateAuthChallenge() { |
| 62 CastMessage output; | 62 CastMessage output; |
| 63 CreateAuthChallengeMessage(&output); | 63 CreateAuthChallengeMessage(&output, ""); |
| 64 return output; | 64 return output; |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Returns an auth challenge response message inline. | 67 // Returns an auth challenge response message inline. |
| 68 CastMessage CreateAuthReply() { | 68 CastMessage CreateAuthReply() { |
| 69 CastMessage output; | 69 CastMessage output; |
| 70 output.set_protocol_version(CastMessage::CASTV2_1_0); | 70 output.set_protocol_version(CastMessage::CASTV2_1_0); |
| 71 output.set_source_id("sender-0"); | 71 output.set_source_id("sender-0"); |
| 72 output.set_destination_id("receiver-0"); | 72 output.set_destination_id("receiver-0"); |
| 73 output.set_payload_type(CastMessage::BINARY); | 73 output.set_payload_type(CastMessage::BINARY); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 false, | 208 false, |
| 209 logger, | 209 logger, |
| 210 device_capabilities), | 210 device_capabilities), |
| 211 capturing_net_log_(capturing_net_log), | 211 capturing_net_log_(capturing_net_log), |
| 212 ip_(ip_endpoint), | 212 ip_(ip_endpoint), |
| 213 extract_cert_result_(true), | 213 extract_cert_result_(true), |
| 214 verify_challenge_result_(true), | 214 verify_challenge_result_(true), |
| 215 verify_challenge_disallow_(false), | 215 verify_challenge_disallow_(false), |
| 216 tcp_unresponsive_(false), | 216 tcp_unresponsive_(false), |
| 217 mock_timer_(new base::MockTimer(false, false)), | 217 mock_timer_(new base::MockTimer(false, false)), |
| 218 mock_transport_(nullptr) {} | 218 mock_transport_(nullptr) { |
| 219 nonce_ = ""; |
| 220 } |
| 219 | 221 |
| 220 ~TestCastSocket() override {} | 222 ~TestCastSocket() override {} |
| 221 | 223 |
| 222 void SetupMockTransport() { | 224 void SetupMockTransport() { |
| 223 mock_transport_ = new MockCastTransport; | 225 mock_transport_ = new MockCastTransport; |
| 224 SetTransportForTesting(base::WrapUnique(mock_transport_)); | 226 SetTransportForTesting(base::WrapUnique(mock_transport_)); |
| 225 } | 227 } |
| 226 | 228 |
| 227 // Socket connection helpers. | 229 // Socket connection helpers. |
| 228 void SetupTcpConnect(net::IoMode mode, int result) { | 230 void SetupTcpConnect(net::IoMode mode, int result) { |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 base::Unretained(&handler_))); | 779 base::Unretained(&handler_))); |
| 778 RunPendingTasks(); | 780 RunPendingTasks(); |
| 779 | 781 |
| 780 EXPECT_EQ(cast_channel::READY_STATE_OPEN, socket_->ready_state()); | 782 EXPECT_EQ(cast_channel::READY_STATE_OPEN, socket_->ready_state()); |
| 781 EXPECT_EQ(cast_channel::CHANNEL_ERROR_NONE, socket_->error_state()); | 783 EXPECT_EQ(cast_channel::CHANNEL_ERROR_NONE, socket_->error_state()); |
| 782 } | 784 } |
| 783 | 785 |
| 784 } // namespace cast_channel | 786 } // namespace cast_channel |
| 785 } // namespace api | 787 } // namespace api |
| 786 } // namespace extensions | 788 } // namespace extensions |
| OLD | NEW |