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 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 // Function succeeds and returns a token (for its callback). | 78 // Function succeeds and returns a token (for its callback). |
79 scoped_ptr<base::Value> result = | 79 scoped_ptr<base::Value> result = |
80 RunFunctionAndReturnValue(new IdentityGetAuthTokenFunction, "[{}]"); | 80 RunFunctionAndReturnValue(new IdentityGetAuthTokenFunction, "[{}]"); |
81 ASSERT_TRUE(result.get()); | 81 ASSERT_TRUE(result.get()); |
82 std::string value; | 82 std::string value; |
83 result->GetAsString(&value); | 83 result->GetAsString(&value); |
84 EXPECT_EQ("token123", value); | 84 EXPECT_EQ("token123", value); |
85 } | 85 } |
86 | 86 |
| 87 // Verifies that the removeCachedAuthToken function exists and can be called |
| 88 // without crashing. |
| 89 TEST_F(IdentityApiTest, RemoveCachedAuthToken) { |
| 90 MockShellOAuth2TokenService token_service; |
| 91 |
| 92 // Function succeeds and returns nothing (for its callback). |
| 93 scoped_ptr<base::Value> result = RunFunctionAndReturnValue( |
| 94 new IdentityRemoveCachedAuthTokenFunction, "[{}]"); |
| 95 EXPECT_FALSE(result.get()); |
| 96 } |
| 97 |
87 } // namespace shell | 98 } // namespace shell |
88 } // namespace extensions | 99 } // namespace extensions |
OLD | NEW |