| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/sessions/session_service_test_helper.h" | 5 #include "chrome/browser/sessions/session_service_test_helper.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_vector.h" | |
| 8 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 9 #include "chrome/browser/sessions/session_service.h" | 8 #include "chrome/browser/sessions/session_service.h" |
| 10 #include "components/sessions/core/base_session_service_test_helper.h" | 9 #include "components/sessions/core/base_session_service_test_helper.h" |
| 11 #include "components/sessions/core/serialized_navigation_entry_test_helper.h" | 10 #include "components/sessions/core/serialized_navigation_entry_test_helper.h" |
| 12 #include "components/sessions/core/session_backend.h" | 11 #include "components/sessions/core/session_backend.h" |
| 13 #include "components/sessions/core/session_id.h" | 12 #include "components/sessions/core/session_id.h" |
| 14 #include "components/sessions/core/session_types.h" | 13 #include "components/sessions/core/session_types.h" |
| 15 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/test/test_utils.h" | 15 #include "content/public/test/test_utils.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 bool force_browser_not_alive_with_no_windows) { | 52 bool force_browser_not_alive_with_no_windows) { |
| 54 service()->force_browser_not_alive_with_no_windows_ = | 53 service()->force_browser_not_alive_with_no_windows_ = |
| 55 force_browser_not_alive_with_no_windows; | 54 force_browser_not_alive_with_no_windows; |
| 56 } | 55 } |
| 57 | 56 |
| 58 // Be sure and null out service to force closing the file. | 57 // Be sure and null out service to force closing the file. |
| 59 void SessionServiceTestHelper::ReadWindows( | 58 void SessionServiceTestHelper::ReadWindows( |
| 60 std::vector<std::unique_ptr<sessions::SessionWindow>>* windows, | 59 std::vector<std::unique_ptr<sessions::SessionWindow>>* windows, |
| 61 SessionID::id_type* active_window_id) { | 60 SessionID::id_type* active_window_id) { |
| 62 Time last_time; | 61 Time last_time; |
| 63 ScopedVector<sessions::SessionCommand> read_commands; | 62 std::vector<std::unique_ptr<sessions::SessionCommand>> read_commands; |
| 64 sessions::BaseSessionServiceTestHelper test_helper( | 63 sessions::BaseSessionServiceTestHelper test_helper( |
| 65 service_->GetBaseSessionServiceForTest()); | 64 service_->GetBaseSessionServiceForTest()); |
| 66 test_helper.ReadLastSessionCommands(&read_commands); | 65 test_helper.ReadLastSessionCommands(&read_commands); |
| 67 RestoreSessionFromCommands(read_commands, windows, active_window_id); | 66 RestoreSessionFromCommands(read_commands, windows, active_window_id); |
| 68 service()->RemoveUnusedRestoreWindows(windows); | 67 service()->RemoveUnusedRestoreWindows(windows); |
| 69 } | 68 } |
| 70 | 69 |
| 71 void SessionServiceTestHelper::AssertTabEquals( | 70 void SessionServiceTestHelper::AssertTabEquals( |
| 72 const SessionID& window_id, | 71 const SessionID& window_id, |
| 73 const SessionID& tab_id, | 72 const SessionID& tab_id, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 return service_.release(); | 116 return service_.release(); |
| 118 } | 117 } |
| 119 | 118 |
| 120 void SessionServiceTestHelper::RunTaskOnBackendThread( | 119 void SessionServiceTestHelper::RunTaskOnBackendThread( |
| 121 const tracked_objects::Location& from_here, | 120 const tracked_objects::Location& from_here, |
| 122 const base::Closure& task) { | 121 const base::Closure& task) { |
| 123 sessions::BaseSessionServiceTestHelper test_helper( | 122 sessions::BaseSessionServiceTestHelper test_helper( |
| 124 service_->GetBaseSessionServiceForTest()); | 123 service_->GetBaseSessionServiceForTest()); |
| 125 test_helper.RunTaskOnBackendThread(from_here, task); | 124 test_helper.RunTaskOnBackendThread(from_here, task); |
| 126 } | 125 } |
| OLD | NEW |