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 fake access_token_fetcher object in but will also work for any | |
Wez
2015/02/24 03:10:19
Why access_token_fetcher? The class is called Acc
joedow1
2015/02/24 05:17:41
Done.
| |
35 // AccessTokenFetcher instance. | |
36 void SetAccessTokenFetcher(scoped_ptr<AccessTokenFetcher> fetcher); | |
37 | |
38 private: | |
39 scoped_ptr<AccessTokenFetcher> internal_access_token_fetcher_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(MockAccessTokenFetcher); | |
42 }; | |
43 | |
44 } // namespace test | |
45 } // namespace remoting | |
46 | |
47 #endif // REMOTING_TEST_MOCK_ACCESS_TOKEN_FETCHER_H_ | |
OLD | NEW |