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

Side by Side Diff: chrome/browser/sessions/session_restore_browsertest.cc

Issue 3834002: Make all browser code use browser::Navigate to open tabs.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "chrome/browser/browser.h" 6 #include "chrome/browser/browser.h"
7 #include "chrome/browser/browser_window.h" 7 #include "chrome/browser/browser_window.h"
8 #include "chrome/browser/defaults.h" 8 #include "chrome/browser/defaults.h"
9 #include "chrome/browser/sessions/tab_restore_service.h" 9 #include "chrome/browser/sessions/tab_restore_service.h"
10 #include "chrome/browser/tab_contents/tab_contents.h" 10 #include "chrome/browser/tab_contents/tab_contents.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 FilePath(FILE_PATH_LITERAL("title1.html")))); 70 FilePath(FILE_PATH_LITERAL("title1.html"))));
71 GURL url2(ui_test_utils::GetTestUrl( 71 GURL url2(ui_test_utils::GetTestUrl(
72 FilePath(FilePath::kCurrentDirectory), 72 FilePath(FilePath::kCurrentDirectory),
73 FilePath(FILE_PATH_LITERAL("title2.html")))); 73 FilePath(FILE_PATH_LITERAL("title2.html"))));
74 GURL url3(ui_test_utils::GetTestUrl( 74 GURL url3(ui_test_utils::GetTestUrl(
75 FilePath(FilePath::kCurrentDirectory), 75 FilePath(FilePath::kCurrentDirectory),
76 FilePath(FILE_PATH_LITERAL("title3.html")))); 76 FilePath(FILE_PATH_LITERAL("title3.html"))));
77 77
78 // Add and navigate three tabs. 78 // Add and navigate three tabs.
79 ui_test_utils::NavigateToURL(browser(), url1); 79 ui_test_utils::NavigateToURL(browser(), url1);
80 Browser::AddTabWithURLParams params1(url2, PageTransition::LINK); 80 browser()->AddSelectedTabWithURL(url2, PageTransition::LINK);
81 browser()->AddTabWithURL(&params1);
82 EXPECT_EQ(browser(), params1.target);
83 ui_test_utils::WaitForNavigationInCurrentTab(browser()); 81 ui_test_utils::WaitForNavigationInCurrentTab(browser());
84 82
85 Browser::AddTabWithURLParams params2(url3, PageTransition::LINK); 83 browser()->AddSelectedTabWithURL(url3, PageTransition::LINK);
86 browser()->AddTabWithURL(&params2);
87 EXPECT_EQ(browser(), params2.target);
88 ui_test_utils::WaitForNavigationInCurrentTab(browser()); 84 ui_test_utils::WaitForNavigationInCurrentTab(browser());
89 85
90 TabRestoreService* service = browser()->profile()->GetTabRestoreService(); 86 TabRestoreService* service = browser()->profile()->GetTabRestoreService();
91 service->ClearEntries(); 87 service->ClearEntries();
92 88
93 browser()->window()->Close(); 89 browser()->window()->Close();
94 90
95 // Expect a window with three tabs. 91 // Expect a window with three tabs.
96 EXPECT_EQ(1U, service->entries().size()); 92 EXPECT_EQ(1U, service->entries().size());
97 ASSERT_EQ(TabRestoreService::WINDOW, service->entries().front()->type); 93 ASSERT_EQ(TabRestoreService::WINDOW, service->entries().front()->type);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 ASSERT_EQ(TabRestoreService::TAB, service->entries().front()->type); 134 ASSERT_EQ(TabRestoreService::TAB, service->entries().front()->type);
139 const TabRestoreService::Tab* tab = 135 const TabRestoreService::Tab* tab =
140 static_cast<TabRestoreService::Tab*>(service->entries().front()); 136 static_cast<TabRestoreService::Tab*>(service->entries().front());
141 137
142 // Restore the tab. 138 // Restore the tab.
143 service->RestoreEntryById(NULL, tab->id, false); 139 service->RestoreEntryById(NULL, tab->id, false);
144 140
145 // Make sure the restore was successful. 141 // Make sure the restore was successful.
146 EXPECT_EQ(0U, service->entries().size()); 142 EXPECT_EQ(0U, service->entries().size());
147 } 143 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698