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

Unified Diff: chrome/browser/safe_browsing/incident_reporting/state_store_unittest.cc

Issue 1342873002: Small logic change to StateStore::Transaction::ClearAll (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test Created 5 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 | « chrome/browser/safe_browsing/incident_reporting/state_store.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/incident_reporting/state_store_unittest.cc
diff --git a/chrome/browser/safe_browsing/incident_reporting/state_store_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/state_store_unittest.cc
index ff12661356e90278fd6095c74d5fba86561b3906..9862d319197d188ccb488c43145311d275ea46a0 100644
--- a/chrome/browser/safe_browsing/incident_reporting/state_store_unittest.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/state_store_unittest.cc
@@ -185,6 +185,37 @@ TEST_F(StateStoreTest, ClearForType) {
}
}
+TEST_F(StateStoreTest, ClearAll) {
+ StateStore state_store(profile_);
+ // Write some state to the store.
+ {
+ StateStore::Transaction transaction(&state_store);
+ for (const auto& data : kTestData_)
+ transaction.MarkAsReported(data.type, data.key, data.digest);
+ }
+
+ StateStore::Transaction(&state_store).ClearAll();
+
+ for (const auto& data : kTestData_) {
+ ASSERT_FALSE(state_store.HasBeenReported(data.type, data.key, data.digest));
+ }
+
+ // Run tasks to write prefs out to the JsonPrefStore.
+ task_runner_->RunUntilIdle();
+
+ // Delete the profile.
+ DeleteProfile();
+
+ // Recreate the profile.
+ CreateProfile();
+
+ StateStore store_2(profile_);
+ for (const auto& data : kTestData_) {
+ // Verify that the state did not survive through the Platform State Store.
+ ASSERT_FALSE(store_2.HasBeenReported(data.type, data.key, data.digest));
+ }
+}
+
TEST_F(StateStoreTest, Persistence) {
// Write some state to the store.
{
« no previous file with comments | « chrome/browser/safe_browsing/incident_reporting/state_store.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698