diff options
Diffstat (limited to 'webkit/database/database_tracker_unittest.cc')
-rw-r--r-- | webkit/database/database_tracker_unittest.cc | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/webkit/database/database_tracker_unittest.cc b/webkit/database/database_tracker_unittest.cc index 88e8981..14bd480 100644 --- a/webkit/database/database_tracker_unittest.cc +++ b/webkit/database/database_tracker_unittest.cc @@ -167,7 +167,7 @@ TEST(DatabaseTrackerTest, DeleteOpenDatabase) { tracker->RemoveObserver(&observer); } -TEST(DatabaseTrackerTest, TestIt) { +TEST(DatabaseTrackerTest, DatabaseTracker) { // Initialize the tracker database. ScopedTempDir temp_dir; EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -361,4 +361,38 @@ TEST(DatabaseTrackerTest, TestIt) { EXPECT_EQ(origin1_quota, tracker->GetOriginSpaceAvailable(kOrigin1)); } +TEST(DatabaseTrackerTest, NoInitIncognito) { + const string16 kOrigin = ASCIIToUTF16("origin"); + const string16 kName = ASCIIToUTF16("name"); + const string16 kDescription = ASCIIToUTF16("description"); + const DatabaseConnections kEmptyCollection; + + std::vector<OriginInfo> infos; + scoped_refptr<DatabaseTracker> tracker(new DatabaseTracker(FilePath())); + EXPECT_TRUE(tracker->is_incognito_); + EXPECT_FALSE(tracker->LazyInit()); + EXPECT_TRUE(tracker->DatabaseDirectory().empty()); + EXPECT_TRUE(tracker->GetFullDBFilePath(kOrigin, kName).empty()); + EXPECT_FALSE(tracker->GetAllOriginsInfo(&infos)); + EXPECT_FALSE(tracker->IsDatabaseScheduledForDeletion(kOrigin, kName)); + EXPECT_EQ(net::ERR_FAILED, + tracker->DeleteDatabase(kOrigin, kName, NULL)); + EXPECT_EQ(net::ERR_FAILED, + tracker->DeleteDataModifiedSince(base::Time(), NULL)); + EXPECT_EQ(net::ERR_FAILED, + tracker->DeleteDataForOrigin(kOrigin, NULL)); + + // These should not assert or crash when called in this state. + int64 size_out(0), space_available_out(0); + tracker->DatabaseOpened(kOrigin, kName, kDescription, 1, + &size_out, &space_available_out); + tracker->DatabaseModified(kOrigin, kName); + tracker->DatabaseClosed(kOrigin, kName); + tracker->CloseDatabases(kEmptyCollection); + tracker->CloseTrackerDatabaseAndClearCaches(); + tracker->SetOriginQuota(kOrigin, 5); + tracker->SetOriginQuotaInMemory(kOrigin, 5); + tracker->ResetOriginQuotaInMemory(kOrigin); +} + } // namespace webkit_database |