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

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

Issue 3160002: Error reporting for sync setup failure. (Closed)
Patch Set: Created 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/live_sync/profile_sync_service_test_harness.cc » ('j') | 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 bool LiveSyncTest::SetupClients() { 124 bool LiveSyncTest::SetupClients() {
125 EXPECT_GT(num_clients_, 0) << "num_clients_ incorrectly initialized."; 125 EXPECT_GT(num_clients_, 0) << "num_clients_ incorrectly initialized.";
126 EXPECT_TRUE(profiles_.empty()) << "SetupClients() has already been called."; 126 EXPECT_TRUE(profiles_.empty()) << "SetupClients() has already been called.";
127 EXPECT_TRUE(clients_.empty()) << "SetupClients() has already been called."; 127 EXPECT_TRUE(clients_.empty()) << "SetupClients() has already been called.";
128 128
129 // Create the required number of sync profiles and clients. 129 // Create the required number of sync profiles and clients.
130 for (int i = 0; i < num_clients_; ++i) { 130 for (int i = 0; i < num_clients_; ++i) {
131 profiles_.push_back(MakeProfile( 131 profiles_.push_back(MakeProfile(
132 StringPrintf(FILE_PATH_LITERAL("Profile%d"), i))); 132 StringPrintf(FILE_PATH_LITERAL("Profile%d"), i)));
133 if (GetProfile(i) == NULL) 133 EXPECT_FALSE(GetProfile(i) == NULL) << "GetProfile(" << i << ") failed.";
134 return false;
135 clients_.push_back(new ProfileSyncServiceTestHarness( 134 clients_.push_back(new ProfileSyncServiceTestHarness(
136 GetProfile(i), username_, password_)); 135 GetProfile(i), username_, password_));
137 if (GetClient(i) == NULL) 136 EXPECT_FALSE(GetClient(i) == NULL) << "GetClient(" << i << ") failed.";
138 return false;
139 } 137 }
140 138
141 // Create the verifier profile. 139 // Create the verifier profile.
142 verifier_.reset(MakeProfile(FILE_PATH_LITERAL("Verifier"))); 140 verifier_.reset(MakeProfile(FILE_PATH_LITERAL("Verifier")));
143 return (verifier_.get() != NULL); 141 return (verifier_.get() != NULL);
144 } 142 }
145 143
146 bool LiveSyncTest::SetupSync() { 144 bool LiveSyncTest::SetupSync() {
147 // Create sync profiles and clients if they haven't already been created. 145 // Create sync profiles and clients if they haven't already been created.
148 if (profiles_.empty()) { 146 if (profiles_.empty()) {
149 if (!SetupClients()) 147 EXPECT_TRUE(SetupClients()) << "SetupClients() failed.";
150 return false;
151 } 148 }
152 149
153 // Sync each of the profiles. 150 // Sync each of the profiles.
154 for (int i = 0; i < num_clients_; ++i) { 151 for (int i = 0; i < num_clients_; ++i) {
155 if (!GetClient(i)->SetupSync()) 152 EXPECT_TRUE(GetClient(i)->SetupSync()) << "SetupSync() failed.";
156 return false;
157 } 153 }
154
158 return true; 155 return true;
159 } 156 }
160 157
161 void LiveSyncTest::CleanUpOnMainThread() { 158 void LiveSyncTest::CleanUpOnMainThread() {
162 profiles_.reset(); 159 profiles_.reset();
163 clients_.reset(); 160 clients_.reset();
164 verifier_.reset(NULL); 161 verifier_.reset(NULL);
165 } 162 }
166 163
167 void LiveSyncTest::SetUpInProcessBrowserTestFixture() { 164 void LiveSyncTest::SetUpInProcessBrowserTestFixture() {
(...skipping 26 matching lines...) Expand all
194 CommandLine* cl = CommandLine::ForCurrentProcess(); 191 CommandLine* cl = CommandLine::ForCurrentProcess();
195 cl->AppendSwitchASCII(switches::kSyncServiceURL, 192 cl->AppendSwitchASCII(switches::kSyncServiceURL,
196 StringPrintf("http://%s:%d/chromiumsync", server_.kHostName, 193 StringPrintf("http://%s:%d/chromiumsync", server_.kHostName,
197 server_.kOKHTTPSPort)); 194 server_.kOKHTTPSPort));
198 } 195 }
199 196
200 void LiveSyncTest::TearDownLocalTestServer() { 197 void LiveSyncTest::TearDownLocalTestServer() {
201 bool success = server_.Stop(); 198 bool success = server_.Stop();
202 ASSERT_TRUE(success); 199 ASSERT_TRUE(success);
203 } 200 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/live_sync/profile_sync_service_test_harness.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698