| 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 std::unique_ptr<AuthContext> context = base::MakeUnique<AuthContext>(""); |
| 64 CreateAuthChallengeMessage(&output, context.get()); |
| 64 return output; | 65 return output; |
| 65 } | 66 } |
| 66 | 67 |
| 67 // Returns an auth challenge response message inline. | 68 // Returns an auth challenge response message inline. |
| 68 CastMessage CreateAuthReply() { | 69 CastMessage CreateAuthReply() { |
| 69 CastMessage output; | 70 CastMessage output; |
| 70 output.set_protocol_version(CastMessage::CASTV2_1_0); | 71 output.set_protocol_version(CastMessage::CASTV2_1_0); |
| 71 output.set_source_id("sender-0"); | 72 output.set_source_id("sender-0"); |
| 72 output.set_destination_id("receiver-0"); | 73 output.set_destination_id("receiver-0"); |
| 73 output.set_payload_type(CastMessage::BINARY); | 74 output.set_payload_type(CastMessage::BINARY); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 Logger* logger, | 201 Logger* logger, |
| 201 net::TestNetLog* capturing_net_log, | 202 net::TestNetLog* capturing_net_log, |
| 202 uint64_t device_capabilities) | 203 uint64_t device_capabilities) |
| 203 : CastSocketImpl("some_extension_id", | 204 : CastSocketImpl("some_extension_id", |
| 204 ip_endpoint, | 205 ip_endpoint, |
| 205 channel_auth, | 206 channel_auth, |
| 206 capturing_net_log, | 207 capturing_net_log, |
| 207 base::TimeDelta::FromMilliseconds(timeout_ms), | 208 base::TimeDelta::FromMilliseconds(timeout_ms), |
| 208 false, | 209 false, |
| 209 logger, | 210 logger, |
| 210 device_capabilities), | 211 device_capabilities, |
| 212 base::MakeUnique<AuthContext>("")), |
| 211 capturing_net_log_(capturing_net_log), | 213 capturing_net_log_(capturing_net_log), |
| 212 ip_(ip_endpoint), | 214 ip_(ip_endpoint), |
| 213 extract_cert_result_(true), | 215 extract_cert_result_(true), |
| 214 verify_challenge_result_(true), | 216 verify_challenge_result_(true), |
| 215 verify_challenge_disallow_(false), | 217 verify_challenge_disallow_(false), |
| 216 tcp_unresponsive_(false), | 218 tcp_unresponsive_(false), |
| 217 mock_timer_(new base::MockTimer(false, false)), | 219 mock_timer_(new base::MockTimer(false, false)), |
| 218 mock_transport_(nullptr) {} | 220 mock_transport_(nullptr) {} |
| 219 | 221 |
| 220 ~TestCastSocket() override {} | 222 ~TestCastSocket() override {} |
| (...skipping 556 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 |