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

Unified Diff: components/sync/syncable/directory_backing_store_unittest.cc

Issue 2424533002: Modify sync unit test to use standard sql::test:: helper. (Closed)
Patch Set: BUILD.gn merge Created 4 years, 2 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: components/sync/syncable/directory_backing_store_unittest.cc
diff --git a/components/sync/syncable/directory_backing_store_unittest.cc b/components/sync/syncable/directory_backing_store_unittest.cc
index 2d7865362f3f5a1b1986ea7caa51e6d0848e5796..20849c2d3528f8a40b8ded60e05cd67688b92b24 100644
--- a/components/sync/syncable/directory_backing_store_unittest.cc
+++ b/components/sync/syncable/directory_backing_store_unittest.cc
@@ -20,7 +20,6 @@
#include "components/sync/protocol/bookmark_specifics.pb.h"
#include "components/sync/protocol/sync.pb.h"
#include "components/sync/syncable/on_disk_directory_backing_store.h"
-#include "components/sync/test/directory_backing_store_corruption_testing.h"
#include "components/sync/test/test_directory_backing_store.h"
#include "sql/test/test_helpers.h"
#include "testing/gtest/include/gtest/gtest-param-test.h"
@@ -4295,19 +4294,14 @@ TEST_F(DirectoryBackingStoreTest,
ASSERT_FALSE(dbs->DidFailFirstOpenAttempt());
Directory::SaveChangesSnapshot snapshot;
const std::string suffix(400, 'o');
- for (int i = 0; i < corruption_testing::kNumEntriesRequiredForCorruption;
- ++i) {
+ for (size_t i = 0; i < 100; ++i) {
snapshot.dirty_metas.insert(CreateEntry(i, suffix));
}
ASSERT_TRUE(dbs->SaveChanges(snapshot));
- // Corrupt it.
- ASSERT_TRUE(corruption_testing::CorruptDatabase(GetDatabasePath()));
+ // Corrupt the database on disk.
+ ASSERT_TRUE(sql::test::CorruptSizeInHeaderWithLock(GetDatabasePath()));
// Attempt to save all those entries again. See that it fails (because of the
// corruption).
- //
- // If this test fails because SaveChanges returned true, it may mean you need
- // to increase the number of entries written to the DB. See also
- // |kNumEntriesRequiredForCorruption|.
ASSERT_FALSE(dbs->SaveChanges(snapshot));
// At this point the handler has been posted but not executed.
ASSERT_FALSE(was_called);
« no previous file with comments | « components/sync/syncable/directory_backing_store.cc ('k') | components/sync/test/directory_backing_store_corruption_testing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698