| 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 #ifndef COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_TEST_HELPER_H_ | 5 #ifndef COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_TEST_HELPER_H_ |
| 6 #define COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_TEST_HELPER_H_ | 6 #define COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_TEST_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 #include <vector> |
| 10 |
| 8 #include "base/callback.h" | 11 #include "base/callback.h" |
| 9 #include "base/macros.h" | 12 #include "base/macros.h" |
| 10 #include "base/memory/scoped_vector.h" | |
| 11 #include "base/task/cancelable_task_tracker.h" | 13 #include "base/task/cancelable_task_tracker.h" |
| 12 | 14 |
| 13 namespace sessions { | 15 namespace sessions { |
| 14 class SessionCommand; | 16 class SessionCommand; |
| 15 class BaseSessionService; | 17 class BaseSessionService; |
| 16 | 18 |
| 17 class BaseSessionServiceTestHelper { | 19 class BaseSessionServiceTestHelper { |
| 18 public: | 20 public: |
| 19 explicit BaseSessionServiceTestHelper( | 21 explicit BaseSessionServiceTestHelper( |
| 20 BaseSessionService* base_session_service_); | 22 BaseSessionService* base_session_service_); |
| 21 ~BaseSessionServiceTestHelper(); | 23 ~BaseSessionServiceTestHelper(); |
| 22 | 24 |
| 23 // This posts the task to the SequencedWorkerPool, or run immediately | 25 // This posts the task to the SequencedWorkerPool, or run immediately |
| 24 // if the SequencedWorkerPool has been shutdown. | 26 // if the SequencedWorkerPool has been shutdown. |
| 25 void RunTaskOnBackendThread(const tracked_objects::Location& from_here, | 27 void RunTaskOnBackendThread(const tracked_objects::Location& from_here, |
| 26 const base::Closure& task); | 28 const base::Closure& task); |
| 27 | 29 |
| 28 // Returns true if any commands got processed yet - saved or queued. | 30 // Returns true if any commands got processed yet - saved or queued. |
| 29 bool ProcessedAnyCommands(); | 31 bool ProcessedAnyCommands(); |
| 30 | 32 |
| 31 // Read the last session commands directly from file. | 33 // Read the last session commands directly from file. |
| 32 bool ReadLastSessionCommands(ScopedVector<SessionCommand>* commands); | 34 bool ReadLastSessionCommands( |
| 35 std::vector<std::unique_ptr<SessionCommand>>* commands); |
| 33 | 36 |
| 34 private: | 37 private: |
| 35 BaseSessionService* base_session_service_; | 38 BaseSessionService* base_session_service_; |
| 36 | 39 |
| 37 DISALLOW_COPY_AND_ASSIGN(BaseSessionServiceTestHelper); | 40 DISALLOW_COPY_AND_ASSIGN(BaseSessionServiceTestHelper); |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 } // namespace sessions | 43 } // namespace sessions |
| 41 | 44 |
| 42 #endif // COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_TEST_HELPER_H_ | 45 #endif // COMPONENTS_SESSIONS_CORE_BASE_SESSION_SERVICE_TEST_HELPER_H_ |
| OLD | NEW |