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

Side by Side Diff: chrome/test/live_sync/live_sync_test.cc

Issue 2834051: Set sync-notification-method to "transitional" for integration tests. (Closed)
Patch Set: Created 10 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/live_sync/live_sync_test.h" 5 #include "chrome/test/live_sync/live_sync_test.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
11 #include "chrome/browser/profile_manager.h" 11 #include "chrome/browser/profile_manager.h"
12 #include "chrome/common/chrome_paths.h" 12 #include "chrome/common/chrome_paths.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 14
15 namespace switches { 15 namespace switches {
16 const std::string kPasswordFileForTest = "password-file-for-test"; 16 const std::string kPasswordFileForTest = "password-file-for-test";
17 const std::string kSyncUserForTest = "sync-user-for-test"; 17 const std::string kSyncUserForTest = "sync-user-for-test";
18 const std::string kSyncPasswordForTest = "sync-password-for-test"; 18 const std::string kSyncPasswordForTest = "sync-password-for-test";
19 } 19 }
20 20
21 void LiveSyncTest::SetUp() { 21 void LiveSyncTest::SetUp() {
22 // At this point, the browser hasn't been launched, and no services are 22 // At this point, the browser hasn't been launched, and no services are
23 // available. But we can verify our command line parameters and fail 23 // available. But we can verify our command line parameters and fail
24 // early. 24 // early.
25 const CommandLine* cl = CommandLine::ForCurrentProcess(); 25 CommandLine* cl = CommandLine::ForCurrentProcess();
26 if (cl->HasSwitch(switches::kPasswordFileForTest)) { 26 if (cl->HasSwitch(switches::kPasswordFileForTest)) {
27 // Read GAIA credentials from a local password file if specified via the 27 // Read GAIA credentials from a local password file if specified via the
28 // "--password-file-for-test" command line switch. Note: The password file 28 // "--password-file-for-test" command line switch. Note: The password file
29 // must be a plain text file with exactly two lines -- the username on the 29 // must be a plain text file with exactly two lines -- the username on the
30 // first line and the password on the second line. 30 // first line and the password on the second line.
31 password_file_ = cl->GetSwitchValuePath(switches::kPasswordFileForTest); 31 password_file_ = cl->GetSwitchValuePath(switches::kPasswordFileForTest);
32 ASSERT_FALSE(password_file_.empty()) << "Can't run live server test " 32 ASSERT_FALSE(password_file_.empty()) << "Can't run live server test "
33 << "without specifying --" << switches::kPasswordFileForTest 33 << "without specifying --" << switches::kPasswordFileForTest
34 << "=<filename>"; 34 << "=<filename>";
35 std::string file_contents; 35 std::string file_contents;
(...skipping 12 matching lines...) Expand all
48 // Read GAIA credentials from the "--sync-XXX-for-test" command line 48 // Read GAIA credentials from the "--sync-XXX-for-test" command line
49 // parameters. 49 // parameters.
50 username_ = cl->GetSwitchValueASCII(switches::kSyncUserForTest); 50 username_ = cl->GetSwitchValueASCII(switches::kSyncUserForTest);
51 password_ = cl->GetSwitchValueASCII(switches::kSyncPasswordForTest); 51 password_ = cl->GetSwitchValueASCII(switches::kSyncPasswordForTest);
52 ASSERT_FALSE(username_.empty()) << "Can't run live server test " 52 ASSERT_FALSE(username_.empty()) << "Can't run live server test "
53 << "without specifying --" << switches::kSyncUserForTest; 53 << "without specifying --" << switches::kSyncUserForTest;
54 ASSERT_FALSE(password_.empty()) << "Can't run live server test " 54 ASSERT_FALSE(password_.empty()) << "Can't run live server test "
55 << "without specifying --" << switches::kSyncPasswordForTest; 55 << "without specifying --" << switches::kSyncPasswordForTest;
56 } 56 }
57 57
58 // TODO(rsimha): Until we implement a fake Tango server against which tests
59 // can run, we need to set the --sync-notification-method to "transitional".
60 if (!cl->HasSwitch(switches::kSyncNotificationMethod)) {
61 cl->AppendSwitchWithValue(switches::kSyncNotificationMethod,
62 "transitional");
63 }
64
58 // Unless a sync server was explicitly provided, run a test one locally. 65 // Unless a sync server was explicitly provided, run a test one locally.
59 // TODO(ncarter): It might be better to allow the user to specify a choice 66 // TODO(ncarter): It might be better to allow the user to specify a choice
60 // of sync server "providers" -- a script that could locate (or allocate) 67 // of sync server "providers" -- a script that could locate (or allocate)
61 // a sync server instance, possibly on some remote host. The provider 68 // a sync server instance, possibly on some remote host. The provider
62 // would be invoked before each test. 69 // would be invoked before each test.
63 if (!cl->HasSwitch(switches::kSyncServiceURL)) 70 if (!cl->HasSwitch(switches::kSyncServiceURL))
64 SetUpLocalTestServer(); 71 SetUpLocalTestServer();
65 72
66 // Yield control back to the InProcessBrowserTest framework. 73 // Yield control back to the InProcessBrowserTest framework.
67 InProcessBrowserTest::SetUp(); 74 InProcessBrowserTest::SetUp();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 CommandLine* cl = CommandLine::ForCurrentProcess(); 183 CommandLine* cl = CommandLine::ForCurrentProcess();
177 cl->AppendSwitchWithValue(switches::kSyncServiceURL, 184 cl->AppendSwitchWithValue(switches::kSyncServiceURL,
178 StringPrintf("http://%s:%d/chromiumsync", server_.kHostName, 185 StringPrintf("http://%s:%d/chromiumsync", server_.kHostName,
179 server_.kOKHTTPSPort)); 186 server_.kOKHTTPSPort));
180 } 187 }
181 188
182 void LiveSyncTest::TearDownLocalTestServer() { 189 void LiveSyncTest::TearDownLocalTestServer() {
183 bool success = server_.Stop(); 190 bool success = server_.Stop();
184 ASSERT_TRUE(success); 191 ASSERT_TRUE(success);
185 } 192 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698