| 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/testing_browser_process_test.h" |
| 12 #include "chrome/test/testing_profile.h" | 13 #include "chrome/test/testing_profile.h" |
| 13 #include "content/browser/in_process_webkit/indexed_db_context.h" | 14 #include "content/browser/in_process_webkit/indexed_db_context.h" |
| 14 #include "content/browser/in_process_webkit/indexed_db_quota_client.h" | 15 #include "content/browser/in_process_webkit/indexed_db_quota_client.h" |
| 15 #include "content/browser/in_process_webkit/webkit_context.h" | 16 #include "content/browser/in_process_webkit/webkit_context.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "webkit/database/database_util.h" | 18 #include "webkit/database/database_util.h" |
| 18 | 19 |
| 19 // Declared to shorten the line lengths. | 20 // Declared to shorten the line lengths. |
| 20 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; | 21 static const quota::StorageType kTemp = quota::kStorageTypeTemporary; |
| 21 static const quota::StorageType kPerm = quota::kStorageTypePersistent; | 22 static const quota::StorageType kPerm = quota::kStorageTypePersistent; |
| 22 | 23 |
| 23 using namespace webkit_database; | 24 using namespace webkit_database; |
| 24 | 25 |
| 25 // Base class for our test fixtures. | 26 // Base class for our test fixtures. |
| 26 class IndexedDBQuotaClientTest : public testing::Test { | 27 class IndexedDBQuotaClientTest : public TestingBrowserProcessTest { |
| 27 public: | 28 public: |
| 28 const GURL kOriginA; | 29 const GURL kOriginA; |
| 29 const GURL kOriginB; | 30 const GURL kOriginB; |
| 30 const GURL kOriginOther; | 31 const GURL kOriginOther; |
| 31 | 32 |
| 32 IndexedDBQuotaClientTest() | 33 IndexedDBQuotaClientTest() |
| 33 : kOriginA("http://host"), | 34 : kOriginA("http://host"), |
| 34 kOriginB("http://host:8000"), | 35 kOriginB("http://host:8000"), |
| 35 kOriginOther("http://other"), | 36 kOriginOther("http://other"), |
| 36 usage_(0), | 37 usage_(0), |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 EXPECT_TRUE(GetOriginsForType(&client, kTemp).empty()); | 184 EXPECT_TRUE(GetOriginsForType(&client, kTemp).empty()); |
| 184 EXPECT_TRUE(GetOriginsForType(&client, kPerm).empty()); | 185 EXPECT_TRUE(GetOriginsForType(&client, kPerm).empty()); |
| 185 | 186 |
| 186 AddFakeIndexedDB(kOriginA, 1000); | 187 AddFakeIndexedDB(kOriginA, 1000); |
| 187 std::set<GURL> origins = GetOriginsForType(&client, kTemp); | 188 std::set<GURL> origins = GetOriginsForType(&client, kTemp); |
| 188 EXPECT_EQ(origins.size(), 1ul); | 189 EXPECT_EQ(origins.size(), 1ul); |
| 189 EXPECT_TRUE(origins.find(kOriginA) != origins.end()); | 190 EXPECT_TRUE(origins.find(kOriginA) != origins.end()); |
| 190 | 191 |
| 191 EXPECT_TRUE(GetOriginsForType(&client, kPerm).empty()); | 192 EXPECT_TRUE(GetOriginsForType(&client, kPerm).empty()); |
| 192 } | 193 } |
| OLD | NEW |