| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 EXPECT_GT(num_clients_, 0) << "num_clients_ incorrectly initialized."; | 184 EXPECT_GT(num_clients_, 0) << "num_clients_ incorrectly initialized."; |
| 185 EXPECT_TRUE(profiles_.empty()) << "SetupClients() has already been called."; | 185 EXPECT_TRUE(profiles_.empty()) << "SetupClients() has already been called."; |
| 186 EXPECT_TRUE(clients_.empty()) << "SetupClients() has already been called."; | 186 EXPECT_TRUE(clients_.empty()) << "SetupClients() has already been called."; |
| 187 | 187 |
| 188 // Create the required number of sync profiles and clients. | 188 // Create the required number of sync profiles and clients. |
| 189 for (int i = 0; i < num_clients_; ++i) { | 189 for (int i = 0; i < num_clients_; ++i) { |
| 190 profiles_.push_back(MakeProfile( | 190 profiles_.push_back(MakeProfile( |
| 191 StringPrintf(FILE_PATH_LITERAL("Profile%d"), i))); | 191 StringPrintf(FILE_PATH_LITERAL("Profile%d"), i))); |
| 192 EXPECT_FALSE(GetProfile(i) == NULL) << "GetProfile(" << i << ") failed."; | 192 EXPECT_FALSE(GetProfile(i) == NULL) << "GetProfile(" << i << ") failed."; |
| 193 clients_.push_back(new ProfileSyncServiceTestHarness( | 193 clients_.push_back(new ProfileSyncServiceTestHarness( |
| 194 GetProfile(i), username_, password_)); | 194 GetProfile(i), username_, password_, i)); |
| 195 EXPECT_FALSE(GetClient(i) == NULL) << "GetClient(" << i << ") failed."; | 195 EXPECT_FALSE(GetClient(i) == NULL) << "GetClient(" << i << ") failed."; |
| 196 } | 196 } |
| 197 | 197 |
| 198 // Create the verifier profile. | 198 // Create the verifier profile. |
| 199 verifier_.reset(MakeProfile(FILE_PATH_LITERAL("Verifier"))); | 199 verifier_.reset(MakeProfile(FILE_PATH_LITERAL("Verifier"))); |
| 200 return (verifier_.get() != NULL); | 200 return (verifier_.get() != NULL); |
| 201 } | 201 } |
| 202 | 202 |
| 203 bool LiveSyncTest::SetupSync() { | 203 bool LiveSyncTest::SetupSync() { |
| 204 // Create sync profiles and clients if they haven't already been created. | 204 // Create sync profiles and clients if they haven't already been created. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 std::string data = EscapePath(name) + "=" + EscapePath(value); | 297 std::string data = EscapePath(name) + "=" + EscapePath(value); |
| 298 ConfigureURLFectcherDelegate delegate; | 298 ConfigureURLFectcherDelegate delegate; |
| 299 scoped_ptr<URLFetcher> fetcher( | 299 scoped_ptr<URLFetcher> fetcher( |
| 300 URLFetcher::Create(0, GURL(url), URLFetcher::POST, &delegate)); | 300 URLFetcher::Create(0, GURL(url), URLFetcher::POST, &delegate)); |
| 301 fetcher->set_request_context(Profile::GetDefaultRequestContext()); | 301 fetcher->set_request_context(Profile::GetDefaultRequestContext()); |
| 302 fetcher->set_upload_data("application/x-www-form-urlencoded", data); | 302 fetcher->set_upload_data("application/x-www-form-urlencoded", data); |
| 303 fetcher->Start(); | 303 fetcher->Start(); |
| 304 MessageLoop::current()->Run(); | 304 MessageLoop::current()->Run(); |
| 305 return delegate.success(); | 305 return delegate.success(); |
| 306 } | 306 } |
| OLD | NEW |