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

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

Issue 1342743002: Remove Profile and HostDesktopType dependencies from core 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.h" 6 #include "chrome/browser/sessions/tab_restore_service.h"
7 #include "chrome/browser/sessions/tab_restore_service_delegate.h"
8 #include "chrome/browser/sessions/tab_restore_service_factory.h" 7 #include "chrome/browser/sessions/tab_restore_service_factory.h"
9 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_commands.h" 9 #include "chrome/browser/ui/browser_commands.h"
11 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h" 13 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h"
14 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
15 #include "chrome/test/base/interactive_test_utils.h" 15 #include "chrome/test/base/interactive_test_utils.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "content/public/common/url_constants.h" 17 #include "content/public/common/url_constants.h"
18 #include "content/public/test/browser_test_utils.h" 18 #include "content/public/test/browser_test_utils.h"
19 19
20 typedef InProcessBrowserTest BrowserTabRestoreTest; 20 typedef InProcessBrowserTest BrowserTabRestoreTest;
21 21
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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 TabRestoreServiceDelegate* delegate =
127 TabRestoreServiceDelegate::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_restore_service_delegate.cc ('k') | chrome/browser/ui/cocoa/history_menu_bridge_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698