| 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/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 "content/test/test_browser_thread.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "webkit/database/database_util.h" | 20 #include "webkit/database/database_util.h" |
| 21 | 21 |
| 22 using content::BrowserThread; |
| 23 |
| 22 // Declared to shorten the line lengths. | 24 // Declared to shorten the line lengths. |
| 23 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; | 25 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; |
| 24 static const quota::StorageType kPerm = quota::kStorageTypePersistent; | 26 static const quota::StorageType kPerm = quota::kStorageTypePersistent; |
| 25 | 27 |
| 26 using namespace webkit_database; | 28 using namespace webkit_database; |
| 27 | 29 |
| 28 // Base class for our test fixtures. | 30 // Base class for our test fixtures. |
| 29 class IndexedDBQuotaClientTest : public testing::Test { | 31 class IndexedDBQuotaClientTest : public testing::Test { |
| 30 public: | 32 public: |
| 31 const GURL kOriginA; | 33 const GURL kOriginA; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 AddFakeIndexedDB(kOriginA, 1000); | 231 AddFakeIndexedDB(kOriginA, 1000); |
| 230 AddFakeIndexedDB(kOriginB, 50); | 232 AddFakeIndexedDB(kOriginB, 50); |
| 231 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); | 233 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); |
| 232 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 234 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
| 233 | 235 |
| 234 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); | 236 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); |
| 235 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); | 237 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); |
| 236 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); | 238 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); |
| 237 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 239 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
| 238 } | 240 } |
| OLD | NEW |