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

Side by Side Diff: remoting/protocol/third_party_authenticator_unittest.cc

Issue 638213002: remove more OVERRIDE instances in remoting/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "net/base/net_errors.h" 6 #include "net/base/net_errors.h"
7 #include "remoting/base/rsa_key_pair.h" 7 #include "remoting/base/rsa_key_pair.h"
8 #include "remoting/protocol/authenticator_test_base.h" 8 #include "remoting/protocol/authenticator_test_base.h"
9 #include "remoting/protocol/channel_authenticator.h" 9 #include "remoting/protocol/channel_authenticator.h"
10 #include "remoting/protocol/connection_tester.h" 10 #include "remoting/protocol/connection_tester.h"
(...skipping 25 matching lines...) Expand all
36 36
37 namespace remoting { 37 namespace remoting {
38 namespace protocol { 38 namespace protocol {
39 39
40 class ThirdPartyAuthenticatorTest : public AuthenticatorTestBase { 40 class ThirdPartyAuthenticatorTest : public AuthenticatorTestBase {
41 class FakeTokenFetcher : public ThirdPartyClientAuthenticator::TokenFetcher { 41 class FakeTokenFetcher : public ThirdPartyClientAuthenticator::TokenFetcher {
42 public: 42 public:
43 virtual void FetchThirdPartyToken( 43 virtual void FetchThirdPartyToken(
44 const GURL& token_url, 44 const GURL& token_url,
45 const std::string& scope, 45 const std::string& scope,
46 const TokenFetchedCallback& token_fetched_callback) OVERRIDE { 46 const TokenFetchedCallback& token_fetched_callback) override {
47 ASSERT_EQ(token_url.spec(), kTokenUrl); 47 ASSERT_EQ(token_url.spec(), kTokenUrl);
48 ASSERT_EQ(scope, kTokenScope); 48 ASSERT_EQ(scope, kTokenScope);
49 ASSERT_FALSE(token_fetched_callback.is_null()); 49 ASSERT_FALSE(token_fetched_callback.is_null());
50 on_token_fetched_ = token_fetched_callback; 50 on_token_fetched_ = token_fetched_callback;
51 } 51 }
52 52
53 void OnTokenFetched(const std::string& token, 53 void OnTokenFetched(const std::string& token,
54 const std::string& shared_secret) { 54 const std::string& shared_secret) {
55 ASSERT_FALSE(on_token_fetched_.is_null()); 55 ASSERT_FALSE(on_token_fetched_.is_null());
56 TokenFetchedCallback on_token_fetched = on_token_fetched_; 56 TokenFetchedCallback on_token_fetched = on_token_fetched_;
57 on_token_fetched_.Reset(); 57 on_token_fetched_.Reset();
58 on_token_fetched.Run(token, shared_secret); 58 on_token_fetched.Run(token, shared_secret);
59 } 59 }
60 60
61 private: 61 private:
62 TokenFetchedCallback on_token_fetched_; 62 TokenFetchedCallback on_token_fetched_;
63 }; 63 };
64 64
65 class FakeTokenValidator : public TokenValidator { 65 class FakeTokenValidator : public TokenValidator {
66 public: 66 public:
67 FakeTokenValidator() 67 FakeTokenValidator()
68 : token_url_(kTokenUrl), 68 : token_url_(kTokenUrl),
69 token_scope_(kTokenScope) {} 69 token_scope_(kTokenScope) {}
70 70
71 virtual ~FakeTokenValidator() {} 71 virtual ~FakeTokenValidator() {}
72 72
73 virtual void ValidateThirdPartyToken( 73 virtual void ValidateThirdPartyToken(
74 const std::string& token, 74 const std::string& token,
75 const TokenValidatedCallback& token_validated_callback) OVERRIDE { 75 const TokenValidatedCallback& token_validated_callback) override {
76 ASSERT_FALSE(token_validated_callback.is_null()); 76 ASSERT_FALSE(token_validated_callback.is_null());
77 on_token_validated_ = token_validated_callback; 77 on_token_validated_ = token_validated_callback;
78 } 78 }
79 79
80 void OnTokenValidated(const std::string& shared_secret) { 80 void OnTokenValidated(const std::string& shared_secret) {
81 ASSERT_FALSE(on_token_validated_.is_null()); 81 ASSERT_FALSE(on_token_validated_.is_null());
82 TokenValidatedCallback on_token_validated = on_token_validated_; 82 TokenValidatedCallback on_token_validated = on_token_validated_;
83 on_token_validated_.Reset(); 83 on_token_validated_.Reset();
84 on_token_validated.Run(shared_secret); 84 on_token_validated.Run(shared_secret);
85 } 85 }
86 86
87 virtual const GURL& token_url() const OVERRIDE { 87 virtual const GURL& token_url() const override {
88 return token_url_; 88 return token_url_;
89 } 89 }
90 90
91 virtual const std::string& token_scope() const OVERRIDE { 91 virtual const std::string& token_scope() const override {
92 return token_scope_; 92 return token_scope_;
93 } 93 }
94 94
95 private: 95 private:
96 GURL token_url_; 96 GURL token_url_;
97 std::string token_scope_; 97 std::string token_scope_;
98 base::Callback<void(const std::string& shared_secret)> on_token_validated_; 98 base::Callback<void(const std::string& shared_secret)> on_token_validated_;
99 }; 99 };
100 100
101 public: 101 public:
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, host_->state()); 209 ASSERT_EQ(Authenticator::PROCESSING_MESSAGE, host_->state());
210 ASSERT_NO_FATAL_FAILURE( 210 ASSERT_NO_FATAL_FAILURE(
211 token_validator_->OnTokenValidated(kSharedSecret)); 211 token_validator_->OnTokenValidated(kSharedSecret));
212 212
213 // The end result is that the host rejected the fake authentication. 213 // The end result is that the host rejected the fake authentication.
214 ASSERT_EQ(Authenticator::REJECTED, client_->state()); 214 ASSERT_EQ(Authenticator::REJECTED, client_->state());
215 } 215 }
216 216
217 } // namespace protocol 217 } // namespace protocol
218 } // namespace remoting 218 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/third_party_authenticator_base.h ('k') | remoting/protocol/third_party_client_authenticator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698