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

Unified Diff: components/offline_pages/offline_page_metadata_store_impl_unittest.cc

Issue 2331343007: [Offline pages] OPMStoreSQL implementation of Add disabling updates (Closed)
Patch Set: Addressing feedback Created 4 years, 3 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
« no previous file with comments | « no previous file | components/offline_pages/offline_page_metadata_store_sql.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_metadata_store_impl_unittest.cc
diff --git a/components/offline_pages/offline_page_metadata_store_impl_unittest.cc b/components/offline_pages/offline_page_metadata_store_impl_unittest.cc
index 2e536739422ed44cd29113921352980bf0c4098e..88cd6ffb3dc5eaee4c0426ef7f2c1ce1d703413b 100644
--- a/components/offline_pages/offline_page_metadata_store_impl_unittest.cc
+++ b/components/offline_pages/offline_page_metadata_store_impl_unittest.cc
@@ -447,6 +447,31 @@ TEST_F(OfflinePageMetadataStoreTest, AddOfflinePage) {
CheckThatOfflinePageCanBeSaved(BuildStore());
}
+TEST_F(OfflinePageMetadataStoreTest, AddSameOfflinePageTwice) {
+ std::unique_ptr<OfflinePageMetadataStore> store(BuildStore());
+
+ OfflinePageItem offline_page(GURL(kTestURL), 1234LL, kTestClientId1,
+ base::FilePath(kFilePath), kFileSize);
+ offline_page.title = base::UTF8ToUTF16("a title");
+ base::Time expiration_time = base::Time::Now();
+ offline_page.expiration_time = expiration_time;
+
+ store->AddOfflinePage(offline_page,
+ base::Bind(&OfflinePageMetadataStoreTest::AddCallback,
+ base::Unretained(this)));
+ PumpLoop();
+ EXPECT_EQ(ADD, last_called_callback_);
+ EXPECT_EQ(STATUS_TRUE, last_status_);
+ ClearResults();
+
+ store->AddOfflinePage(offline_page,
+ base::Bind(&OfflinePageMetadataStoreTest::AddCallback,
+ base::Unretained(this)));
+ PumpLoop();
+ EXPECT_EQ(ADD, last_called_callback_);
+ EXPECT_EQ(STATUS_FALSE, last_status_);
+}
+
// Tests removing offline page metadata from the store, for which it first adds
// metadata of an offline page.
TEST_F(OfflinePageMetadataStoreTest, RemoveOfflinePage) {
« no previous file with comments | « no previous file | components/offline_pages/offline_page_metadata_store_sql.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698