| 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 "components/sync_driver/startup_controller.h" | 5 #include "components/sync_driver/startup_controller.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 bool started() const { return started_; } | 75 bool started() const { return started_; } |
| 76 void clear_started() { started_ = false; } | 76 void clear_started() { started_ = false; } |
| 77 StartupController* controller() { return controller_.get(); } | 77 StartupController* controller() { return controller_.get(); } |
| 78 sync_driver::SyncPrefs* sync_prefs() { return sync_prefs_.get(); } | 78 sync_driver::SyncPrefs* sync_prefs() { return sync_prefs_.get(); } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 bool can_start_; | 81 bool can_start_; |
| 82 bool started_; | 82 bool started_; |
| 83 base::MessageLoop message_loop_; | 83 base::MessageLoop message_loop_; |
| 84 syncable_prefs::TestingPrefServiceSyncable pref_service_; | 84 syncable_prefs::TestingPrefServiceSyncable pref_service_; |
| 85 scoped_ptr<sync_driver::SyncPrefs> sync_prefs_; | 85 std::unique_ptr<sync_driver::SyncPrefs> sync_prefs_; |
| 86 scoped_ptr<StartupController> controller_; | 86 std::unique_ptr<StartupController> controller_; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 // Test that sync doesn't start until all conditions are met. | 89 // Test that sync doesn't start until all conditions are met. |
| 90 TEST_F(StartupControllerTest, Basic) { | 90 TEST_F(StartupControllerTest, Basic) { |
| 91 controller()->TryStart(); | 91 controller()->TryStart(); |
| 92 ExpectNotStarted(); | 92 ExpectNotStarted(); |
| 93 | 93 |
| 94 SetCanStart(true); | 94 SetCanStart(true); |
| 95 controller()->TryStart(); | 95 controller()->TryStart(); |
| 96 ExpectStarted(); | 96 ExpectStarted(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 controller()->SetSetupInProgress(true); | 210 controller()->SetSetupInProgress(true); |
| 211 | 211 |
| 212 // This could happen if the UI triggers a stop-syncing permanently call. | 212 // This could happen if the UI triggers a stop-syncing permanently call. |
| 213 controller()->Reset(syncer::UserTypes()); | 213 controller()->Reset(syncer::UserTypes()); |
| 214 | 214 |
| 215 // From the UI's point of view, setup is still in progress. | 215 // From the UI's point of view, setup is still in progress. |
| 216 EXPECT_TRUE(controller()->IsSetupInProgress()); | 216 EXPECT_TRUE(controller()->IsSetupInProgress()); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace browser_sync | 219 } // namespace browser_sync |
| OLD | NEW |