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

Side by Side Diff: chrome/browser/extensions/token_cache/token_cache_service_unittest.cc

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 7 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
OLDNEW
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 "content/public/test/test_browser_thread_bundle.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 using base::Time; 13 using base::Time;
13 using base::TimeDelta; 14 using base::TimeDelta;
14 15
15 namespace extensions { 16 namespace extensions {
16 17
17 class TokenCacheTest : public testing::Test { 18 class TokenCacheTest : public testing::Test {
18 public: 19 public:
19 TokenCacheTest() : cache_(&profile_) {} 20 TokenCacheTest() : cache_(&profile_) {}
(...skipping 17 matching lines...) Expand all
37 Time yesterday = now - one_day; 38 Time yesterday = now - one_day;
38 39
39 TokenCacheService::TokenCacheData token_data; 40 TokenCacheService::TokenCacheData token_data;
40 token_data.token = token_value; 41 token_data.token = token_value;
41 token_data.expiration_time = yesterday; 42 token_data.expiration_time = yesterday;
42 43
43 cache_.token_cache_[token_name] = token_data; 44 cache_.token_cache_[token_name] = token_data;
44 } 45 }
45 46
46 protected: 47 protected:
48 content::TestBrowserThreadBundle thread_bundle_;
47 TestingProfile profile_; 49 TestingProfile profile_;
48 TokenCacheService cache_; 50 TokenCacheService cache_;
49 }; 51 };
50 52
51 TEST_F(TokenCacheTest, SaveTokenTest) { 53 TEST_F(TokenCacheTest, SaveTokenTest) {
52 TimeDelta zero; 54 TimeDelta zero;
53 cache_.StoreToken("foo", "bar", zero); 55 cache_.StoreToken("foo", "bar", zero);
54 56
55 EXPECT_EQ(1U, CacheSize()); 57 EXPECT_EQ(1U, CacheSize());
56 EXPECT_TRUE(HasMatch("foo")); 58 EXPECT_TRUE(HasMatch("foo"));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 InsertExpiredToken("foo", "bar"); 102 InsertExpiredToken("foo", "bar");
101 103
102 EXPECT_EQ(1U, CacheSize()); 104 EXPECT_EQ(1U, CacheSize());
103 105
104 // If we attempt to find the token, the attempt should fail. 106 // If we attempt to find the token, the attempt should fail.
105 EXPECT_FALSE(HasMatch("foo")); 107 EXPECT_FALSE(HasMatch("foo"));
106 EXPECT_EQ(0U, CacheSize()); 108 EXPECT_EQ(0U, CacheSize());
107 } 109 }
108 110
109 } // namespace extensions 111 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/install_tracker_unittest.cc ('k') | chrome/browser/extensions/warning_badge_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698