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/extensions/api/push_messaging/sync_setup_helper.h" | 5 #include "chrome/browser/extensions/api/push_messaging/sync_setup_helper.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 | 23 |
24 namespace extensions { | 24 namespace extensions { |
25 | 25 |
26 SyncSetupHelper::SyncSetupHelper() {} | 26 SyncSetupHelper::SyncSetupHelper() {} |
27 | 27 |
28 SyncSetupHelper::~SyncSetupHelper() {} | 28 SyncSetupHelper::~SyncSetupHelper() {} |
29 | 29 |
30 bool SyncSetupHelper::InitializeSync(Profile* profile) { | 30 bool SyncSetupHelper::InitializeSync(Profile* profile) { |
31 profile_ = profile; | 31 profile_ = profile; |
32 client_.reset(new ProfileSyncServiceHarness(profile_, username_, password_)); | 32 client_.reset( |
| 33 ProfileSyncServiceHarness::Create(profile_, username_, password_)); |
33 | 34 |
34 if (client_->service()->IsSyncEnabledAndLoggedIn()) | 35 if (client_->service()->IsSyncEnabledAndLoggedIn()) |
35 return true; | 36 return true; |
36 | 37 |
37 if (!client_->SetupSync()) | 38 if (!client_->SetupSync()) |
38 return false; | 39 return false; |
39 | 40 |
40 // Because clients may modify sync data as part of startup (for example local | 41 // Because clients may modify sync data as part of startup (for example local |
41 // session-releated data is rewritten), we need to ensure all startup-based | 42 // session-releated data is rewritten), we need to ensure all startup-based |
42 // changes have propagated between the clients. | 43 // changes have propagated between the clients. |
(...skipping 29 matching lines...) Expand all Loading... |
72 return true; | 73 return true; |
73 } | 74 } |
74 | 75 |
75 bool SyncSetupHelper::AwaitQuiescence() { | 76 bool SyncSetupHelper::AwaitQuiescence() { |
76 std::vector<ProfileSyncServiceHarness*> clients; | 77 std::vector<ProfileSyncServiceHarness*> clients; |
77 clients.push_back(client_.get()); | 78 clients.push_back(client_.get()); |
78 return ProfileSyncServiceHarness::AwaitQuiescence(clients); | 79 return ProfileSyncServiceHarness::AwaitQuiescence(clients); |
79 } | 80 } |
80 | 81 |
81 } // namespace extensions | 82 } // namespace extensions |
OLD | NEW |