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

Side by Side Diff: content/browser/appcache/appcache_storage_unittest.cc

Issue 2940023002: TaskScheduler: migrate appcache database over to use it. (Closed)
Patch Set: comments + rebase Created 3 years, 5 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 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 "content/browser/appcache/appcache_storage.h" 5 #include "content/browser/appcache/appcache_storage.h"
6 #include "base/message_loop/message_loop.h" 6
7 #include "base/test/scoped_task_environment.h"
7 #include "content/browser/appcache/appcache.h" 8 #include "content/browser/appcache/appcache.h"
8 #include "content/browser/appcache/appcache_group.h" 9 #include "content/browser/appcache/appcache_group.h"
9 #include "content/browser/appcache/appcache_response.h" 10 #include "content/browser/appcache/appcache_response.h"
10 #include "content/browser/appcache/mock_appcache_service.h" 11 #include "content/browser/appcache/mock_appcache_service.h"
11 #include "storage/browser/test/mock_quota_manager_proxy.h" 12 #include "storage/browser/test/mock_quota_manager_proxy.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 namespace { 17 namespace {
17 const storage::StorageType kTemp = storage::kStorageTypeTemporary; 18 const storage::StorageType kTemp = storage::kStorageTypeTemporary;
18 } 19 }
19 20
20 class AppCacheStorageTest : public testing::Test { 21 class AppCacheStorageTest : public testing::Test {
21 public: 22 public:
22 class MockStorageDelegate : public AppCacheStorage::Delegate { 23 class MockStorageDelegate : public AppCacheStorage::Delegate {
23 public: 24 public:
24 }; 25 };
26
27 private:
28 base::test::ScopedTaskEnvironment scoped_task_environment_;
25 }; 29 };
26 30
27 TEST_F(AppCacheStorageTest, AddRemoveCache) { 31 TEST_F(AppCacheStorageTest, AddRemoveCache) {
28 MockAppCacheService service; 32 MockAppCacheService service;
29 scoped_refptr<AppCache> cache(new AppCache(service.storage(), 111)); 33 scoped_refptr<AppCache> cache(new AppCache(service.storage(), 111));
30 34
31 EXPECT_EQ(cache.get(), 35 EXPECT_EQ(cache.get(),
32 service.storage()->working_set()->GetCache(111)); 36 service.storage()->working_set()->GetCache(111));
33 37
34 service.storage()->working_set()->RemoveCache(cache.get()); 38 service.storage()->working_set()->RemoveCache(cache.get());
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 service.storage()->usage_map_[kOrigin] = 5000; 160 service.storage()->usage_map_[kOrigin] = 5000;
157 service.storage()->ClearUsageMapAndNotify(); 161 service.storage()->ClearUsageMapAndNotify();
158 EXPECT_EQ(4, mock_proxy->notify_storage_modified_count()); 162 EXPECT_EQ(4, mock_proxy->notify_storage_modified_count());
159 EXPECT_EQ(-5000, mock_proxy->last_notified_delta()); 163 EXPECT_EQ(-5000, mock_proxy->last_notified_delta());
160 EXPECT_EQ(kOrigin, mock_proxy->last_notified_origin()); 164 EXPECT_EQ(kOrigin, mock_proxy->last_notified_origin());
161 EXPECT_EQ(kTemp, mock_proxy->last_notified_type()); 165 EXPECT_EQ(kTemp, mock_proxy->last_notified_type());
162 EXPECT_TRUE(service.storage()->usage_map_.empty()); 166 EXPECT_TRUE(service.storage()->usage_map_.empty());
163 } 167 }
164 168
165 } // namespace content 169 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_storage_impl_unittest.cc ('k') | content/browser/appcache/appcache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698