| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <iterator> | 6 #include <iterator> |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/message_loop.h" |
| 12 #include "base/scoped_temp_dir.h" | 13 #include "base/scoped_temp_dir.h" |
| 13 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 14 #include "sql/connection.h" | 15 #include "sql/connection.h" |
| 15 #include "sql/meta_table.h" | 16 #include "sql/meta_table.h" |
| 16 #include "sql/statement.h" | 17 #include "sql/statement.h" |
| 17 #include "sql/transaction.h" | 18 #include "sql/transaction.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include "webkit/quota/mock_special_storage_policy.h" | 20 #include "webkit/quota/mock_special_storage_policy.h" |
| 20 #include "webkit/quota/quota_database.h" | 21 #include "webkit/quota/quota_database.h" |
| 21 | 22 |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 kCurrentVersion, kCompatibleVersion, | 474 kCurrentVersion, kCompatibleVersion, |
| 474 kTables, ARRAYSIZE_UNSAFE(kTables), | 475 kTables, ARRAYSIZE_UNSAFE(kTables), |
| 475 kIndexes, ARRAYSIZE_UNSAFE(kIndexes))); | 476 kIndexes, ARRAYSIZE_UNSAFE(kIndexes))); |
| 476 | 477 |
| 477 // V2 and V3 QuotaTable are compatible, so we can simply use | 478 // V2 and V3 QuotaTable are compatible, so we can simply use |
| 478 // AssignQuotaTable to poplulate v2 database here. | 479 // AssignQuotaTable to poplulate v2 database here. |
| 479 db->BeginTransaction(); | 480 db->BeginTransaction(); |
| 480 AssignQuotaTable(db.get(), entries, entries + entries_size); | 481 AssignQuotaTable(db.get(), entries, entries + entries_size); |
| 481 db->CommitTransaction(); | 482 db->CommitTransaction(); |
| 482 } | 483 } |
| 484 |
| 485 MessageLoop message_loop_; |
| 483 }; | 486 }; |
| 484 | 487 |
| 485 TEST_F(QuotaDatabaseTest, LazyOpen) { | 488 TEST_F(QuotaDatabaseTest, LazyOpen) { |
| 486 ScopedTempDir data_dir; | 489 ScopedTempDir data_dir; |
| 487 ASSERT_TRUE(data_dir.CreateUniqueTempDir()); | 490 ASSERT_TRUE(data_dir.CreateUniqueTempDir()); |
| 488 const FilePath kDbFile = data_dir.path().AppendASCII("quota_manager.db"); | 491 const FilePath kDbFile = data_dir.path().AppendASCII("quota_manager.db"); |
| 489 LazyOpen(kDbFile); | 492 LazyOpen(kDbFile); |
| 490 LazyOpen(FilePath()); | 493 LazyOpen(FilePath()); |
| 491 } | 494 } |
| 492 | 495 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 } | 563 } |
| 561 | 564 |
| 562 TEST_F(QuotaDatabaseTest, DumpOriginInfoTable) { | 565 TEST_F(QuotaDatabaseTest, DumpOriginInfoTable) { |
| 563 ScopedTempDir data_dir; | 566 ScopedTempDir data_dir; |
| 564 ASSERT_TRUE(data_dir.CreateUniqueTempDir()); | 567 ASSERT_TRUE(data_dir.CreateUniqueTempDir()); |
| 565 const FilePath kDbFile = data_dir.path().AppendASCII("quota_manager.db"); | 568 const FilePath kDbFile = data_dir.path().AppendASCII("quota_manager.db"); |
| 566 DumpOriginInfoTable(kDbFile); | 569 DumpOriginInfoTable(kDbFile); |
| 567 DumpOriginInfoTable(FilePath()); | 570 DumpOriginInfoTable(FilePath()); |
| 568 } | 571 } |
| 569 } // namespace quota | 572 } // namespace quota |
| OLD | NEW |