| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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" | 7 #include "base/memory/scoped_vector.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "chrome/browser/sessions/session_backend.h" | 9 #include "chrome/browser/sessions/session_backend.h" |
| 10 #include "chrome/browser/sessions/session_service.h" | 10 #include "chrome/browser/sessions/session_service.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 service()->force_browser_not_alive_with_no_windows_ = | 53 service()->force_browser_not_alive_with_no_windows_ = |
| 54 force_browser_not_alive_with_no_windows; | 54 force_browser_not_alive_with_no_windows; |
| 55 } | 55 } |
| 56 | 56 |
| 57 // Be sure and null out service to force closing the file. | 57 // Be sure and null out service to force closing the file. |
| 58 void SessionServiceTestHelper::ReadWindows( | 58 void SessionServiceTestHelper::ReadWindows( |
| 59 std::vector<SessionWindow*>* windows, | 59 std::vector<SessionWindow*>* windows, |
| 60 SessionID::id_type* active_window_id) { | 60 SessionID::id_type* active_window_id) { |
| 61 Time last_time; | 61 Time last_time; |
| 62 ScopedVector<SessionCommand> read_commands; | 62 ScopedVector<SessionCommand> read_commands; |
| 63 backend()->ReadLastSessionCommandsImpl(&(read_commands.get())); | 63 backend()->ReadLastSessionCommandsImpl(&read_commands); |
| 64 RestoreSessionFromCommands(read_commands.get(), windows, active_window_id); | 64 RestoreSessionFromCommands(read_commands, windows, active_window_id); |
| 65 service()->RemoveUnusedRestoreWindows(windows); | 65 service()->RemoveUnusedRestoreWindows(windows); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void SessionServiceTestHelper::AssertTabEquals(const SessionID& window_id, | 68 void SessionServiceTestHelper::AssertTabEquals(const SessionID& window_id, |
| 69 const SessionID& tab_id, | 69 const SessionID& tab_id, |
| 70 int visual_index, | 70 int visual_index, |
| 71 int nav_index, | 71 int nav_index, |
| 72 size_t nav_count, | 72 size_t nav_count, |
| 73 const SessionTab& session_tab) { | 73 const SessionTab& session_tab) { |
| 74 EXPECT_EQ(window_id.id(), session_tab.window_id.id()); | 74 EXPECT_EQ(window_id.id(), session_tab.window_id.id()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 service_.reset(service); | 111 service_.reset(service); |
| 112 // Execute IO tasks posted by the SessionService. | 112 // Execute IO tasks posted by the SessionService. |
| 113 content::RunAllBlockingPoolTasksUntilIdle(); | 113 content::RunAllBlockingPoolTasksUntilIdle(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void SessionServiceTestHelper::RunTaskOnBackendThread( | 116 void SessionServiceTestHelper::RunTaskOnBackendThread( |
| 117 const tracked_objects::Location& from_here, | 117 const tracked_objects::Location& from_here, |
| 118 const base::Closure& task) { | 118 const base::Closure& task) { |
| 119 service_->RunTaskOnBackendThread(from_here, task); | 119 service_->RunTaskOnBackendThread(from_here, task); |
| 120 } | 120 } |
| OLD | NEW |