OLD | NEW |
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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 password_ = cl->GetSwitchValueASCII(switches::kSyncPasswordForTest); | 53 password_ = cl->GetSwitchValueASCII(switches::kSyncPasswordForTest); |
54 ASSERT_FALSE(username_.empty()) << "Can't run live server test " | 54 ASSERT_FALSE(username_.empty()) << "Can't run live server test " |
55 << "without specifying --" << switches::kSyncUserForTest; | 55 << "without specifying --" << switches::kSyncUserForTest; |
56 ASSERT_FALSE(password_.empty()) << "Can't run live server test " | 56 ASSERT_FALSE(password_.empty()) << "Can't run live server test " |
57 << "without specifying --" << switches::kSyncPasswordForTest; | 57 << "without specifying --" << switches::kSyncPasswordForTest; |
58 } | 58 } |
59 | 59 |
60 // TODO(rsimha): Until we implement a fake Tango server against which tests | 60 // TODO(rsimha): Until we implement a fake Tango server against which tests |
61 // can run, we need to set the --sync-notification-method to "transitional". | 61 // can run, we need to set the --sync-notification-method to "transitional". |
62 if (!cl->HasSwitch(switches::kSyncNotificationMethod)) { | 62 if (!cl->HasSwitch(switches::kSyncNotificationMethod)) { |
63 cl->AppendSwitchWithValue(switches::kSyncNotificationMethod, | 63 cl->AppendSwitchASCII(switches::kSyncNotificationMethod, |
64 "transitional"); | 64 "transitional"); |
65 } | 65 } |
66 | 66 |
67 // Unless a sync server was explicitly provided, run a test one locally. | 67 // Unless a sync server was explicitly provided, run a test one locally. |
68 // TODO(ncarter): It might be better to allow the user to specify a choice | 68 // TODO(ncarter): It might be better to allow the user to specify a choice |
69 // of sync server "providers" -- a script that could locate (or allocate) | 69 // of sync server "providers" -- a script that could locate (or allocate) |
70 // a sync server instance, possibly on some remote host. The provider | 70 // a sync server instance, possibly on some remote host. The provider |
71 // would be invoked before each test. | 71 // would be invoked before each test. |
72 if (!cl->HasSwitch(switches::kSyncServiceURL)) | 72 if (!cl->HasSwitch(switches::kSyncServiceURL)) |
73 SetUpLocalTestServer(); | 73 SetUpLocalTestServer(); |
74 | 74 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 void LiveSyncTest::SetUpLocalTestServer() { | 177 void LiveSyncTest::SetUpLocalTestServer() { |
178 bool success = server_.Start(net::TestServerLauncher::ProtoHTTP, | 178 bool success = server_.Start(net::TestServerLauncher::ProtoHTTP, |
179 server_.kHostName, server_.kOKHTTPSPort, | 179 server_.kHostName, server_.kOKHTTPSPort, |
180 FilePath(), FilePath(), std::wstring()); | 180 FilePath(), FilePath(), std::wstring()); |
181 ASSERT_TRUE(success); | 181 ASSERT_TRUE(success); |
182 | 182 |
183 started_local_test_server_ = true; | 183 started_local_test_server_ = true; |
184 | 184 |
185 CommandLine* cl = CommandLine::ForCurrentProcess(); | 185 CommandLine* cl = CommandLine::ForCurrentProcess(); |
186 cl->AppendSwitchWithValue(switches::kSyncServiceURL, | 186 cl->AppendSwitchASCII(switches::kSyncServiceURL, |
187 StringPrintf("http://%s:%d/chromiumsync", server_.kHostName, | 187 StringPrintf("http://%s:%d/chromiumsync", server_.kHostName, |
188 server_.kOKHTTPSPort)); | 188 server_.kOKHTTPSPort)); |
189 } | 189 } |
190 | 190 |
191 void LiveSyncTest::TearDownLocalTestServer() { | 191 void LiveSyncTest::TearDownLocalTestServer() { |
192 bool success = server_.Stop(); | 192 bool success = server_.Stop(); |
193 ASSERT_TRUE(success); | 193 ASSERT_TRUE(success); |
194 } | 194 } |
OLD | NEW |