Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_TEST_FAKE_ACCESS_TOKEN_FETCHER_H_ | |
| 6 #define REMOTING_TEST_FAKE_ACCESS_TOKEN_FETCHER_H_ | |
| 7 | |
| 8 #include "remoting/test/access_token_fetcher.h" | |
| 9 | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | |
| 11 | |
| 12 namespace remoting { | |
| 13 namespace test { | |
| 14 | |
| 15 const char kFakeAccessTokenFetcherRefreshTokenValue[] = "fake_refresh_token"; | |
| 16 const char kFakeAccessTokenFetcherAccessTokenValue[] = "fake_access_token"; | |
| 17 | |
| 18 // Used for testing classes which rely on the AccessTokenFetcher and want to | |
| 19 // simulate success and failure scenarios without using the actual class and | |
| 20 // network connection. | |
| 21 class FakeAccessTokenFetcher : public AccessTokenFetcher { | |
| 22 public: | |
| 23 FakeAccessTokenFetcher(); | |
| 24 ~FakeAccessTokenFetcher() override; | |
| 25 | |
| 26 // AccessTokenFetcher interface. | |
| 27 void GetAccessTokenFromAuthCode( | |
| 28 const std::string& auth_code, | |
| 29 const AccessTokenCallback& callback) override; | |
| 30 | |
|
Wez
2015/02/24 03:10:19
nit: Suggest removing this blank line, so it's cle
joedow1
2015/02/24 05:17:40
Done.
| |
| 31 void GetAccessTokenFromRefreshToken( | |
| 32 const std::string& refresh_token, | |
| 33 const AccessTokenCallback& callback) override; | |
| 34 | |
| 35 void SetFailAccessTokenFromAuthCode(bool fail) { | |
| 36 fail_access_token_from_auth_code_ = fail; | |
| 37 } | |
| 38 | |
| 39 void SetFailAccessTokenFromRefreshToken(bool fail) { | |
| 40 fail_access_token_from_refresh_token_ = fail; | |
| 41 } | |
| 42 | |
| 43 private: | |
| 44 // True if GetAccessTokenFromAuthCode() should fail. | |
| 45 bool fail_access_token_from_auth_code_; | |
| 46 | |
| 47 // True if GetAccessTokenFromRefreshToken() should fail. | |
| 48 bool fail_access_token_from_refresh_token_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(FakeAccessTokenFetcher); | |
| 51 }; | |
| 52 | |
| 53 } // namespace test | |
| 54 } // namespace remoting | |
| 55 | |
| 56 #endif // REMOTING_TEST_FAKE_ACCESS_TOKEN_FETCHER_H_ | |
| OLD | NEW |