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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/scoped_callback_factory.h" | 9 #include "base/memory/scoped_callback_factory.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
12 #include "chrome/test/base/testing_browser_process_test.h" | |
13 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
14 #include "content/browser/in_process_webkit/indexed_db_context.h" | 13 #include "content/browser/in_process_webkit/indexed_db_context.h" |
15 #include "content/browser/in_process_webkit/indexed_db_quota_client.h" | 14 #include "content/browser/in_process_webkit/indexed_db_quota_client.h" |
16 #include "content/browser/in_process_webkit/webkit_context.h" | 15 #include "content/browser/in_process_webkit/webkit_context.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "webkit/database/database_util.h" | 17 #include "webkit/database/database_util.h" |
19 | 18 |
20 // Declared to shorten the line lengths. | 19 // Declared to shorten the line lengths. |
21 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; | 20 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; |
22 static const quota::StorageType kPerm = quota::kStorageTypePersistent; | 21 static const quota::StorageType kPerm = quota::kStorageTypePersistent; |
23 | 22 |
24 using namespace webkit_database; | 23 using namespace webkit_database; |
25 | 24 |
26 // Base class for our test fixtures. | 25 // Base class for our test fixtures. |
27 class IndexedDBQuotaClientTest : public TestingBrowserProcessTest { | 26 class IndexedDBQuotaClientTest : public testing::Test { |
28 public: | 27 public: |
29 const GURL kOriginA; | 28 const GURL kOriginA; |
30 const GURL kOriginB; | 29 const GURL kOriginB; |
31 const GURL kOriginOther; | 30 const GURL kOriginOther; |
32 | 31 |
33 IndexedDBQuotaClientTest() | 32 IndexedDBQuotaClientTest() |
34 : kOriginA("http://host"), | 33 : kOriginA("http://host"), |
35 kOriginB("http://host:8000"), | 34 kOriginB("http://host:8000"), |
36 kOriginOther("http://other"), | 35 kOriginOther("http://other"), |
37 usage_(0), | 36 usage_(0), |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 AddFakeIndexedDB(kOriginA, 1000); | 221 AddFakeIndexedDB(kOriginA, 1000); |
223 AddFakeIndexedDB(kOriginB, 50); | 222 AddFakeIndexedDB(kOriginB, 50); |
224 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); | 223 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); |
225 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 224 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
226 | 225 |
227 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); | 226 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); |
228 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); | 227 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); |
229 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); | 228 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); |
230 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 229 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
231 } | 230 } |
OLD | NEW |