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/ui/toolbar/recent_tabs_sub_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 AddTab(browser(), GURL("http://wnd/tab0")); | 254 AddTab(browser(), GURL("http://wnd/tab0")); |
255 AddTab(browser(), GURL("http://wnd/tab1")); | 255 AddTab(browser(), GURL("http://wnd/tab1")); |
256 browser()->tab_strip_model()->CloseAllTabs(); | 256 browser()->tab_strip_model()->CloseAllTabs(); |
257 | 257 |
258 // Create a SessionService for the profile (profile owns the service) and add | 258 // Create a SessionService for the profile (profile owns the service) and add |
259 // a window with a tab to this session. | 259 // a window with a tab to this session. |
260 SessionService* session_service = new SessionService(profile()); | 260 SessionService* session_service = new SessionService(profile()); |
261 SessionServiceFactory::SetForTestProfile(profile(), session_service); | 261 SessionServiceFactory::SetForTestProfile(profile(), session_service); |
262 SessionID tab_id; | 262 SessionID tab_id; |
263 SessionID window_id; | 263 SessionID window_id; |
264 session_service->SetWindowType( | 264 session_service->SetWindowType(window_id, |
265 window_id, Browser::TYPE_TABBED, SessionService::TYPE_NORMAL); | 265 Browser::TYPE_TABBED, |
| 266 SessionService::TYPE_NORMAL); |
266 session_service->SetTabWindow(window_id, tab_id); | 267 session_service->SetTabWindow(window_id, tab_id); |
267 session_service->SetTabIndexInWindow(window_id, tab_id, 0); | 268 session_service->SetTabIndexInWindow(window_id, tab_id, 0); |
268 session_service->SetSelectedTabInWindow(window_id, 0); | 269 session_service->SetSelectedTabInWindow(window_id, 0); |
269 session_service->UpdateTabNavigation( | 270 session_service->UpdateTabNavigation( |
270 window_id, tab_id, | 271 window_id, tab_id, |
271 sessions::SerializedNavigationEntryTestHelper::CreateNavigation( | 272 sessions::SerializedNavigationEntryTestHelper::CreateNavigation( |
272 "http://wnd1/tab0", "title")); | 273 "http://wnd1/tab0", "title")); |
273 // Set this, otherwise previous session won't be loaded. | 274 // Set this, otherwise previous session won't be loaded. |
274 profile()->set_last_session_exited_cleanly(false); | 275 profile()->set_last_session_exited_cleanly(false); |
275 // Move this session to the last so that TabRestoreService will load it as the | 276 // Move this session to the last so that TabRestoreService will load it as the |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 // 0 Recently closed heaer (disabled) | 552 // 0 Recently closed heaer (disabled) |
552 // 1 <separator> | 553 // 1 <separator> |
553 // 2 No tabs from other Devices | 554 // 2 No tabs from other Devices |
554 | 555 |
555 TestRecentTabsSubMenuModel model(NULL, browser(), NULL); | 556 TestRecentTabsSubMenuModel model(NULL, browser(), NULL); |
556 EXPECT_EQ(3, model.GetItemCount()); | 557 EXPECT_EQ(3, model.GetItemCount()); |
557 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(0)); | 558 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(0)); |
558 EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(1)); | 559 EXPECT_NE(-1, model.GetMaxWidthForItemAtIndex(1)); |
559 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(2)); | 560 EXPECT_EQ(-1, model.GetMaxWidthForItemAtIndex(2)); |
560 } | 561 } |
OLD | NEW |