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

Side by Side Diff: content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc

Issue 8340028: Salient parts of http://codereview.chromium.org/8392042/ (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <map> 5 #include <map>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/memory/scoped_callback_factory.h" 10 #include "base/memory/scoped_callback_factory.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/message_loop_proxy.h" 12 #include "base/message_loop_proxy.h"
13 #include "base/scoped_temp_dir.h" 13 #include "base/scoped_temp_dir.h"
14 #include "content/browser/in_process_webkit/indexed_db_context.h" 14 #include "content/browser/in_process_webkit/indexed_db_context.h"
15 #include "content/browser/in_process_webkit/indexed_db_quota_client.h" 15 #include "content/browser/in_process_webkit/indexed_db_quota_client.h"
16 #include "content/browser/in_process_webkit/webkit_context.h" 16 #include "content/browser/in_process_webkit/webkit_context.h"
17 #include "content/test/test_browser_context.h" 17 #include "content/test/test_browser_context.h"
18 #include "content/test/test_browser_thread.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "webkit/database/database_util.h" 20 #include "webkit/database/database_util.h"
20 21
21 // Declared to shorten the line lengths. 22 // Declared to shorten the line lengths.
22 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; 23 static const quota::StorageType kTemp = quota::kStorageTypeTemporary;
23 static const quota::StorageType kPerm = quota::kStorageTypePersistent; 24 static const quota::StorageType kPerm = quota::kStorageTypePersistent;
24 25
25 using namespace webkit_database; 26 using namespace webkit_database;
26 27
27 // Base class for our test fixtures. 28 // Base class for our test fixtures.
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 delete_status_ = code; 147 delete_status_ = code;
147 } 148 }
148 149
149 ScopedTempDir temp_dir_; 150 ScopedTempDir temp_dir_;
150 int64 usage_; 151 int64 usage_;
151 std::set<GURL> origins_; 152 std::set<GURL> origins_;
152 quota::StorageType type_; 153 quota::StorageType type_;
153 scoped_refptr<IndexedDBContext> idb_context_; 154 scoped_refptr<IndexedDBContext> idb_context_;
154 base::WeakPtrFactory<IndexedDBQuotaClientTest> weak_factory_; 155 base::WeakPtrFactory<IndexedDBQuotaClientTest> weak_factory_;
155 MessageLoop message_loop_; 156 MessageLoop message_loop_;
156 BrowserThread webkit_thread_; 157 content::TestBrowserThread webkit_thread_;
157 BrowserThread io_thread_; 158 content::TestBrowserThread io_thread_;
158 quota::QuotaStatusCode delete_status_; 159 quota::QuotaStatusCode delete_status_;
159 }; 160 };
160 161
161 162
162 TEST_F(IndexedDBQuotaClientTest, GetOriginUsage) { 163 TEST_F(IndexedDBQuotaClientTest, GetOriginUsage) {
163 IndexedDBQuotaClient client( 164 IndexedDBQuotaClient client(
164 base::MessageLoopProxy::current(), 165 base::MessageLoopProxy::current(),
165 idb_context()); 166 idb_context());
166 167
167 AddFakeIndexedDB(kOriginA, 6); 168 AddFakeIndexedDB(kOriginA, 6);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 AddFakeIndexedDB(kOriginA, 1000); 229 AddFakeIndexedDB(kOriginA, 1000);
229 AddFakeIndexedDB(kOriginB, 50); 230 AddFakeIndexedDB(kOriginB, 50);
230 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); 231 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp));
231 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); 232 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
232 233
233 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); 234 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA);
234 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); 235 EXPECT_EQ(quota::kQuotaStatusOk, delete_status);
235 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); 236 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp));
236 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); 237 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp));
237 } 238 }
OLDNEW
« no previous file with comments | « content/browser/in_process_webkit/indexed_db_dispatcher_host.cc ('k') | content/browser/in_process_webkit/webkit_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698