OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/sync/profile_sync_service_harness.h" | 5 #include "chrome/browser/sync/profile_sync_service_harness.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <ostream> | 9 #include <ostream> |
10 #include <set> | 10 #include <set> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 // Subscribe sync client to notifications from the profile sync service. | 169 // Subscribe sync client to notifications from the profile sync service. |
170 if (!service_->HasObserver(this)) | 170 if (!service_->HasObserver(this)) |
171 service_->AddObserver(this); | 171 service_->AddObserver(this); |
172 | 172 |
173 // Tell the sync service that setup is in progress so we don't start syncing | 173 // Tell the sync service that setup is in progress so we don't start syncing |
174 // until we've finished configuration. | 174 // until we've finished configuration. |
175 service_->SetSetupInProgress(true); | 175 service_->SetSetupInProgress(true); |
176 | 176 |
177 // Authenticate sync client using GAIA credentials. | 177 // Authenticate sync client using GAIA credentials. |
178 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 178 if (CommandLine::ForCurrentProcess()->HasSwitch( |
179 switches::kDisableClientOAuthSignin)) { | 179 switches::kEnableClientOAuthSignin)) { |
180 service_->signin()->StartSignInWithOAuth(username_, password_); | 180 service_->signin()->StartSignInWithOAuth(username_, password_); |
181 } else { | 181 } else { |
182 service_->signin()->StartSignIn(username_, password_, "", ""); | 182 service_->signin()->StartSignIn(username_, password_, "", ""); |
183 } | 183 } |
184 | 184 |
185 // Wait for the OnBackendInitialized() callback. | 185 // Wait for the OnBackendInitialized() callback. |
186 if (!AwaitBackendInitialized()) { | 186 if (!AwaitBackendInitialized()) { |
187 LOG(ERROR) << "OnBackendInitialized() not seen after " | 187 LOG(ERROR) << "OnBackendInitialized() not seen after " |
188 << kLiveSyncOperationTimeoutMs / 1000 | 188 << kLiveSyncOperationTimeoutMs / 1000 |
189 << " seconds."; | 189 << " seconds."; |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 | 1106 |
1107 std::string ProfileSyncServiceHarness::GetServiceStatus() { | 1107 std::string ProfileSyncServiceHarness::GetServiceStatus() { |
1108 DictionaryValue value; | 1108 DictionaryValue value; |
1109 sync_ui_util::ConstructAboutInformation(service_, &value); | 1109 sync_ui_util::ConstructAboutInformation(service_, &value); |
1110 std::string service_status; | 1110 std::string service_status; |
1111 base::JSONWriter::WriteWithOptions(&value, | 1111 base::JSONWriter::WriteWithOptions(&value, |
1112 base::JSONWriter::OPTIONS_PRETTY_PRINT, | 1112 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
1113 &service_status); | 1113 &service_status); |
1114 return service_status; | 1114 return service_status; |
1115 } | 1115 } |
OLD | NEW |