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

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

Issue 2819086: Removal of TabContentsDelegate::GetBrowser() interface method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 FilePath(FilePath::kCurrentDirectory), 68 FilePath(FilePath::kCurrentDirectory),
69 FilePath(FILE_PATH_LITERAL("title1.html")))); 69 FilePath(FILE_PATH_LITERAL("title1.html"))));
70 GURL url2(ui_test_utils::GetTestUrl( 70 GURL url2(ui_test_utils::GetTestUrl(
71 FilePath(FilePath::kCurrentDirectory), 71 FilePath(FilePath::kCurrentDirectory),
72 FilePath(FILE_PATH_LITERAL("title2.html")))); 72 FilePath(FILE_PATH_LITERAL("title2.html"))));
73 GURL url3(ui_test_utils::GetTestUrl( 73 GURL url3(ui_test_utils::GetTestUrl(
74 FilePath(FilePath::kCurrentDirectory), 74 FilePath(FilePath::kCurrentDirectory),
75 FilePath(FILE_PATH_LITERAL("title3.html")))); 75 FilePath(FILE_PATH_LITERAL("title3.html"))));
76 76
77 // Add and navigate three tabs. 77 // Add and navigate three tabs.
78 Browser* browser_used = NULL;
78 ui_test_utils::NavigateToURL(browser(), url1); 79 ui_test_utils::NavigateToURL(browser(), url1);
79 browser()->AddTabWithURL(url2, GURL(), PageTransition::LINK, 1, 80 browser()->AddTabWithURL(url2, GURL(), PageTransition::LINK, 1,
80 TabStripModel::ADD_SELECTED, NULL, std::string()); 81 TabStripModel::ADD_SELECTED, NULL, std::string(),
82 &browser_used);
83 EXPECT_EQ(browser(), browser_used);
81 ui_test_utils::WaitForNavigationInCurrentTab(browser()); 84 ui_test_utils::WaitForNavigationInCurrentTab(browser());
82 85
83 browser()->AddTabWithURL(url3, GURL(), PageTransition::LINK, 2, 86 browser()->AddTabWithURL(url3, GURL(), PageTransition::LINK, 2,
84 TabStripModel::ADD_SELECTED, NULL, std::string()); 87 TabStripModel::ADD_SELECTED, NULL, std::string(),
88 &browser_used);
89 EXPECT_EQ(browser(), browser_used);
85 ui_test_utils::WaitForNavigationInCurrentTab(browser()); 90 ui_test_utils::WaitForNavigationInCurrentTab(browser());
86 91
87 TabRestoreService* service = browser()->profile()->GetTabRestoreService(); 92 TabRestoreService* service = browser()->profile()->GetTabRestoreService();
88 service->ClearEntries(); 93 service->ClearEntries();
89 94
90 browser()->window()->Close(); 95 browser()->window()->Close();
91 96
92 // Expect a window with three tabs. 97 // Expect a window with three tabs.
93 EXPECT_EQ(1U, service->entries().size()); 98 EXPECT_EQ(1U, service->entries().size());
94 ASSERT_EQ(TabRestoreService::WINDOW, service->entries().front()->type); 99 ASSERT_EQ(TabRestoreService::WINDOW, service->entries().front()->type);
(...skipping 13 matching lines...) Expand all
108 } 113 }
109 } 114 }
110 115
111 // Make sure that the Window got updated. 116 // Make sure that the Window got updated.
112 EXPECT_EQ(1U, service->entries().size()); 117 EXPECT_EQ(1U, service->entries().size());
113 ASSERT_EQ(TabRestoreService::WINDOW, service->entries().front()->type); 118 ASSERT_EQ(TabRestoreService::WINDOW, service->entries().front()->type);
114 window = static_cast<TabRestoreService::Window*>(service->entries().front()); 119 window = static_cast<TabRestoreService::Window*>(service->entries().front());
115 EXPECT_EQ(2U, window->tabs.size()); 120 EXPECT_EQ(2U, window->tabs.size());
116 } 121 }
117 122
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