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_MOCK_ACCESS_TOKEN_FETCHER_H_ |
| 6 #define REMOTING_TEST_MOCK_ACCESS_TOKEN_FETCHER_H_ |
| 7 |
| 8 #include "remoting/test/access_token_fetcher.h" |
| 9 |
| 10 #include "testing/gmock/include/gmock/gmock.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 |
| 13 namespace remoting { |
| 14 namespace test { |
| 15 |
| 16 // Used for testing classes which rely on the AccessTokenFetcher and want to |
| 17 // simulate success and failure scenarios without using the actual class and |
| 18 // network connection. |
| 19 class MockAccessTokenFetcher : public AccessTokenFetcher { |
| 20 public: |
| 21 MockAccessTokenFetcher(); |
| 22 ~MockAccessTokenFetcher() override; |
| 23 |
| 24 MOCK_METHOD2(GetAccessTokenFromAuthCode, |
| 25 void(const std::string& auth_code, |
| 26 const AccessTokenCallback& callback)); |
| 27 |
| 28 MOCK_METHOD2(GetAccessTokenFromRefreshToken, |
| 29 void(const std::string& refresh_token, |
| 30 const AccessTokenCallback& callback)); |
| 31 |
| 32 // Stores an access token fetcher object and wires up the mock methods to call |
| 33 // through to the appropriate method on it. This method is typically used to |
| 34 // pass a FakeAccessTokenFetcher. |
| 35 void SetAccessTokenFetcher(scoped_ptr<AccessTokenFetcher> fetcher); |
| 36 |
| 37 private: |
| 38 scoped_ptr<AccessTokenFetcher> internal_access_token_fetcher_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(MockAccessTokenFetcher); |
| 41 }; |
| 42 |
| 43 } // namespace test |
| 44 } // namespace remoting |
| 45 |
| 46 #endif // REMOTING_TEST_MOCK_ACCESS_TOKEN_FETCHER_H_ |
OLD | NEW |