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_util.h" | 5 #include "base/file_util.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 observe_size_changes_(true), | 32 observe_size_changes_(true), |
33 observe_scheduled_deletions_(true) { | 33 observe_scheduled_deletions_(true) { |
34 } | 34 } |
35 TestObserver(bool observe_size_changes, bool observe_scheduled_deletions) | 35 TestObserver(bool observe_size_changes, bool observe_scheduled_deletions) |
36 : new_notification_received_(false), | 36 : new_notification_received_(false), |
37 observe_size_changes_(observe_size_changes), | 37 observe_size_changes_(observe_size_changes), |
38 observe_scheduled_deletions_(observe_scheduled_deletions) { | 38 observe_scheduled_deletions_(observe_scheduled_deletions) { |
39 } | 39 } |
40 | 40 |
41 virtual ~TestObserver() {} | 41 virtual ~TestObserver() {} |
42 virtual void OnDatabaseSizeChanged(const string16& origin_identifier, | 42 virtual void OnDatabaseSizeChanged(const base::string16& origin_identifier, |
43 const string16& database_name, | 43 const base::string16& database_name, |
44 int64 database_size) OVERRIDE { | 44 int64 database_size) OVERRIDE { |
45 if (!observe_size_changes_) | 45 if (!observe_size_changes_) |
46 return; | 46 return; |
47 new_notification_received_ = true; | 47 new_notification_received_ = true; |
48 origin_identifier_ = origin_identifier; | 48 origin_identifier_ = origin_identifier; |
49 database_name_ = database_name; | 49 database_name_ = database_name; |
50 database_size_ = database_size; | 50 database_size_ = database_size; |
51 } | 51 } |
52 virtual void OnDatabaseScheduledForDeletion( | 52 virtual void OnDatabaseScheduledForDeletion( |
53 const string16& origin_identifier, | 53 const base::string16& origin_identifier, |
54 const string16& database_name) OVERRIDE { | 54 const base::string16& database_name) OVERRIDE { |
55 if (!observe_scheduled_deletions_) | 55 if (!observe_scheduled_deletions_) |
56 return; | 56 return; |
57 new_notification_received_ = true; | 57 new_notification_received_ = true; |
58 origin_identifier_ = origin_identifier; | 58 origin_identifier_ = origin_identifier; |
59 database_name_ = database_name; | 59 database_name_ = database_name; |
60 } | 60 } |
61 bool DidReceiveNewNotification() { | 61 bool DidReceiveNewNotification() { |
62 bool temp_new_notification_received = new_notification_received_; | 62 bool temp_new_notification_received = new_notification_received_; |
63 new_notification_received_ = false; | 63 new_notification_received_ = false; |
64 return temp_new_notification_received; | 64 return temp_new_notification_received; |
65 } | 65 } |
66 string16 GetNotificationOriginIdentifier() { return origin_identifier_; } | 66 base::string16 GetNotificationOriginIdentifier() { |
67 string16 GetNotificationDatabaseName() { return database_name_; } | 67 return origin_identifier_; |
| 68 } |
| 69 base::string16 GetNotificationDatabaseName() { return database_name_; } |
68 int64 GetNotificationDatabaseSize() { return database_size_; } | 70 int64 GetNotificationDatabaseSize() { return database_size_; } |
69 | 71 |
70 private: | 72 private: |
71 bool new_notification_received_; | 73 bool new_notification_received_; |
72 bool observe_size_changes_; | 74 bool observe_size_changes_; |
73 bool observe_scheduled_deletions_; | 75 bool observe_scheduled_deletions_; |
74 string16 origin_identifier_; | 76 base::string16 origin_identifier_; |
75 string16 database_name_; | 77 base::string16 database_name_; |
76 int64 database_size_; | 78 int64 database_size_; |
77 }; | 79 }; |
78 | 80 |
79 void CheckNotificationReceived(TestObserver* observer, | 81 void CheckNotificationReceived(TestObserver* observer, |
80 const string16& expected_origin_identifier, | 82 const base::string16& expected_origin_identifier, |
81 const string16& expected_database_name, | 83 const base::string16& expected_database_name, |
82 int64 expected_database_size) { | 84 int64 expected_database_size) { |
83 EXPECT_TRUE(observer->DidReceiveNewNotification()); | 85 EXPECT_TRUE(observer->DidReceiveNewNotification()); |
84 EXPECT_EQ(expected_origin_identifier, | 86 EXPECT_EQ(expected_origin_identifier, |
85 observer->GetNotificationOriginIdentifier()); | 87 observer->GetNotificationOriginIdentifier()); |
86 EXPECT_EQ(expected_database_name, | 88 EXPECT_EQ(expected_database_name, |
87 observer->GetNotificationDatabaseName()); | 89 observer->GetNotificationDatabaseName()); |
88 EXPECT_EQ(expected_database_size, | 90 EXPECT_EQ(expected_database_size, |
89 observer->GetNotificationDatabaseSize()); | 91 observer->GetNotificationDatabaseSize()); |
90 } | 92 } |
91 | 93 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 194 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
193 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = | 195 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = |
194 new quota::MockSpecialStoragePolicy; | 196 new quota::MockSpecialStoragePolicy; |
195 special_storage_policy->AddProtected(GURL(kOrigin2Url)); | 197 special_storage_policy->AddProtected(GURL(kOrigin2Url)); |
196 scoped_refptr<DatabaseTracker> tracker( | 198 scoped_refptr<DatabaseTracker> tracker( |
197 new DatabaseTracker(temp_dir.path(), incognito_mode, | 199 new DatabaseTracker(temp_dir.path(), incognito_mode, |
198 special_storage_policy, NULL, NULL)); | 200 special_storage_policy, NULL, NULL)); |
199 | 201 |
200 // Create and open three databases. | 202 // Create and open three databases. |
201 int64 database_size = 0; | 203 int64 database_size = 0; |
202 const string16 kOrigin1 = | 204 const base::string16 kOrigin1 = |
203 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); | 205 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); |
204 const string16 kOrigin2 = | 206 const base::string16 kOrigin2 = |
205 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); | 207 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); |
206 const string16 kDB1 = ASCIIToUTF16("db1"); | 208 const base::string16 kDB1 = ASCIIToUTF16("db1"); |
207 const string16 kDB2 = ASCIIToUTF16("db2"); | 209 const base::string16 kDB2 = ASCIIToUTF16("db2"); |
208 const string16 kDB3 = ASCIIToUTF16("db3"); | 210 const base::string16 kDB3 = ASCIIToUTF16("db3"); |
209 const string16 kDescription = ASCIIToUTF16("database_description"); | 211 const base::string16 kDescription = ASCIIToUTF16("database_description"); |
210 | 212 |
211 tracker->DatabaseOpened(kOrigin1, kDB1, kDescription, 0, | 213 tracker->DatabaseOpened(kOrigin1, kDB1, kDescription, 0, |
212 &database_size); | 214 &database_size); |
213 tracker->DatabaseOpened(kOrigin2, kDB2, kDescription, 0, | 215 tracker->DatabaseOpened(kOrigin2, kDB2, kDescription, 0, |
214 &database_size); | 216 &database_size); |
215 tracker->DatabaseOpened(kOrigin2, kDB3, kDescription, 0, | 217 tracker->DatabaseOpened(kOrigin2, kDB3, kDescription, 0, |
216 &database_size); | 218 &database_size); |
217 | 219 |
218 EXPECT_TRUE(file_util::CreateDirectory(tracker->DatabaseDirectory().Append( | 220 EXPECT_TRUE(file_util::CreateDirectory(tracker->DatabaseDirectory().Append( |
219 base::FilePath::FromWStringHack(UTF16ToWide( | 221 base::FilePath::FromWStringHack(UTF16ToWide( |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 special_storage_policy, NULL, NULL)); | 305 special_storage_policy, NULL, NULL)); |
304 | 306 |
305 // Add two observers. | 307 // Add two observers. |
306 TestObserver observer1; | 308 TestObserver observer1; |
307 TestObserver observer2; | 309 TestObserver observer2; |
308 tracker->AddObserver(&observer1); | 310 tracker->AddObserver(&observer1); |
309 tracker->AddObserver(&observer2); | 311 tracker->AddObserver(&observer2); |
310 | 312 |
311 // Open three new databases. | 313 // Open three new databases. |
312 int64 database_size = 0; | 314 int64 database_size = 0; |
313 const string16 kOrigin1 = | 315 const base::string16 kOrigin1 = |
314 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); | 316 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); |
315 const string16 kOrigin2 = | 317 const base::string16 kOrigin2 = |
316 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); | 318 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); |
317 const string16 kDB1 = ASCIIToUTF16("db1"); | 319 const base::string16 kDB1 = ASCIIToUTF16("db1"); |
318 const string16 kDB2 = ASCIIToUTF16("db2"); | 320 const base::string16 kDB2 = ASCIIToUTF16("db2"); |
319 const string16 kDB3 = ASCIIToUTF16("db3"); | 321 const base::string16 kDB3 = ASCIIToUTF16("db3"); |
320 const string16 kDescription = ASCIIToUTF16("database_description"); | 322 const base::string16 kDescription = ASCIIToUTF16("database_description"); |
321 | 323 |
322 // Get the info for kOrigin1 and kOrigin2 | 324 // Get the info for kOrigin1 and kOrigin2 |
323 DatabaseTracker::CachedOriginInfo* origin1_info = | 325 DatabaseTracker::CachedOriginInfo* origin1_info = |
324 tracker->GetCachedOriginInfo(kOrigin1); | 326 tracker->GetCachedOriginInfo(kOrigin1); |
325 DatabaseTracker::CachedOriginInfo* origin2_info = | 327 DatabaseTracker::CachedOriginInfo* origin2_info = |
326 tracker->GetCachedOriginInfo(kOrigin1); | 328 tracker->GetCachedOriginInfo(kOrigin1); |
327 EXPECT_TRUE(origin1_info); | 329 EXPECT_TRUE(origin1_info); |
328 EXPECT_TRUE(origin2_info); | 330 EXPECT_TRUE(origin2_info); |
329 | 331 |
330 | 332 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 EXPECT_EQ(size_t(1), origins_info.size()); | 433 EXPECT_EQ(size_t(1), origins_info.size()); |
432 EXPECT_EQ(kOrigin2, origins_info[0].GetOrigin()); | 434 EXPECT_EQ(kOrigin2, origins_info[0].GetOrigin()); |
433 | 435 |
434 origin1_info = tracker->GetCachedOriginInfo(kOrigin1); | 436 origin1_info = tracker->GetCachedOriginInfo(kOrigin1); |
435 EXPECT_TRUE(origin1_info); | 437 EXPECT_TRUE(origin1_info); |
436 EXPECT_EQ(0, origin1_info->TotalSize()); | 438 EXPECT_EQ(0, origin1_info->TotalSize()); |
437 } | 439 } |
438 | 440 |
439 static void DatabaseTrackerQuotaIntegration() { | 441 static void DatabaseTrackerQuotaIntegration() { |
440 const GURL kOrigin(kOrigin1Url); | 442 const GURL kOrigin(kOrigin1Url); |
441 const string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); | 443 const base::string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); |
442 const string16 kName = ASCIIToUTF16("name"); | 444 const base::string16 kName = ASCIIToUTF16("name"); |
443 const string16 kDescription = ASCIIToUTF16("description"); | 445 const base::string16 kDescription = ASCIIToUTF16("description"); |
444 | 446 |
445 base::ScopedTempDir temp_dir; | 447 base::ScopedTempDir temp_dir; |
446 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 448 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
447 | 449 |
448 // Initialize the tracker with a QuotaManagerProxy | 450 // Initialize the tracker with a QuotaManagerProxy |
449 scoped_refptr<TestQuotaManagerProxy> test_quota_proxy( | 451 scoped_refptr<TestQuotaManagerProxy> test_quota_proxy( |
450 new TestQuotaManagerProxy); | 452 new TestQuotaManagerProxy); |
451 scoped_refptr<DatabaseTracker> tracker( | 453 scoped_refptr<DatabaseTracker> tracker( |
452 new DatabaseTracker(temp_dir.path(), false /* incognito */, | 454 new DatabaseTracker(temp_dir.path(), false /* incognito */, |
453 NULL, test_quota_proxy, NULL)); | 455 NULL, test_quota_proxy, NULL)); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 tracker->CloseDatabases(crashed_renderer_connections); | 527 tracker->CloseDatabases(crashed_renderer_connections); |
526 EXPECT_TRUE(test_quota_proxy->WasModificationNotified(kOrigin, 100)); | 528 EXPECT_TRUE(test_quota_proxy->WasModificationNotified(kOrigin, 100)); |
527 | 529 |
528 // Cleanup. | 530 // Cleanup. |
529 crashed_renderer_connections.RemoveAllConnections(); | 531 crashed_renderer_connections.RemoveAllConnections(); |
530 test_quota_proxy->SimulateQuotaManagerDestroyed(); | 532 test_quota_proxy->SimulateQuotaManagerDestroyed(); |
531 } | 533 } |
532 | 534 |
533 static void DatabaseTrackerClearSessionOnlyDatabasesOnExit() { | 535 static void DatabaseTrackerClearSessionOnlyDatabasesOnExit() { |
534 int64 database_size = 0; | 536 int64 database_size = 0; |
535 const string16 kOrigin1 = | 537 const base::string16 kOrigin1 = |
536 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); | 538 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); |
537 const string16 kOrigin2 = | 539 const base::string16 kOrigin2 = |
538 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); | 540 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); |
539 const string16 kDB1 = ASCIIToUTF16("db1"); | 541 const base::string16 kDB1 = ASCIIToUTF16("db1"); |
540 const string16 kDB2 = ASCIIToUTF16("db2"); | 542 const base::string16 kDB2 = ASCIIToUTF16("db2"); |
541 const string16 kDescription = ASCIIToUTF16("database_description"); | 543 const base::string16 kDescription = ASCIIToUTF16("database_description"); |
542 | 544 |
543 // Initialize the tracker database. | 545 // Initialize the tracker database. |
544 MessageLoop message_loop; | 546 MessageLoop message_loop; |
545 base::ScopedTempDir temp_dir; | 547 base::ScopedTempDir temp_dir; |
546 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 548 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
547 base::FilePath origin1_db_dir; | 549 base::FilePath origin1_db_dir; |
548 base::FilePath origin2_db_dir; | 550 base::FilePath origin2_db_dir; |
549 { | 551 { |
550 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = | 552 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = |
551 new quota::MockSpecialStoragePolicy; | 553 new quota::MockSpecialStoragePolicy; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 EXPECT_EQ(base::FilePath(), tracker->GetFullDBFilePath(kOrigin2, kDB2)); | 605 EXPECT_EQ(base::FilePath(), tracker->GetFullDBFilePath(kOrigin2, kDB2)); |
604 | 606 |
605 // The origin directory of kOrigin1 remains, but the origin directory of | 607 // The origin directory of kOrigin1 remains, but the origin directory of |
606 // kOrigin2 is deleted. | 608 // kOrigin2 is deleted. |
607 EXPECT_TRUE(file_util::PathExists(origin1_db_dir)); | 609 EXPECT_TRUE(file_util::PathExists(origin1_db_dir)); |
608 EXPECT_FALSE(file_util::PathExists(origin2_db_dir)); | 610 EXPECT_FALSE(file_util::PathExists(origin2_db_dir)); |
609 } | 611 } |
610 | 612 |
611 static void DatabaseTrackerSetForceKeepSessionState() { | 613 static void DatabaseTrackerSetForceKeepSessionState() { |
612 int64 database_size = 0; | 614 int64 database_size = 0; |
613 const string16 kOrigin1 = | 615 const base::string16 kOrigin1 = |
614 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); | 616 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin1Url)); |
615 const string16 kOrigin2 = | 617 const base::string16 kOrigin2 = |
616 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); | 618 DatabaseUtil::GetOriginIdentifier(GURL(kOrigin2Url)); |
617 const string16 kDB1 = ASCIIToUTF16("db1"); | 619 const base::string16 kDB1 = ASCIIToUTF16("db1"); |
618 const string16 kDB2 = ASCIIToUTF16("db2"); | 620 const base::string16 kDB2 = ASCIIToUTF16("db2"); |
619 const string16 kDescription = ASCIIToUTF16("database_description"); | 621 const base::string16 kDescription = ASCIIToUTF16("database_description"); |
620 | 622 |
621 // Initialize the tracker database. | 623 // Initialize the tracker database. |
622 MessageLoop message_loop; | 624 MessageLoop message_loop; |
623 base::ScopedTempDir temp_dir; | 625 base::ScopedTempDir temp_dir; |
624 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 626 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
625 base::FilePath origin1_db_dir; | 627 base::FilePath origin1_db_dir; |
626 base::FilePath origin2_db_dir; | 628 base::FilePath origin2_db_dir; |
627 { | 629 { |
628 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = | 630 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = |
629 new quota::MockSpecialStoragePolicy; | 631 new quota::MockSpecialStoragePolicy; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 file_util::PathExists(tracker->GetFullDBFilePath(kOrigin1, kDB1))); | 681 file_util::PathExists(tracker->GetFullDBFilePath(kOrigin1, kDB1))); |
680 EXPECT_TRUE( | 682 EXPECT_TRUE( |
681 file_util::PathExists(tracker->GetFullDBFilePath(kOrigin2, kDB2))); | 683 file_util::PathExists(tracker->GetFullDBFilePath(kOrigin2, kDB2))); |
682 | 684 |
683 EXPECT_TRUE(file_util::PathExists(origin1_db_dir)); | 685 EXPECT_TRUE(file_util::PathExists(origin1_db_dir)); |
684 EXPECT_TRUE(file_util::PathExists(origin2_db_dir)); | 686 EXPECT_TRUE(file_util::PathExists(origin2_db_dir)); |
685 } | 687 } |
686 | 688 |
687 static void EmptyDatabaseNameIsValid() { | 689 static void EmptyDatabaseNameIsValid() { |
688 const GURL kOrigin(kOrigin1Url); | 690 const GURL kOrigin(kOrigin1Url); |
689 const string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); | 691 const base::string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); |
690 const string16 kEmptyName; | 692 const base::string16 kEmptyName; |
691 const string16 kDescription(ASCIIToUTF16("description")); | 693 const base::string16 kDescription(ASCIIToUTF16("description")); |
692 const string16 kChangedDescription(ASCIIToUTF16("changed_description")); | 694 const base::string16 kChangedDescription( |
| 695 ASCIIToUTF16("changed_description")); |
693 | 696 |
694 // Initialize a tracker database, no need to put it on disk. | 697 // Initialize a tracker database, no need to put it on disk. |
695 const bool kUseInMemoryTrackerDatabase = true; | 698 const bool kUseInMemoryTrackerDatabase = true; |
696 base::ScopedTempDir temp_dir; | 699 base::ScopedTempDir temp_dir; |
697 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 700 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
698 scoped_refptr<DatabaseTracker> tracker( | 701 scoped_refptr<DatabaseTracker> tracker( |
699 new DatabaseTracker(temp_dir.path(), kUseInMemoryTrackerDatabase, | 702 new DatabaseTracker(temp_dir.path(), kUseInMemoryTrackerDatabase, |
700 NULL, NULL, NULL)); | 703 NULL, NULL, NULL)); |
701 | 704 |
702 // Starts off with no databases. | 705 // Starts off with no databases. |
(...skipping 23 matching lines...) Expand all Loading... |
726 // Deleting it should return to the initial state. | 729 // Deleting it should return to the initial state. |
727 EXPECT_EQ(net::OK, tracker->DeleteDatabase(kOriginId, kEmptyName, | 730 EXPECT_EQ(net::OK, tracker->DeleteDatabase(kOriginId, kEmptyName, |
728 net::CompletionCallback())); | 731 net::CompletionCallback())); |
729 infos.clear(); | 732 infos.clear(); |
730 EXPECT_TRUE(tracker->GetAllOriginsInfo(&infos)); | 733 EXPECT_TRUE(tracker->GetAllOriginsInfo(&infos)); |
731 EXPECT_TRUE(infos.empty()); | 734 EXPECT_TRUE(infos.empty()); |
732 } | 735 } |
733 | 736 |
734 static void HandleSqliteError() { | 737 static void HandleSqliteError() { |
735 const GURL kOrigin(kOrigin1Url); | 738 const GURL kOrigin(kOrigin1Url); |
736 const string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); | 739 const base::string16 kOriginId = DatabaseUtil::GetOriginIdentifier(kOrigin); |
737 const string16 kName(ASCIIToUTF16("name")); | 740 const base::string16 kName(ASCIIToUTF16("name")); |
738 const string16 kDescription(ASCIIToUTF16("description")); | 741 const base::string16 kDescription(ASCIIToUTF16("description")); |
739 | 742 |
740 // Initialize a tracker database, no need to put it on disk. | 743 // Initialize a tracker database, no need to put it on disk. |
741 const bool kUseInMemoryTrackerDatabase = true; | 744 const bool kUseInMemoryTrackerDatabase = true; |
742 base::ScopedTempDir temp_dir; | 745 base::ScopedTempDir temp_dir; |
743 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 746 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
744 scoped_refptr<DatabaseTracker> tracker( | 747 scoped_refptr<DatabaseTracker> tracker( |
745 new DatabaseTracker(temp_dir.path(), kUseInMemoryTrackerDatabase, | 748 new DatabaseTracker(temp_dir.path(), kUseInMemoryTrackerDatabase, |
746 NULL, NULL, NULL)); | 749 NULL, NULL, NULL)); |
747 | 750 |
748 // Setup to observe OnScheduledForDelete notifications. | 751 // Setup to observe OnScheduledForDelete notifications. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 | 843 |
841 TEST(DatabaseTrackerTest, EmptyDatabaseNameIsValid) { | 844 TEST(DatabaseTrackerTest, EmptyDatabaseNameIsValid) { |
842 DatabaseTracker_TestHelper_Test::EmptyDatabaseNameIsValid(); | 845 DatabaseTracker_TestHelper_Test::EmptyDatabaseNameIsValid(); |
843 } | 846 } |
844 | 847 |
845 TEST(DatabaseTrackerTest, HandleSqliteError) { | 848 TEST(DatabaseTrackerTest, HandleSqliteError) { |
846 DatabaseTracker_TestHelper_Test::HandleSqliteError(); | 849 DatabaseTracker_TestHelper_Test::HandleSqliteError(); |
847 } | 850 } |
848 | 851 |
849 } // namespace webkit_database | 852 } // namespace webkit_database |
OLD | NEW |