OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "chrome/browser/extensions/token_cache/token_cache_service.h" | 8 #include "chrome/browser/extensions/token_cache/token_cache_service.h" |
9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 EXPECT_EQ(1U, CacheSize()); | 82 EXPECT_EQ(1U, CacheSize()); |
83 } | 83 } |
84 | 84 |
85 TEST_F(TokenCacheTest, SignoutTest) { | 85 TEST_F(TokenCacheTest, SignoutTest) { |
86 TimeDelta zero; | 86 TimeDelta zero; |
87 cache_.StoreToken("foo", "bar", zero); | 87 cache_.StoreToken("foo", "bar", zero); |
88 | 88 |
89 EXPECT_EQ(1U, CacheSize()); | 89 EXPECT_EQ(1U, CacheSize()); |
90 EXPECT_TRUE(HasMatch("foo")); | 90 EXPECT_TRUE(HasMatch("foo")); |
91 | 91 |
92 cache_.GoogleSignedOut("foo"); | 92 cache_.GoogleSignedOut("foo", "foo"); |
93 | 93 |
94 EXPECT_EQ(0U, CacheSize()); | 94 EXPECT_EQ(0U, CacheSize()); |
95 EXPECT_FALSE(HasMatch("foo")); | 95 EXPECT_FALSE(HasMatch("foo")); |
96 } | 96 } |
97 | 97 |
98 TEST_F(TokenCacheTest, TokenExpireTest) { | 98 TEST_F(TokenCacheTest, TokenExpireTest) { |
99 // Use the fact that we are friends to insert an expired token. | 99 // Use the fact that we are friends to insert an expired token. |
100 InsertExpiredToken("foo", "bar"); | 100 InsertExpiredToken("foo", "bar"); |
101 | 101 |
102 EXPECT_EQ(1U, CacheSize()); | 102 EXPECT_EQ(1U, CacheSize()); |
103 | 103 |
104 // If we attempt to find the token, the attempt should fail. | 104 // If we attempt to find the token, the attempt should fail. |
105 EXPECT_FALSE(HasMatch("foo")); | 105 EXPECT_FALSE(HasMatch("foo")); |
106 EXPECT_EQ(0U, CacheSize()); | 106 EXPECT_EQ(0U, CacheSize()); |
107 } | 107 } |
108 | 108 |
109 } // namespace extensions | 109 } // namespace extensions |
OLD | NEW |