| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 statement.BindInt64(3, itr->last_access_time.ToInternalValue()); | 411 statement.BindInt64(3, itr->last_access_time.ToInternalValue()); |
| 412 statement.BindInt64(4, itr->last_modified_time.ToInternalValue()); | 412 statement.BindInt64(4, itr->last_modified_time.ToInternalValue()); |
| 413 EXPECT_TRUE(statement.Run()); | 413 EXPECT_TRUE(statement.Run()); |
| 414 } | 414 } |
| 415 } | 415 } |
| 416 | 416 |
| 417 bool OpenDatabase(sql::Connection* db, const base::FilePath& kDbFile) { | 417 bool OpenDatabase(sql::Connection* db, const base::FilePath& kDbFile) { |
| 418 if (kDbFile.empty()) { | 418 if (kDbFile.empty()) { |
| 419 return db->OpenInMemory(); | 419 return db->OpenInMemory(); |
| 420 } | 420 } |
| 421 if (!file_util::CreateDirectory(kDbFile.DirName())) | 421 if (!base::CreateDirectory(kDbFile.DirName())) |
| 422 return false; | 422 return false; |
| 423 if (!db->Open(kDbFile)) | 423 if (!db->Open(kDbFile)) |
| 424 return false; | 424 return false; |
| 425 db->Preload(); | 425 db->Preload(); |
| 426 return true; | 426 return true; |
| 427 } | 427 } |
| 428 | 428 |
| 429 // Create V2 database and populate some data. | 429 // Create V2 database and populate some data. |
| 430 void CreateV2Database( | 430 void CreateV2Database( |
| 431 const base::FilePath& kDbFile, | 431 const base::FilePath& kDbFile, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 } | 558 } |
| 559 | 559 |
| 560 TEST_F(QuotaDatabaseTest, DumpOriginInfoTable) { | 560 TEST_F(QuotaDatabaseTest, DumpOriginInfoTable) { |
| 561 base::ScopedTempDir data_dir; | 561 base::ScopedTempDir data_dir; |
| 562 ASSERT_TRUE(data_dir.CreateUniqueTempDir()); | 562 ASSERT_TRUE(data_dir.CreateUniqueTempDir()); |
| 563 const base::FilePath kDbFile = data_dir.path().AppendASCII("quota_manager.db")
; | 563 const base::FilePath kDbFile = data_dir.path().AppendASCII("quota_manager.db")
; |
| 564 DumpOriginInfoTable(kDbFile); | 564 DumpOriginInfoTable(kDbFile); |
| 565 DumpOriginInfoTable(base::FilePath()); | 565 DumpOriginInfoTable(base::FilePath()); |
| 566 } | 566 } |
| 567 } // namespace quota | 567 } // namespace quota |
| OLD | NEW |