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

Side by Side Diff: remoting/test/fake_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: Updating AccessTokenFetcher Unittests to use the FakeURLFetcherFactory 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_FAKE_ACCESS_TOKEN_FETCHER_H_
6 #define REMOTING_TEST_FAKE_ACCESS_TOKEN_FETCHER_H_
7
8 #include "remoting/test/access_token_fetcher.h"
9
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace remoting {
13 namespace test {
14
15 const char kFakeAccessTokenFetcherRefreshTokenValue[] = "fake_refresh_token";
16 const char kFakeAccessTokenFetcherAccessTokenValue[] = "fake_access_token";
17
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 FakeAccessTokenFetcher : public AccessTokenFetcher {
22 public:
23 FakeAccessTokenFetcher();
24 ~FakeAccessTokenFetcher() override;
25
26 void GetAccessTokenFromAuthCode(
Wez 2015/02/19 22:00:24 nit: Comment "// AccessTokenFetcher interface." be
joedow 2015/02/20 02:58:36 Done.
27 const std::string& auth_code,
28 const AccessTokenCallback& callback) override;
29
30 void GetAccessTokenFromRefreshToken(
31 const std::string& refresh_token,
32 const AccessTokenCallback& callback) override;
33
34 // Flag passed in will cause the GetAccessTokenFromAuthCode callback to return
35 // an error until the flag is reset by the caller.
Wez 2015/02/19 22:00:24 Suggest changing this to an in-line setter set_fai
joedow 2015/02/20 02:58:36 Done.
36 void SetAuthCodeError(bool simulate_auth_code_error);
37
38 // Flag passed in will cause the GetAccessTokenFromAuthCode callback to return
39 // an error until the flag is reset by the caller.
40 void SetRefreshTokenError(bool simulate_refresh_token_error);
41
42 private:
43 // Causes GetAccessTokenFromAuthCode() to simulate an error.
Wez 2015/02/19 22:00:24 nit: This member doesn't cause anything; you might
joedow 2015/02/20 02:58:36 Done.
44 bool simulate_auth_code_error_;
45
46 // Causes GetAccessTokenFromRefreshToken() to simulate an error.
47 bool simulate_refresh_token_error_;
48
49 DISALLOW_COPY_AND_ASSIGN(FakeAccessTokenFetcher);
50 };
51
52 } // namespace test
53 } // namespace remoting
54
55 #endif // REMOTING_TEST_FAKE_ACCESS_TOKEN_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698