Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: extensions/browser/api/cast_channel/cast_socket_unittest.cc

Issue 2709523008: [Cast Channel] Add support for nonce challenge to Cast channel authentication. (Closed)
Patch Set: Rebase-only Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 using ::testing::SaveArg; 52 using ::testing::SaveArg;
53 53
54 namespace extensions { 54 namespace extensions {
55 namespace api { 55 namespace api {
56 namespace cast_channel { 56 namespace cast_channel {
57 const char kAuthNamespace[] = "urn:x-cast:com.google.cast.tp.deviceauth"; 57 const char kAuthNamespace[] = "urn:x-cast:com.google.cast.tp.deviceauth";
58 58
59 // Returns an auth challenge message inline. 59 // Returns an auth challenge message inline.
60 CastMessage CreateAuthChallenge() { 60 CastMessage CreateAuthChallenge() {
61 CastMessage output; 61 CastMessage output;
62 CreateAuthChallengeMessage(&output); 62 CreateAuthChallengeMessage(&output, AuthContext::Create());
63 return output; 63 return output;
64 } 64 }
65 65
66 // Returns an auth challenge response message inline. 66 // Returns an auth challenge response message inline.
67 CastMessage CreateAuthReply() { 67 CastMessage CreateAuthReply() {
68 CastMessage output; 68 CastMessage output;
69 output.set_protocol_version(CastMessage::CASTV2_1_0); 69 output.set_protocol_version(CastMessage::CASTV2_1_0);
70 output.set_source_id("sender-0"); 70 output.set_source_id("sender-0");
71 output.set_destination_id("receiver-0"); 71 output.set_destination_id("receiver-0");
72 output.set_payload_type(CastMessage::BINARY); 72 output.set_payload_type(CastMessage::BINARY);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 Logger* logger, 199 Logger* logger,
200 net::TestNetLog* capturing_net_log, 200 net::TestNetLog* capturing_net_log,
201 uint64_t device_capabilities) 201 uint64_t device_capabilities)
202 : CastSocketImpl("some_extension_id", 202 : CastSocketImpl("some_extension_id",
203 ip_endpoint, 203 ip_endpoint,
204 channel_auth, 204 channel_auth,
205 capturing_net_log, 205 capturing_net_log,
206 base::TimeDelta::FromMilliseconds(timeout_ms), 206 base::TimeDelta::FromMilliseconds(timeout_ms),
207 false, 207 false,
208 logger, 208 logger,
209 device_capabilities), 209 device_capabilities,
210 AuthContext::Create()),
210 capturing_net_log_(capturing_net_log), 211 capturing_net_log_(capturing_net_log),
211 ip_(ip_endpoint), 212 ip_(ip_endpoint),
212 extract_cert_result_(true), 213 extract_cert_result_(true),
213 verify_challenge_result_(true), 214 verify_challenge_result_(true),
214 verify_challenge_disallow_(false), 215 verify_challenge_disallow_(false),
215 tcp_unresponsive_(false), 216 tcp_unresponsive_(false),
216 mock_timer_(new base::MockTimer(false, false)), 217 mock_timer_(new base::MockTimer(false, false)),
217 mock_transport_(nullptr) {} 218 mock_transport_(nullptr) {}
218 219
219 ~TestCastSocket() override {} 220 ~TestCastSocket() override {}
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 base::Unretained(&handler_))); 773 base::Unretained(&handler_)));
773 RunPendingTasks(); 774 RunPendingTasks();
774 775
775 EXPECT_EQ(cast_channel::READY_STATE_OPEN, socket_->ready_state()); 776 EXPECT_EQ(cast_channel::READY_STATE_OPEN, socket_->ready_state());
776 EXPECT_EQ(cast_channel::CHANNEL_ERROR_NONE, socket_->error_state()); 777 EXPECT_EQ(cast_channel::CHANNEL_ERROR_NONE, socket_->error_state());
777 } 778 }
778 779
779 } // namespace cast_channel 780 } // namespace cast_channel
780 } // namespace api 781 } // namespace api
781 } // namespace extensions 782 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_socket.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698