OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 return new FakeProfileSyncService(static_cast<Profile*>(context)); | 59 return new FakeProfileSyncService(static_cast<Profile*>(context)); |
60 } | 60 } |
61 | 61 |
62 void set_sync_initialized(bool sync_initialized) { | 62 void set_sync_initialized(bool sync_initialized) { |
63 sync_initialized_ = sync_initialized; | 63 sync_initialized_ = sync_initialized; |
64 } | 64 } |
65 | 65 |
66 bool initialized_state_violation() { return initialized_state_violation_; } | 66 bool initialized_state_violation() { return initialized_state_violation_; } |
67 | 67 |
68 // ProfileSyncService: | 68 // ProfileSyncService: |
69 bool SyncActive() const override { return sync_initialized_; } | 69 bool IsSyncActive() const override { return sync_initialized_; } |
70 | 70 |
71 void AddObserver(sync_driver::SyncServiceObserver* observer) override { | 71 void AddObserver(sync_driver::SyncServiceObserver* observer) override { |
72 if (sync_initialized_) | 72 if (sync_initialized_) |
73 initialized_state_violation_ = true; | 73 initialized_state_violation_ = true; |
74 // Set sync initialized state to true so the function will run after | 74 // Set sync initialized state to true so the function will run after |
75 // OnStateChanged is called. | 75 // OnStateChanged is called. |
76 sync_initialized_ = true; | 76 sync_initialized_ = true; |
77 base::MessageLoop::current()->PostTask( | 77 base::MessageLoop::current()->PostTask( |
78 FROM_HERE, base::Bind(&sync_driver::SyncServiceObserver::OnStateChanged, | 78 FROM_HERE, base::Bind(&sync_driver::SyncServiceObserver::OnStateChanged, |
79 base::Unretained(observer))); | 79 base::Unretained(observer))); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 // Verifies that we wait for the sync service to be ready before checking | 188 // Verifies that we wait for the sync service to be ready before checking |
189 // encryption status. | 189 // encryption status. |
190 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, | 190 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, |
191 GetSyncCategoriesWithoutPassphraseAsynchronous) { | 191 GetSyncCategoriesWithoutPassphraseAsynchronous) { |
192 service_->set_sync_initialized(false); | 192 service_->set_sync_initialized(false); |
193 TestGetSyncCategoriesWithoutPassphraseFunction(); | 193 TestGetSyncCategoriesWithoutPassphraseFunction(); |
194 } | 194 } |
195 | 195 |
196 } // namespace | 196 } // namespace |
OLD | NEW |