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

Unified Diff: chrome/browser/sessions/tab_restore_browsertest.cc

Issue 2200993004: Make TabRestoreService::Entry noncopyable and fix up surrounding code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tab-test-cleanup
Patch Set: Eliminate a use-after-free, Windows build fix Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sessions/tab_restore_browsertest.cc
diff --git a/chrome/browser/sessions/tab_restore_browsertest.cc b/chrome/browser/sessions/tab_restore_browsertest.cc
index f5f0b5ebce3a8483bbc7ba4bd9ae5b5ce4ab50e0..a5b85a471c6dfbb59b85af2231cf9057da1ba646 100644
--- a/chrome/browser/sessions/tab_restore_browsertest.cc
+++ b/chrome/browser/sessions/tab_restore_browsertest.cc
@@ -441,19 +441,20 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabFromClosedWindowByID) {
TabRestoreServiceFactory::GetForProfile(browser->profile());
const sessions::TabRestoreService::Entries& entries = service->entries();
EXPECT_EQ(1u, entries.size());
- sessions::TabRestoreService::Entry* entry = entries.front();
+ sessions::TabRestoreService::Entry* entry = entries.front().get();
ASSERT_EQ(sessions::TabRestoreService::WINDOW, entry->type);
sessions::TabRestoreService::Window* entry_win =
static_cast<sessions::TabRestoreService::Window*>(entry);
- std::vector<sessions::TabRestoreService::Tab>& tabs = entry_win->tabs;
+ auto& tabs = entry_win->tabs;
EXPECT_EQ(3u, tabs.size());
// Find the Tab to restore.
- sessions::TabRestoreService::Tab tab_to_restore;
+ SessionID::id_type tab_id_to_restore = 0;
bool found_tab_to_restore = false;
- for (const auto& tab : tabs) {
+ for (const auto& tab_ptr : tabs) {
+ auto& tab = *tab_ptr;
if (tab.navigations[tab.current_navigation_index].virtual_url() == url1_) {
- tab_to_restore = tab;
+ tab_id_to_restore = tab.id;
found_tab_to_restore = true;
break;
}
@@ -468,7 +469,7 @@ IN_PROC_BROWSER_TEST_F(TabRestoreTest, RestoreTabFromClosedWindowByID) {
content::WindowedNotificationObserver tab_loaded_observer(
content::NOTIFICATION_LOAD_STOP,
content::NotificationService::AllSources());
- service->RestoreEntryById(browser->live_tab_context(), tab_to_restore.id,
+ service->RestoreEntryById(browser->live_tab_context(), tab_id_to_restore,
NEW_FOREGROUND_TAB);
tab_added_observer.Wait();
tab_loaded_observer.Wait();

Powered by Google App Engine
This is Rietveld 408576698