OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
10 #include "chrome/browser/managed_mode/managed_user_sync_service.h" | 10 #include "chrome/browser/managed_mode/managed_user_sync_service.h" |
11 #include "chrome/browser/managed_mode/managed_user_sync_service_factory.h" | 11 #include "chrome/browser/managed_mode/managed_user_sync_service_factory.h" |
12 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 12 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/test/test_browser_thread_bundle.h" |
16 #include "sync/api/sync_change.h" | 17 #include "sync/api/sync_change.h" |
17 #include "sync/api/sync_error_factory_mock.h" | 18 #include "sync/api/sync_error_factory_mock.h" |
18 #include "sync/protocol/sync.pb.h" | 19 #include "sync/protocol/sync.pb.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
20 | 21 |
21 using sync_pb::ManagedUserSpecifics; | 22 using sync_pb::ManagedUserSpecifics; |
22 using syncer::MANAGED_USERS; | 23 using syncer::MANAGED_USERS; |
23 using syncer::SyncChange; | 24 using syncer::SyncChange; |
24 using syncer::SyncChangeList; | 25 using syncer::SyncChangeList; |
25 using syncer::SyncChangeProcessor; | 26 using syncer::SyncChangeProcessor; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 SyncMergeResult StartInitialSync(); | 80 SyncMergeResult StartInitialSync(); |
80 | 81 |
81 void Acknowledge(); | 82 void Acknowledge(); |
82 void ResetService(); | 83 void ResetService(); |
83 | 84 |
84 PrefService* prefs() { return profile_.GetPrefs(); } | 85 PrefService* prefs() { return profile_.GetPrefs(); } |
85 ManagedUserSyncService* service() { return service_; } | 86 ManagedUserSyncService* service() { return service_; } |
86 MockChangeProcessor* change_processor() { return change_processor_; } | 87 MockChangeProcessor* change_processor() { return change_processor_; } |
87 | 88 |
88 private: | 89 private: |
| 90 content::TestBrowserThreadBundle thread_bundle_; |
89 TestingProfile profile_; | 91 TestingProfile profile_; |
90 ManagedUserSyncService* service_; | 92 ManagedUserSyncService* service_; |
91 | 93 |
92 // Owned by the ManagedUserSyncService. | 94 // Owned by the ManagedUserSyncService. |
93 MockChangeProcessor* change_processor_; | 95 MockChangeProcessor* change_processor_; |
94 | 96 |
95 // A unique ID for creating "remote" Sync data. | 97 // A unique ID for creating "remote" Sync data. |
96 int64 sync_data_id_; | 98 int64 sync_data_id_; |
97 }; | 99 }; |
98 | 100 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 { | 239 { |
238 SyncChange change = change_processor()->GetChange(kUserId1); | 240 SyncChange change = change_processor()->GetChange(kUserId1); |
239 ASSERT_TRUE(change.IsValid()); | 241 ASSERT_TRUE(change.IsValid()); |
240 EXPECT_EQ(SyncChange::ACTION_ADD, change.change_type()); | 242 EXPECT_EQ(SyncChange::ACTION_ADD, change.change_type()); |
241 const ManagedUserSpecifics& managed_user = | 243 const ManagedUserSpecifics& managed_user = |
242 change.sync_data().GetSpecifics().managed_user(); | 244 change.sync_data().GetSpecifics().managed_user(); |
243 EXPECT_EQ(kName1, managed_user.name()); | 245 EXPECT_EQ(kName1, managed_user.name()); |
244 EXPECT_FALSE(managed_user.acknowledged()); | 246 EXPECT_FALSE(managed_user.acknowledged()); |
245 } | 247 } |
246 } | 248 } |
OLD | NEW |