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.
5 #ifndef REMOTING_TEST_MOCK_ACCESS_TOKEN_FETCHER_H_
6 #define REMOTING_TEST_MOCK_ACCESS_TOKEN_FETCHER_H_
8 #include "remoting/test/access_token_fetcher.h"
10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h"
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
{
21 MockAccessTokenFetcher();
22 ~MockAccessTokenFetcher() override
;
24 MOCK_METHOD2(GetAccessTokenFromAuthCode
,
25 void(const std::string
& auth_code
,
26 const AccessTokenCallback
& callback
));
28 MOCK_METHOD2(GetAccessTokenFromRefreshToken
,
29 void(const std::string
& refresh_token
,
30 const AccessTokenCallback
& callback
));
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
);
38 scoped_ptr
<AccessTokenFetcher
> internal_access_token_fetcher_
;
40 DISALLOW_COPY_AND_ASSIGN(MockAccessTokenFetcher
);
44 } // namespace remoting
46 #endif // REMOTING_TEST_MOCK_ACCESS_TOKEN_FETCHER_H_