| OLD | NEW |
| 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/files/scoped_temp_dir.h" |
| 10 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 11 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 12 #include "base/scoped_temp_dir.h" | |
| 13 #include "content/browser/browser_thread_impl.h" | 13 #include "content/browser/browser_thread_impl.h" |
| 14 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" | 14 #include "content/browser/in_process_webkit/indexed_db_context_impl.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/public/browser/storage_partition.h" | 16 #include "content/public/browser/storage_partition.h" |
| 17 #include "content/public/test/test_browser_context.h" | 17 #include "content/public/test/test_browser_context.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "webkit/database/database_util.h" | 19 #include "webkit/database/database_util.h" |
| 20 | 20 |
| 21 // Declared to shorten the line lengths. | 21 // Declared to shorten the line lengths. |
| 22 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; | 22 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 void OnGetOriginsComplete(const std::set<GURL>& origins, | 150 void OnGetOriginsComplete(const std::set<GURL>& origins, |
| 151 quota::StorageType type) { | 151 quota::StorageType type) { |
| 152 origins_ = origins; | 152 origins_ = origins; |
| 153 type_ = type; | 153 type_ = type; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void OnDeleteOriginComplete(quota::QuotaStatusCode code) { | 156 void OnDeleteOriginComplete(quota::QuotaStatusCode code) { |
| 157 delete_status_ = code; | 157 delete_status_ = code; |
| 158 } | 158 } |
| 159 | 159 |
| 160 ScopedTempDir temp_dir_; | 160 base::ScopedTempDir temp_dir_; |
| 161 int64 usage_; | 161 int64 usage_; |
| 162 std::set<GURL> origins_; | 162 std::set<GURL> origins_; |
| 163 quota::StorageType type_; | 163 quota::StorageType type_; |
| 164 scoped_refptr<IndexedDBContextImpl> idb_context_; | 164 scoped_refptr<IndexedDBContextImpl> idb_context_; |
| 165 base::WeakPtrFactory<IndexedDBQuotaClientTest> weak_factory_; | 165 base::WeakPtrFactory<IndexedDBQuotaClientTest> weak_factory_; |
| 166 MessageLoop message_loop_; | 166 MessageLoop message_loop_; |
| 167 BrowserThreadImpl db_thread_; | 167 BrowserThreadImpl db_thread_; |
| 168 BrowserThreadImpl webkit_thread_; | 168 BrowserThreadImpl webkit_thread_; |
| 169 BrowserThreadImpl file_thread_; | 169 BrowserThreadImpl file_thread_; |
| 170 BrowserThreadImpl file_user_blocking_thread_; | 170 BrowserThreadImpl file_user_blocking_thread_; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); | 244 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); |
| 245 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 245 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
| 246 | 246 |
| 247 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); | 247 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); |
| 248 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); | 248 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); |
| 249 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); | 249 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); |
| 250 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 250 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace content | 253 } // namespace content |
| OLD | NEW |