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

Unified Diff: chrome/test/live_sync/live_sync_test.cc

Issue 6282001: Disable background network access in sync integration tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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: chrome/test/live_sync/live_sync_test.cc
diff --git a/chrome/test/live_sync/live_sync_test.cc b/chrome/test/live_sync/live_sync_test.cc
index d768b585d38962b4e892581b6e75172fd7107e6b..77a7c49b85f7ebc5f842681ee4d8a51f47ed2225 100644
--- a/chrome/test/live_sync/live_sync_test.cc
+++ b/chrome/test/live_sync/live_sync_test.cc
@@ -131,16 +131,11 @@ LiveSyncTest::LiveSyncTest(TestType test_type)
}
void LiveSyncTest::SetUp() {
- // At this point, the browser hasn't been launched, and no services are
- // available. But we can verify our command line parameters and fail
- // early.
CommandLine* cl = CommandLine::ForCurrentProcess();
if (cl->HasSwitch(switches::kPasswordFileForTest)) {
ReadPasswordFile();
} else if (cl->HasSwitch(switches::kSyncUserForTest) &&
cl->HasSwitch(switches::kSyncPasswordForTest)) {
- // Read GAIA credentials from the "--sync-XXX-for-test" command line
- // parameters.
username_ = cl->GetSwitchValueASCII(switches::kSyncUserForTest);
password_ = cl->GetSwitchValueASCII(switches::kSyncPasswordForTest);
} else {
@@ -149,21 +144,6 @@ void LiveSyncTest::SetUp() {
if (username_.empty() || password_.empty())
LOG(FATAL) << "Cannot run sync tests without GAIA credentials.";
- // TODO(rsimha): Until we implement a fake Tango server against which tests
- // can run, we need to set the --sync-notification-method to "p2p".
- if (!cl->HasSwitch(switches::kSyncNotificationMethod))
- cl->AppendSwitchASCII(switches::kSyncNotificationMethod, "p2p");
-
- // TODO(sync): Remove this once sessions sync is enabled by default.
- if (!cl->HasSwitch(switches::kEnableSyncSessions)) {
- cl->AppendSwitch(switches::kEnableSyncSessions);
- }
-
- // TODO(sync): Remove this once passwords sync is enabled by default.
- if (!cl->HasSwitch(switches::kEnableSyncPasswords)) {
- cl->AppendSwitch(switches::kEnableSyncPasswords);
- }
-
// Mock the Mac Keychain service. The real Keychain can block on user input.
#if defined(OS_MACOSX)
Encryptor::UseMockKeychain(true);
@@ -188,6 +168,25 @@ void LiveSyncTest::TearDown() {
URLFetcher::set_factory(NULL);
}
+void LiveSyncTest::SetUpCommandLine(CommandLine* cl) {
+ // TODO(rsimha): Until we implement a fake Tango server against which tests
+ // can run, we need to set the --sync-notification-method to "p2p".
+ if (!cl->HasSwitch(switches::kSyncNotificationMethod))
+ cl->AppendSwitchASCII(switches::kSyncNotificationMethod, "p2p");
+
+ // TODO(sync): Remove this once sessions sync is enabled by default.
+ if (!cl->HasSwitch(switches::kEnableSyncSessions))
+ cl->AppendSwitch(switches::kEnableSyncSessions);
+
+ // TODO(sync): Remove this once passwords sync is enabled by default.
+ if (!cl->HasSwitch(switches::kEnableSyncPasswords))
+ cl->AppendSwitch(switches::kEnableSyncPasswords);
+
+ // Disable non-essential access of external network resources.
+ if (!cl->HasSwitch(switches::kDisableBackgroundNetworking))
+ cl->AppendSwitch(switches::kDisableBackgroundNetworking);
+}
+
// static
Profile* LiveSyncTest::MakeProfile(const FilePath::StringType name) {
FilePath path;

Powered by Google App Engine
This is Rietveld 408576698