summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 21:43:17 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 21:43:17 +0000
commit0e73b66a0717688c9e96642a4dee7538765cc1ff (patch)
tree518a3897ce4f6a7e0450d9b5d16e4c7cc3bc9339 /sync
parentaade744427a446988410ace82faaa7bfe263fd15 (diff)
downloadchromium_src-0e73b66a0717688c9e96642a4dee7538765cc1ff.zip
chromium_src-0e73b66a0717688c9e96642a4dee7538765cc1ff.tar.gz
chromium_src-0e73b66a0717688c9e96642a4dee7538765cc1ff.tar.bz2
Make SyncManagerTests use in-memory sqlite
Add a flag to the SyncManager to allow it to initialize an in-memory directory. This is to be used only in tests. This is an ugly change, but there's not much alternative available right now. We really ought to figure out a better way to test the SyncManager that doesn't require cluttering the main class with flag variables. That task is left to another day. Using an in-memory database results in significant speedups. The time taken to run sync_unit_tests on my desktop went from 13s to 6s. It seems to cut 10-20s off the runtime of unit_test --gtest_filter='*Sync*', too. BUG=116328, 117836 TEST= Review URL: http://codereview.chromium.org/9662019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127255 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/syncable/dir_open_result.h3
-rw-r--r--sync/syncable/directory_backing_store.cc2
2 files changed, 3 insertions, 2 deletions
diff --git a/sync/syncable/dir_open_result.h b/sync/syncable/dir_open_result.h
index 6138a26..f298ff0 100644
--- a/sync/syncable/dir_open_result.h
+++ b/sync/syncable/dir_open_result.h
@@ -7,7 +7,8 @@
#pragma once
namespace syncable {
-enum DirOpenResult { OPENED, // success.
+enum DirOpenResult { NOT_INITIALIZED,
+ OPENED, // success.
FAILED_NEWER_VERSION, // DB version is too new.
FAILED_MAKE_REPOSITORY, // Couldn't create subdir.
FAILED_OPEN_DATABASE, // sqlite_open() failed.
diff --git a/sync/syncable/directory_backing_store.cc b/sync/syncable/directory_backing_store.cc
index c7395c3..1685610 100644
--- a/sync/syncable/directory_backing_store.cc
+++ b/sync/syncable/directory_backing_store.cc
@@ -326,7 +326,7 @@ bool DirectoryBackingStore::InitializeTables() {
// crbug.com/105018.
if (version_on_disk != kCurrentDBVersion) {
if (version_on_disk > kCurrentDBVersion)
- return FAILED_NEWER_VERSION;
+ return false;
// Fallback (re-sync everything) migration path.
DVLOG(1) << "Old/null sync database, version " << version_on_disk;