| OLD | NEW |
| 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/api/identity/identity_api.h" | 5 #include "extensions/shell/browser/api/identity/identity_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 public: | 58 public: |
| 59 IdentityApiTest() {} | 59 IdentityApiTest() {} |
| 60 ~IdentityApiTest() override {} | 60 ~IdentityApiTest() override {} |
| 61 | 61 |
| 62 // testing::Test: | 62 // testing::Test: |
| 63 void SetUp() override { | 63 void SetUp() override { |
| 64 ApiUnitTest::SetUp(); | 64 ApiUnitTest::SetUp(); |
| 65 // Create an extension with OAuth2 scopes. | 65 // Create an extension with OAuth2 scopes. |
| 66 set_extension( | 66 set_extension( |
| 67 ExtensionBuilder() | 67 ExtensionBuilder() |
| 68 .SetManifest(std::move( | 68 .SetManifest( |
| 69 DictionaryBuilder() | 69 DictionaryBuilder() |
| 70 .Set("name", "Test") | 70 .Set("name", "Test") |
| 71 .Set("version", "1.0") | 71 .Set("version", "1.0") |
| 72 .Set("oauth2", | 72 .Set("oauth2", |
| 73 std::move(DictionaryBuilder() | 73 DictionaryBuilder() |
| 74 .Set("client_id", | 74 .Set("client_id", |
| 75 "123456.apps.googleusercontent.com") | 75 "123456.apps.googleusercontent.com") |
| 76 .Set("scopes", | 76 .Set("scopes", |
| 77 std::move(ListBuilder().Append( | 77 ListBuilder() |
| 78 "https://www.googleapis.com/" | 78 .Append("https://www.googleapis.com/" |
| 79 "auth/drive"))))))) | 79 "auth/drive") |
| 80 .Build()) |
| 81 .Build()) |
| 82 .Build()) |
| 80 .SetLocation(Manifest::UNPACKED) | 83 .SetLocation(Manifest::UNPACKED) |
| 81 .Build()); | 84 .Build()); |
| 82 } | 85 } |
| 83 }; | 86 }; |
| 84 | 87 |
| 85 // Verifies that the getAuthToken function exists and can be called without | 88 // Verifies that the getAuthToken function exists and can be called without |
| 86 // crashing. | 89 // crashing. |
| 87 TEST_F(IdentityApiTest, GetAuthTokenNoRefreshToken) { | 90 TEST_F(IdentityApiTest, GetAuthTokenNoRefreshToken) { |
| 88 MockShellOAuth2TokenService token_service; | 91 MockShellOAuth2TokenService token_service; |
| 89 | 92 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 119 MockShellOAuth2TokenService token_service; | 122 MockShellOAuth2TokenService token_service; |
| 120 | 123 |
| 121 // Function succeeds and returns nothing (for its callback). | 124 // Function succeeds and returns nothing (for its callback). |
| 122 scoped_ptr<base::Value> result = RunFunctionAndReturnValue( | 125 scoped_ptr<base::Value> result = RunFunctionAndReturnValue( |
| 123 new IdentityRemoveCachedAuthTokenFunction, "[{}]"); | 126 new IdentityRemoveCachedAuthTokenFunction, "[{}]"); |
| 124 EXPECT_FALSE(result.get()); | 127 EXPECT_FALSE(result.get()); |
| 125 } | 128 } |
| 126 | 129 |
| 127 } // namespace shell | 130 } // namespace shell |
| 128 } // namespace extensions | 131 } // namespace extensions |
| OLD | NEW |