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" |
(...skipping 29 matching lines...) Expand all Loading... |
40 io_thread_(BrowserThread::IO, &message_loop_) { | 40 io_thread_(BrowserThread::IO, &message_loop_) { |
41 TestingProfile profile; | 41 TestingProfile profile; |
42 idb_context_ = profile.GetWebKitContext()->indexed_db_context(); | 42 idb_context_ = profile.GetWebKitContext()->indexed_db_context(); |
43 setup_temp_dir(); | 43 setup_temp_dir(); |
44 } | 44 } |
45 void setup_temp_dir() { | 45 void setup_temp_dir() { |
46 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 46 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
47 FilePath indexeddb_dir = temp_dir_.path().Append( | 47 FilePath indexeddb_dir = temp_dir_.path().Append( |
48 IndexedDBContext::kIndexedDBDirectory); | 48 IndexedDBContext::kIndexedDBDirectory); |
49 ASSERT_TRUE(file_util::CreateDirectory(indexeddb_dir)); | 49 ASSERT_TRUE(file_util::CreateDirectory(indexeddb_dir)); |
50 idb_context()->set_data_path(indexeddb_dir); | 50 idb_context()->set_data_path_for_testing(indexeddb_dir); |
51 } | 51 } |
52 | 52 |
53 ~IndexedDBQuotaClientTest() { | 53 ~IndexedDBQuotaClientTest() { |
54 // IndexedDBContext needs to be destructed on BrowserThread::WEBKIT, which | 54 // IndexedDBContext needs to be destructed on BrowserThread::WEBKIT, which |
55 // is also a member variable of this class. Cause IndexedDBContext's | 55 // is also a member variable of this class. Cause IndexedDBContext's |
56 // destruction now to ensure that it doesn't outlive BrowserThread::WEBKIT. | 56 // destruction now to ensure that it doesn't outlive BrowserThread::WEBKIT. |
57 idb_context_ = NULL; | 57 idb_context_ = NULL; |
58 MessageLoop::current()->RunAllPending(); | 58 MessageLoop::current()->RunAllPending(); |
59 } | 59 } |
60 | 60 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 AddFakeIndexedDB(kOriginA, 1000); | 221 AddFakeIndexedDB(kOriginA, 1000); |
222 AddFakeIndexedDB(kOriginB, 50); | 222 AddFakeIndexedDB(kOriginB, 50); |
223 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); | 223 EXPECT_EQ(1000, GetOriginUsage(&client, kOriginA, kTemp)); |
224 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 224 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
225 | 225 |
226 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); | 226 quota::QuotaStatusCode delete_status = DeleteOrigin(&client, kOriginA); |
227 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); | 227 EXPECT_EQ(quota::kQuotaStatusOk, delete_status); |
228 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); | 228 EXPECT_EQ(0, GetOriginUsage(&client, kOriginA, kTemp)); |
229 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); | 229 EXPECT_EQ(50, GetOriginUsage(&client, kOriginB, kTemp)); |
230 } | 230 } |
OLD | NEW |