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

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

Issue 214233005: Move mock_quota_manager and friends from webkit/ to content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "content/browser/quota/mock_quota_manager_proxy.h"
6 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
7 #include "webkit/browser/appcache/appcache.h" 8 #include "webkit/browser/appcache/appcache.h"
8 #include "webkit/browser/appcache/appcache_group.h" 9 #include "webkit/browser/appcache/appcache_group.h"
9 #include "webkit/browser/appcache/appcache_response.h" 10 #include "webkit/browser/appcache/appcache_response.h"
10 #include "webkit/browser/appcache/appcache_storage.h" 11 #include "webkit/browser/appcache/appcache_storage.h"
11 #include "webkit/browser/appcache/mock_appcache_service.h" 12 #include "webkit/browser/appcache/mock_appcache_service.h"
12 #include "webkit/browser/quota/mock_quota_manager_proxy.h"
13 13
14 namespace appcache { 14 using appcache::AppCache;
15 using appcache::AppCacheGroup;
16 using appcache::AppCacheResponseInfo;
17 using appcache::AppCacheStorage;
18 using appcache::kUnkownResponseDataSize;
19 using appcache::MockAppCacheService;
20
21 namespace content {
15 22
16 namespace { 23 namespace {
17 const quota::StorageType kTemp = quota::kStorageTypeTemporary; 24 const quota::StorageType kTemp = quota::kStorageTypeTemporary;
18 } 25 }
19 26
20 class AppCacheStorageTest : public testing::Test { 27 class AppCacheStorageTest : public testing::Test {
21 public: 28 public:
22 class MockStorageDelegate : public AppCacheStorage::Delegate { 29 class MockStorageDelegate : public AppCacheStorage::Delegate {
23 public: 30 public:
24 }; 31 };
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 EXPECT_TRUE(delegate_reference2->HasOneRef()); 118 EXPECT_TRUE(delegate_reference2->HasOneRef());
112 EXPECT_EQ(&delegate, delegate_reference2->delegate); 119 EXPECT_EQ(&delegate, delegate_reference2->delegate);
113 EXPECT_NE(delegate_reference1.get(), delegate_reference2.get()); 120 EXPECT_NE(delegate_reference1.get(), delegate_reference2.get());
114 } 121 }
115 122
116 TEST_F(AppCacheStorageTest, UsageMap) { 123 TEST_F(AppCacheStorageTest, UsageMap) {
117 const GURL kOrigin("http://origin/"); 124 const GURL kOrigin("http://origin/");
118 const GURL kOrigin2("http://origin2/"); 125 const GURL kOrigin2("http://origin2/");
119 126
120 MockAppCacheService service; 127 MockAppCacheService service;
121 scoped_refptr<quota::MockQuotaManagerProxy> mock_proxy( 128 scoped_refptr<MockQuotaManagerProxy> mock_proxy(
122 new quota::MockQuotaManagerProxy(NULL, NULL)); 129 new MockQuotaManagerProxy(NULL, NULL));
123 service.set_quota_manager_proxy(mock_proxy.get()); 130 service.set_quota_manager_proxy(mock_proxy.get());
124 131
125 service.storage()->UpdateUsageMapAndNotify(kOrigin, 0); 132 service.storage()->UpdateUsageMapAndNotify(kOrigin, 0);
126 EXPECT_EQ(0, mock_proxy->notify_storage_modified_count()); 133 EXPECT_EQ(0, mock_proxy->notify_storage_modified_count());
127 134
128 service.storage()->UpdateUsageMapAndNotify(kOrigin, 10); 135 service.storage()->UpdateUsageMapAndNotify(kOrigin, 10);
129 EXPECT_EQ(1, mock_proxy->notify_storage_modified_count()); 136 EXPECT_EQ(1, mock_proxy->notify_storage_modified_count());
130 EXPECT_EQ(10, mock_proxy->last_notified_delta()); 137 EXPECT_EQ(10, mock_proxy->last_notified_delta());
131 EXPECT_EQ(kOrigin, mock_proxy->last_notified_origin()); 138 EXPECT_EQ(kOrigin, mock_proxy->last_notified_origin());
132 EXPECT_EQ(kTemp, mock_proxy->last_notified_type()); 139 EXPECT_EQ(kTemp, mock_proxy->last_notified_type());
(...skipping 22 matching lines...) Expand all
155 service.storage()->usage_map_.clear(); 162 service.storage()->usage_map_.clear();
156 service.storage()->usage_map_[kOrigin] = 5000; 163 service.storage()->usage_map_[kOrigin] = 5000;
157 service.storage()->ClearUsageMapAndNotify(); 164 service.storage()->ClearUsageMapAndNotify();
158 EXPECT_EQ(4, mock_proxy->notify_storage_modified_count()); 165 EXPECT_EQ(4, mock_proxy->notify_storage_modified_count());
159 EXPECT_EQ(-5000, mock_proxy->last_notified_delta()); 166 EXPECT_EQ(-5000, mock_proxy->last_notified_delta());
160 EXPECT_EQ(kOrigin, mock_proxy->last_notified_origin()); 167 EXPECT_EQ(kOrigin, mock_proxy->last_notified_origin());
161 EXPECT_EQ(kTemp, mock_proxy->last_notified_type()); 168 EXPECT_EQ(kTemp, mock_proxy->last_notified_type());
162 EXPECT_TRUE(service.storage()->usage_map_.empty()); 169 EXPECT_TRUE(service.storage()->usage_map_.empty());
163 } 170 }
164 171
165 } // namespace appcache 172 } // namespace content
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698