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_
10 #include "remoting/test/access_token_fetcher.h"
12 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h"
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 MockAccessTokenFetcher
: public AccessTokenFetcher
{
23 MockAccessTokenFetcher();
24 ~MockAccessTokenFetcher() override
;
26 MOCK_METHOD2(GetAccessTokenFromAuthCode
,
27 void(const std::string
& auth_code
,
28 const AccessTokenCallback
& callback
));
30 MOCK_METHOD2(GetAccessTokenFromRefreshToken
,
31 void(const std::string
& refresh_token
,
32 const AccessTokenCallback
& callback
));
34 // Stores an access token fetcher object and wires up the mock methods to call
35 // through to the appropriate method on it. This method is typically used to
36 // pass a FakeAccessTokenFetcher.
37 void SetAccessTokenFetcher(scoped_ptr
<AccessTokenFetcher
> fetcher
);
40 scoped_ptr
<AccessTokenFetcher
> internal_access_token_fetcher_
;
42 DISALLOW_COPY_AND_ASSIGN(MockAccessTokenFetcher
);
46 } // namespace remoting
48 #endif // REMOTING_TEST_MOCK_ACCESS_TOKEN_FETCHER_H_