| 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 "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" |
| 8 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 9 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| 10 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
| 11 #include "base/time.h" | 12 #include "base/time.h" |
| 12 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 13 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 14 #include "net/base/test_completion_callback.h" | 15 #include "net/base/test_completion_callback.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "third_party/sqlite/sqlite3.h" | 17 #include "third_party/sqlite/sqlite3.h" |
| 17 #include "webkit/database/database_tracker.h" | 18 #include "webkit/database/database_tracker.h" |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 int64 database_size = 0; | 533 int64 database_size = 0; |
| 533 const string16 kOrigin1 = | 534 const string16 kOrigin1 = |
| 534 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); | 535 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); |
| 535 const string16 kOrigin2 = | 536 const string16 kOrigin2 = |
| 536 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); | 537 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); |
| 537 const string16 kDB1 = ASCIIToUTF16("db1"); | 538 const string16 kDB1 = ASCIIToUTF16("db1"); |
| 538 const string16 kDB2 = ASCIIToUTF16("db2"); | 539 const string16 kDB2 = ASCIIToUTF16("db2"); |
| 539 const string16 kDescription = ASCIIToUTF16("database_description"); | 540 const string16 kDescription = ASCIIToUTF16("database_description"); |
| 540 | 541 |
| 541 // Initialize the tracker database. | 542 // Initialize the tracker database. |
| 543 MessageLoop message_loop; |
| 542 ScopedTempDir temp_dir; | 544 ScopedTempDir temp_dir; |
| 543 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 545 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 544 FilePath origin1_db_dir; | 546 FilePath origin1_db_dir; |
| 545 FilePath origin2_db_dir; | 547 FilePath origin2_db_dir; |
| 546 { | 548 { |
| 547 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = | 549 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = |
| 548 new quota::MockSpecialStoragePolicy; | 550 new quota::MockSpecialStoragePolicy; |
| 549 special_storage_policy->AddSessionOnly(GURL(kOrigin2Url)); | 551 special_storage_policy->AddSessionOnly(GURL(kOrigin2Url)); |
| 550 scoped_refptr<DatabaseTracker> tracker( | 552 scoped_refptr<DatabaseTracker> tracker( |
| 551 new DatabaseTracker( | 553 new DatabaseTracker( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 int64 database_size = 0; | 611 int64 database_size = 0; |
| 610 const string16 kOrigin1 = | 612 const string16 kOrigin1 = |
| 611 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); | 613 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); |
| 612 const string16 kOrigin2 = | 614 const string16 kOrigin2 = |
| 613 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); | 615 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); |
| 614 const string16 kDB1 = ASCIIToUTF16("db1"); | 616 const string16 kDB1 = ASCIIToUTF16("db1"); |
| 615 const string16 kDB2 = ASCIIToUTF16("db2"); | 617 const string16 kDB2 = ASCIIToUTF16("db2"); |
| 616 const string16 kDescription = ASCIIToUTF16("database_description"); | 618 const string16 kDescription = ASCIIToUTF16("database_description"); |
| 617 | 619 |
| 618 // Initialize the tracker database. | 620 // Initialize the tracker database. |
| 621 MessageLoop message_loop; |
| 619 ScopedTempDir temp_dir; | 622 ScopedTempDir temp_dir; |
| 620 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 623 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| 621 FilePath origin1_db_dir; | 624 FilePath origin1_db_dir; |
| 622 FilePath origin2_db_dir; | 625 FilePath origin2_db_dir; |
| 623 { | 626 { |
| 624 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = | 627 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = |
| 625 new quota::MockSpecialStoragePolicy; | 628 new quota::MockSpecialStoragePolicy; |
| 626 special_storage_policy->AddSessionOnly(GURL(kOrigin2Url)); | 629 special_storage_policy->AddSessionOnly(GURL(kOrigin2Url)); |
| 627 scoped_refptr<DatabaseTracker> tracker( | 630 scoped_refptr<DatabaseTracker> tracker( |
| 628 new DatabaseTracker( | 631 new DatabaseTracker( |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 | 839 |
| 837 TEST(DatabaseTrackerTest, EmptyDatabaseNameIsValid) { | 840 TEST(DatabaseTrackerTest, EmptyDatabaseNameIsValid) { |
| 838 DatabaseTracker_TestHelper_Test::EmptyDatabaseNameIsValid(); | 841 DatabaseTracker_TestHelper_Test::EmptyDatabaseNameIsValid(); |
| 839 } | 842 } |
| 840 | 843 |
| 841 TEST(DatabaseTrackerTest, HandleSqliteError) { | 844 TEST(DatabaseTrackerTest, HandleSqliteError) { |
| 842 DatabaseTracker_TestHelper_Test::HandleSqliteError(); | 845 DatabaseTracker_TestHelper_Test::HandleSqliteError(); |
| 843 } | 846 } |
| 844 | 847 |
| 845 } // namespace webkit_database | 848 } // namespace webkit_database |
| OLD | NEW |