| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 // file was generated from ClosingTabStaysClosed. If we successfully processed | 851 // file was generated from ClosingTabStaysClosed. If we successfully processed |
| 852 // the file we'll have one tab. | 852 // the file we'll have one tab. |
| 853 v1_file_path = | 853 v1_file_path = |
| 854 v1_file_path.AppendASCII("sessions").AppendASCII("v1_session_file"); | 854 v1_file_path.AppendASCII("sessions").AppendASCII("v1_session_file"); |
| 855 base::FilePath dest_file_path(path_); | 855 base::FilePath dest_file_path(path_); |
| 856 dest_file_path = dest_file_path.AppendASCII("Current Session"); | 856 dest_file_path = dest_file_path.AppendASCII("Current Session"); |
| 857 | 857 |
| 858 // Forces closing the file. | 858 // Forces closing the file. |
| 859 helper_.set_service(NULL); | 859 helper_.set_service(NULL); |
| 860 | 860 |
| 861 ASSERT_TRUE(file_util::CopyFile(v1_file_path, dest_file_path)); | 861 ASSERT_TRUE(base::CopyFile(v1_file_path, dest_file_path)); |
| 862 | 862 |
| 863 SessionService* session_service = new SessionService(path_); | 863 SessionService* session_service = new SessionService(path_); |
| 864 helper_.set_service(session_service); | 864 helper_.set_service(session_service); |
| 865 ScopedVector<SessionWindow> windows; | 865 ScopedVector<SessionWindow> windows; |
| 866 SessionID::id_type active_window_id = 0; | 866 SessionID::id_type active_window_id = 0; |
| 867 helper_.ReadWindows(&(windows.get()), &active_window_id); | 867 helper_.ReadWindows(&(windows.get()), &active_window_id); |
| 868 ASSERT_EQ(1u, windows.size()); | 868 ASSERT_EQ(1u, windows.size()); |
| 869 EXPECT_EQ(1u, windows[0]->tabs.size()); | 869 EXPECT_EQ(1u, windows[0]->tabs.size()); |
| 870 } | 870 } |
| 871 #endif // defined(OS_CHROMEOS) | 871 #endif // defined(OS_CHROMEOS) |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 service()->ScheduleCommand( | 976 service()->ScheduleCommand( |
| 977 service()->CreateSetActiveWindowCommand(window_id)); | 977 service()->CreateSetActiveWindowCommand(window_id)); |
| 978 service()->ScheduleCommand( | 978 service()->ScheduleCommand( |
| 979 service()->CreateSetActiveWindowCommand(window2_id)); | 979 service()->CreateSetActiveWindowCommand(window2_id)); |
| 980 | 980 |
| 981 ScopedVector<SessionWindow> windows; | 981 ScopedVector<SessionWindow> windows; |
| 982 SessionID::id_type active_window_id = 0; | 982 SessionID::id_type active_window_id = 0; |
| 983 ReadWindows(&(windows.get()), &active_window_id); | 983 ReadWindows(&(windows.get()), &active_window_id); |
| 984 EXPECT_EQ(window2_id.id(), active_window_id); | 984 EXPECT_EQ(window2_id.id(), active_window_id); |
| 985 } | 985 } |
| OLD | NEW |