diff options
author | lipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-28 22:29:43 +0000 |
---|---|---|
committer | lipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-28 22:29:43 +0000 |
commit | 4869742bbaf4bb6fed8a54d7751f442ab94a6a74 (patch) | |
tree | 29675f327d93bcd046ba7600be13cf25e55f15fb | |
parent | 00fe7c5fa74f7b275eb4dece3c336e4b7dcc69af (diff) | |
download | chromium_src-4869742bbaf4bb6fed8a54d7751f442ab94a6a74.zip chromium_src-4869742bbaf4bb6fed8a54d7751f442ab94a6a74.tar.gz chromium_src-4869742bbaf4bb6fed8a54d7751f442ab94a6a74.tar.bz2 |
A command line flag to simulate an unrecoverable error.
The error is thrown right after initialization.
BUG=101304
TEST=sync_unit_tests.exe, sync_integration_tests.exe, unit_tests.exe, manual test
Review URL: http://codereview.chromium.org/9008045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115921 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/sync/internal_api/sync_manager.cc | 13 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 5 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/sync/internal_api/sync_manager.cc b/chrome/browser/sync/internal_api/sync_manager.cc index 723cbf7..709c61d 100644 --- a/chrome/browser/sync/internal_api/sync_manager.cc +++ b/chrome/browser/sync/internal_api/sync_manager.cc @@ -922,6 +922,19 @@ bool SyncManager::SyncInternal::Init( sync_notifier_->AddObserver(this); + // Now check the command line to see if we need to simulate an + // unrecoverable error for testing purpose. Note the error is thrown + // only if the initialization succeeded. Also it makes sense to use this + // flag only when restarting the browser with an account already setup. If + // you use this before setting up the setup would not succeed as an error + // would be encountered. + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kSyncThrowUnrecoverableError)) { + ReadTransaction trans(FROM_HERE, GetUserShare()); + trans.GetWrappedTrans()->OnUnrecoverableError(FROM_HERE, + "Simulating unrecoverable error for testing purpose."); + } + return signed_in; } diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 377b1f6..f1bc80d 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -1081,6 +1081,11 @@ const char kSyncNotificationHost[] = "sync-notification-host"; // Overrides the default server used for profile sync. const char kSyncServiceURL[] = "sync-url"; +// Makes the sync code to throw an unrecoverable error after initialization. +// Useful for testing unrecoverable error scenarios. +const char kSyncThrowUnrecoverableError[] = "sync-throw-unrecoverable-error"; + + // Tries to connect to XMPP using SSLTCP first (for testing). const char kSyncTrySsltcpFirstForXmpp[] = "sync-try-ssltcp-first-for-xmpp"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index eb75552..ee34bc3 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -294,6 +294,7 @@ extern const char kSyncerThreadTimedStop[]; extern const char kSyncNotificationMethod[]; extern const char kSyncNotificationHost[]; extern const char kSyncServiceURL[]; +extern const char kSyncThrowUnrecoverableError[]; extern const char kSyncTrySsltcpFirstForXmpp[]; extern const char kTestNaClSandbox[]; extern const char kTestName[]; |