Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: remoting/test/mock_access_token_fetcher.h

Issue 880273006: Adding the AccessTokenFetcher and Environment class to the app remoting test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing last round of CR feedback Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 a fake object and wires up the mock methods to call through to the
33 // appropriate method on the fake object.
34 void SetFakeAccessTokenFetcher(scoped_ptr<AccessTokenFetcher> fake);
Wez 2015/02/23 20:17:15 This accepts any AccessTokenFetcher, so you should
joedow 2015/02/24 02:01:24 Done.
35
36 private:
37 // Delegates the default actions of the methods to a fake object.
38 // This must be called *before* the custom ON_CALL() statements.
Wez 2015/02/23 20:17:15 This comment doesn't make sense - the method is pr
joedow 2015/02/24 02:01:24 Done.
39 void DelegateMethodCallsToFake();
40
41 scoped_ptr<AccessTokenFetcher> fake_;
42
43 DISALLOW_COPY_AND_ASSIGN(MockAccessTokenFetcher);
44 };
45
46 } // namespace test
47 } // namespace remoting
48
49 #endif // REMOTING_TEST_MOCK_ACCESS_TOKEN_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698