Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: chrome/browser/ui/browser_tabrestore_browsertest.cc

Issue 1350653004: [sessions] Properly namespace recently-componentized TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mac Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chrome_notification_types.h" 5 #include "chrome/browser/chrome_notification_types.h"
6 #include "chrome/browser/sessions/tab_restore_service_factory.h" 6 #include "chrome/browser/sessions/tab_restore_service_factory.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_commands.h" 8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/browser_list.h" 9 #include "chrome/browser/ui/browser_list.h"
10 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" 10 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 BrowserList* active_browser_list = 112 BrowserList* active_browser_list =
113 BrowserList::GetInstance(browser()->host_desktop_type()); 113 BrowserList::GetInstance(browser()->host_desktop_type());
114 EXPECT_EQ(2u, active_browser_list->size()); 114 EXPECT_EQ(2u, active_browser_list->size());
115 115
116 // Close the first browser. 116 // Close the first browser.
117 CloseBrowser(browser()); 117 CloseBrowser(browser());
118 EXPECT_EQ(1u, active_browser_list->size()); 118 EXPECT_EQ(1u, active_browser_list->size());
119 119
120 // Check the browser has a delegated restore service. 120 // Check the browser has a delegated restore service.
121 Browser* browser = active_browser_list->get(0); 121 Browser* browser = active_browser_list->get(0);
122 TabRestoreService* service = 122 sessions::TabRestoreService* service =
123 TabRestoreServiceFactory::GetForProfile(browser->profile()); 123 TabRestoreServiceFactory::GetForProfile(browser->profile());
124 bool has_tab_restore_service = !!service; 124 bool has_tab_restore_service = !!service;
125 ASSERT_TRUE(has_tab_restore_service); 125 ASSERT_TRUE(has_tab_restore_service);
126 TabRestoreServiceDelegate* delegate = 126 sessions::TabRestoreServiceDelegate* delegate =
127 BrowserTabRestoreServiceDelegate::FindDelegateForWebContents( 127 BrowserTabRestoreServiceDelegate::FindDelegateForWebContents(
128 browser->tab_strip_model()->GetActiveWebContents()); 128 browser->tab_strip_model()->GetActiveWebContents());
129 bool has_tab_restore_delegate = !!delegate; 129 bool has_tab_restore_delegate = !!delegate;
130 ASSERT_TRUE(has_tab_restore_delegate); 130 ASSERT_TRUE(has_tab_restore_delegate);
131 131
132 // Restore tabs using that delegated restore service. 132 // Restore tabs using that delegated restore service.
133 content::DOMMessageQueue queue; 133 content::DOMMessageQueue queue;
134 service->RestoreMostRecentEntry( 134 service->RestoreMostRecentEntry(
135 delegate, browser->host_desktop_type()); 135 delegate, browser->host_desktop_type());
136 AwaitTabsReady(&queue, 2); 136 AwaitTabsReady(&queue, 2);
137 137
138 // There should be 3 restored tabs in the new browser. 138 // There should be 3 restored tabs in the new browser.
139 EXPECT_EQ(2u, active_browser_list->size()); 139 EXPECT_EQ(2u, active_browser_list->size());
140 browser = active_browser_list->get(1); 140 browser = active_browser_list->get(1);
141 EXPECT_EQ(3, browser->tab_strip_model()->count()); 141 EXPECT_EQ(3, browser->tab_strip_model()->count());
142 142
143 // The middle tab only should have visible disposition. 143 // The middle tab only should have visible disposition.
144 CheckVisbility(browser->tab_strip_model(), 1); 144 CheckVisbility(browser->tab_strip_model(), 1);
145 } 145 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_tab_strip_model_delegate.cc ('k') | chrome/browser/ui/cocoa/history_menu_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698