OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/persistent_tab_restore_service.h" | 5 #include "chrome/browser/sessions/persistent_tab_restore_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 SynchronousLoadTabsFromLastSession(); | 120 SynchronousLoadTabsFromLastSession(); |
121 } | 121 } |
122 | 122 |
123 // Adds a window with one tab and url to the profile's session service. | 123 // Adds a window with one tab and url to the profile's session service. |
124 // If |pinned| is true, the tab is marked as pinned in the session service. | 124 // If |pinned| is true, the tab is marked as pinned in the session service. |
125 void AddWindowWithOneTabToSessionService(bool pinned) { | 125 void AddWindowWithOneTabToSessionService(bool pinned) { |
126 SessionService* session_service = | 126 SessionService* session_service = |
127 SessionServiceFactory::GetForProfile(profile()); | 127 SessionServiceFactory::GetForProfile(profile()); |
128 SessionID tab_id; | 128 SessionID tab_id; |
129 SessionID window_id; | 129 SessionID window_id; |
130 session_service->SetWindowType( | 130 session_service->SetWindowType(window_id, |
131 window_id, Browser::TYPE_TABBED, SessionService::TYPE_NORMAL); | 131 Browser::TYPE_TABBED, |
| 132 SessionServiceCommands::TYPE_NORMAL); |
132 session_service->SetTabWindow(window_id, tab_id); | 133 session_service->SetTabWindow(window_id, tab_id); |
133 session_service->SetTabIndexInWindow(window_id, tab_id, 0); | 134 session_service->SetTabIndexInWindow(window_id, tab_id, 0); |
134 session_service->SetSelectedTabInWindow(window_id, 0); | 135 session_service->SetSelectedTabInWindow(window_id, 0); |
135 if (pinned) | 136 if (pinned) |
136 session_service->SetPinnedState(window_id, tab_id, true); | 137 session_service->SetPinnedState(window_id, tab_id, true); |
137 session_service->UpdateTabNavigation( | 138 session_service->UpdateTabNavigation( |
138 window_id, tab_id, | 139 window_id, tab_id, |
139 SerializedNavigationEntryTestHelper::CreateNavigation( | 140 SerializedNavigationEntryTestHelper::CreateNavigation( |
140 url1_.spec(), "title")); | 141 url1_.spec(), "title")); |
141 } | 142 } |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 | 755 |
755 EXPECT_FALSE(service_->IsLoaded()); | 756 EXPECT_FALSE(service_->IsLoaded()); |
756 TestTabRestoreServiceObserver observer; | 757 TestTabRestoreServiceObserver observer; |
757 service_->AddObserver(&observer); | 758 service_->AddObserver(&observer); |
758 EXPECT_EQ(max_entries, service_->entries().size()); | 759 EXPECT_EQ(max_entries, service_->entries().size()); |
759 SynchronousLoadTabsFromLastSession(); | 760 SynchronousLoadTabsFromLastSession(); |
760 EXPECT_TRUE(observer.got_loaded()); | 761 EXPECT_TRUE(observer.got_loaded()); |
761 EXPECT_TRUE(service_->IsLoaded()); | 762 EXPECT_TRUE(service_->IsLoaded()); |
762 service_->RemoveObserver(&observer); | 763 service_->RemoveObserver(&observer); |
763 } | 764 } |
OLD | NEW |