Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Unified Diff: webkit/appcache/appcache_storage_impl_unittest.cc

Issue 7210006: AppCaches which belong to hosted apps are not protected from deletion (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Test beautification. Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/appcache/appcache_storage_impl_unittest.cc
diff --git a/webkit/appcache/appcache_storage_impl_unittest.cc b/webkit/appcache/appcache_storage_impl_unittest.cc
index 0b914f7e54990156618333dbc4614d3c3eda4fd8..30360c1f8e27163ac1403b59ca2a062a32d6137b 100644
--- a/webkit/appcache/appcache_storage_impl_unittest.cc
+++ b/webkit/appcache/appcache_storage_impl_unittest.cc
@@ -466,6 +466,13 @@ class AppCacheStorageImplTest : public testing::Test {
TestFinished();
}
+ void CreateGroupSyncInPopulatedOrigin() {
+ storage()->usage_map_[kOrigin] = kDefaultEntrySize;
+
+ storage()->SyncLoadOrCreateGroup(kManifestUrl, delegate());
+ Verify_CreateGroup();
+ }
+
// LoadGroupAndCache_FarHit --------------------------------------
void LoadGroupAndCache_FarHit() {
@@ -713,11 +720,7 @@ class AppCacheStorageImplTest : public testing::Test {
// MakeGroupObsolete -------------------------------
- void MakeGroupObsolete() {
- // Make a group obsolete, should complete asyncly.
- PushNextTask(NewRunnableMethod(
- this, &AppCacheStorageImplTest::Verify_MakeGroupObsolete));
-
+ void Setup_MakeGroupObsolete() {
// Setup some preconditions. Create a group and newest cache that
// appears to be "stored" and "currently in use".
MakeCacheAndGroup(kManifestUrl, 1, 1, true);
@@ -743,12 +746,26 @@ class AppCacheStorageImplTest : public testing::Test {
online_whitelist_record.cache_id = 1;
online_whitelist_record.namespace_url = kOnlineNamespace;
EXPECT_TRUE(database()->InsertOnlineWhiteList(&online_whitelist_record));
+ }
+
+ void MakeGroupObsolete() {
+ // Make a group obsolete, should complete asyncly.
+ PushNextTask(NewRunnableMethod(
+ this, &AppCacheStorageImplTest::Verify_MakeGroupObsolete));
+ Setup_MakeGroupObsolete();
// Conduct the test.
storage()->MakeGroupObsolete(group_, delegate());
EXPECT_FALSE(group_->is_obsolete());
}
+ void SyncMakeGroupObsolete() {
+ Setup_MakeGroupObsolete();
+ // Conduct the test.
+ storage()->SyncMakeGroupObsolete(group_, delegate());
+ Verify_MakeGroupObsolete();
+ }
+
void Verify_MakeGroupObsolete() {
EXPECT_TRUE(delegate()->obsoleted_success_);
EXPECT_EQ(group_.get(), delegate()->obsoleted_group_.get());
@@ -1335,6 +1352,10 @@ TEST_F(AppCacheStorageImplTest, CreateGroupInPopulatedOrigin) {
RunTestOnIOThread(&AppCacheStorageImplTest::CreateGroupInPopulatedOrigin);
}
+TEST_F(AppCacheStorageImplTest, CreateGroupSyncInPopulatedOrigin) {
+ RunTestOnIOThread(&AppCacheStorageImplTest::CreateGroupSyncInPopulatedOrigin);
+}
+
TEST_F(AppCacheStorageImplTest, LoadGroupAndCache_FarHit) {
RunTestOnIOThread(&AppCacheStorageImplTest::LoadGroupAndCache_FarHit);
}
@@ -1359,6 +1380,10 @@ TEST_F(AppCacheStorageImplTest, MakeGroupObsolete) {
RunTestOnIOThread(&AppCacheStorageImplTest::MakeGroupObsolete);
}
+TEST_F(AppCacheStorageImplTest, SyncMakeGroupObsolete) {
+ RunTestOnIOThread(&AppCacheStorageImplTest::SyncMakeGroupObsolete);
+}
+
TEST_F(AppCacheStorageImplTest, MarkEntryAsForeign) {
RunTestOnIOThread(&AppCacheStorageImplTest::MarkEntryAsForeign);
}

Powered by Google App Engine
This is Rietveld 408576698