Remove ExtensionPrefs::SetDidExtensionEscalatePermissions.
[chromium-blink-merge.git] / extensions / shell / browser / shell_oauth2_token_service_unittest.cc
blob8b9dc72dad6dc6b6c26cd4ae787a29339b1bf246
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
3 // found in the LICENSE file.
5 #include "extensions/shell/browser/shell_oauth2_token_service.h"
7 #include "content/public/test/test_browser_thread_bundle.h"
8 #include "extensions/browser/extensions_test.h"
10 namespace extensions {
12 class ShellOAuth2TokenServiceTest : public ExtensionsTest {
13 public:
14 ShellOAuth2TokenServiceTest() {}
15 ~ShellOAuth2TokenServiceTest() override {}
17 private:
18 content::TestBrowserThreadBundle thread_bundle_;
21 // Verifies setting the refresh token makes it available.
22 TEST_F(ShellOAuth2TokenServiceTest, SetRefreshToken) {
23 ShellOAuth2TokenService service(nullptr, "larry@google.com", "token123");
25 // Only has a token for the account in the constructor.
26 EXPECT_EQ("larry@google.com", service.account_id());
27 EXPECT_TRUE(service.RefreshTokenIsAvailable("larry@google.com"));
28 EXPECT_FALSE(service.RefreshTokenIsAvailable("sergey@google.com"));
30 service.SetRefreshToken("sergey@google.com", "token456");
32 // The account and refresh token have updated.
33 EXPECT_EQ("sergey@google.com", service.account_id());
34 EXPECT_FALSE(service.RefreshTokenIsAvailable("larry@google.com"));
35 EXPECT_TRUE(service.RefreshTokenIsAvailable("sergey@google.com"));
38 } // namespace extensions