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

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

Issue 7669073: [Sync] Add support for enabling session sync remotely. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 4 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 b258d1c913547576fc1be07f108cb6d474ca4678..c91d243c7af56360540b77f41946766191e7dafa 100644
--- a/chrome/test/live_sync/live_sync_test.cc
+++ b/chrome/test/live_sync/live_sync_test.cc
@@ -150,14 +150,14 @@ void LiveSyncTest::SetUp() {
SetupMockGaiaResponses();
}
- if (!cl->HasSwitch(switches::kSyncServiceURL) &&
- !cl->HasSwitch(switches::kSyncServerCommandLine)) {
- // If neither a sync server URL nor a sync server command line is
- // provided, start up a local python sync test server and point Chrome
- // to its URL. This is the most common configuration, and the only
- // one that makes sense for most developers.
- server_type_ = LOCAL_PYTHON_SERVER;
- } else if (cl->HasSwitch(switches::kSyncServiceURL) &&
+ if (!cl->HasSwitch(switches::kSyncServiceURL) &&
+ !cl->HasSwitch(switches::kSyncServerCommandLine)) {
+ // If neither a sync server URL nor a sync server command line is
+ // provided, start up a local python sync test server and point Chrome
+ // to its URL. This is the most common configuration, and the only
+ // one that makes sense for most developers.
+ server_type_ = LOCAL_PYTHON_SERVER;
+ } else if (cl->HasSwitch(switches::kSyncServiceURL) &&
cl->HasSwitch(switches::kSyncServerCommandLine)) {
// If a sync server URL and a sync server command line are provided,
// start up a local sync server by running the command line. Chrome
@@ -200,11 +200,22 @@ void LiveSyncTest::TearDown() {
}
void LiveSyncTest::SetUpCommandLine(CommandLine* cl) {
+ AddTestSwitches(cl);
+ AddOptionalTypesToCommandLine(cl);
+}
+
+void LiveSyncTest::AddTestSwitches(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");
+ // Disable non-essential access of external network resources.
+ if (!cl->HasSwitch(switches::kDisableBackgroundNetworking))
+ cl->AppendSwitch(switches::kDisableBackgroundNetworking);
+}
+
+void LiveSyncTest::AddOptionalTypesToCommandLine(CommandLine* cl) {
// TODO(sync): Remove this once sessions sync is enabled by default.
if (!cl->HasSwitch(switches::kEnableSyncSessions))
cl->AppendSwitch(switches::kEnableSyncSessions);
@@ -212,10 +223,6 @@ void LiveSyncTest::SetUpCommandLine(CommandLine* cl) {
// TODO(sync): Remove this once typed url sync is enabled by default.
if (!cl->HasSwitch(switches::kEnableSyncTypedUrls))
cl->AppendSwitch(switches::kEnableSyncTypedUrls);
-
- // Disable non-essential access of external network resources.
- if (!cl->HasSwitch(switches::kDisableBackgroundNetworking))
- cl->AppendSwitch(switches::kDisableBackgroundNetworking);
}
// static
@@ -339,7 +346,7 @@ void LiveSyncTest::ReadPasswordFile() {
std::vector<std::string> tokens;
std::string delimiters = "\r\n";
Tokenize(file_contents, delimiters, &tokens);
- ASSERT_TRUE(tokens.size() == 2) << "Password file \""
+ ASSERT_EQ(2U, tokens.size()) << "Password file \""
<< password_file_.value()
<< "\" must contain exactly two lines of text.";
username_ = tokens[0];
@@ -545,6 +552,14 @@ void LiveSyncTest::TriggerTransientError() {
UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle()));
}
+void LiveSyncTest::TriggerSetSyncTabs() {
+ ASSERT_TRUE(ServerSupportsErrorTriggering());
+ std::string path = "chromiumsync/synctabs";
+ ui_test_utils::NavigateToURL(browser(), sync_server_.GetURL(path));
+ ASSERT_EQ("Sync Tabs",
+ UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle()));
+}
+
void LiveSyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter,
const net::ProxyConfig& proxy_config) {
base::WaitableEvent done(false, false);

Powered by Google App Engine
This is Rietveld 408576698