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

Side by Side Diff: extensions/shell/browser/shell_oauth2_token_service_unittest.cc

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 5 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
« no previous file with comments | « extensions/shell/browser/shell_oauth2_token_service_delegate.cc ('k') | google_apis/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/shell/browser/shell_oauth2_token_service.h" 5 #include "extensions/shell/browser/shell_oauth2_token_service.h"
6 6
7 #include "content/public/test/test_browser_thread_bundle.h" 7 #include "content/public/test/test_browser_thread_bundle.h"
8 #include "extensions/browser/extensions_test.h" 8 #include "extensions/browser/extensions_test.h"
9 9
10 namespace extensions { 10 namespace extensions {
11 11
12 class ShellOAuth2TokenServiceTest : public ExtensionsTest { 12 class ShellOAuth2TokenServiceTest : public ExtensionsTest {
13 public: 13 public:
14 ShellOAuth2TokenServiceTest() {} 14 ShellOAuth2TokenServiceTest() {}
15 ~ShellOAuth2TokenServiceTest() override {} 15 ~ShellOAuth2TokenServiceTest() override {}
16 16
17 private: 17 private:
18 content::TestBrowserThreadBundle thread_bundle_; 18 content::TestBrowserThreadBundle thread_bundle_;
19 }; 19 };
20 20
21 // Verifies setting the refresh token makes it available. 21 // Verifies setting the refresh token makes it available.
22 TEST_F(ShellOAuth2TokenServiceTest, SetRefreshToken) { 22 TEST_F(ShellOAuth2TokenServiceTest, SetRefreshToken) {
23 ShellOAuth2TokenService service(nullptr, "larry@google.com", "token123"); 23 ShellOAuth2TokenService service(nullptr, "larry@google.com", "token123");
24 24
25 // Only has a token for the account in the constructor. 25 // Only has a token for the account in the constructor.
26 EXPECT_EQ("larry@google.com", service.account_id()); 26 EXPECT_EQ("larry@google.com", service.AccountId());
27 EXPECT_TRUE(service.RefreshTokenIsAvailable("larry@google.com")); 27 EXPECT_TRUE(service.RefreshTokenIsAvailable("larry@google.com"));
28 EXPECT_FALSE(service.RefreshTokenIsAvailable("sergey@google.com")); 28 EXPECT_FALSE(service.RefreshTokenIsAvailable("sergey@google.com"));
29 29
30 service.SetRefreshToken("sergey@google.com", "token456"); 30 service.SetRefreshToken("sergey@google.com", "token456");
31 31
32 // The account and refresh token have updated. 32 // The account and refresh token have updated.
33 EXPECT_EQ("sergey@google.com", service.account_id()); 33 EXPECT_EQ("sergey@google.com", service.AccountId());
34 EXPECT_FALSE(service.RefreshTokenIsAvailable("larry@google.com")); 34 EXPECT_FALSE(service.RefreshTokenIsAvailable("larry@google.com"));
35 EXPECT_TRUE(service.RefreshTokenIsAvailable("sergey@google.com")); 35 EXPECT_TRUE(service.RefreshTokenIsAvailable("sergey@google.com"));
36 } 36 }
37 37
38 } // namespace extensions 38 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/shell/browser/shell_oauth2_token_service_delegate.cc ('k') | google_apis/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698