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

Side by Side Diff: chrome/browser/browser_commands_unittest.cc

Issue 9015022: Replace most of Browser::GetSelectedTabContents calls into Browser::GetSelectedWebContents. I've ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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/bookmarks/bookmark_utils.cc ('k') | chrome/browser/browser_focus_uitest.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/app/chrome_command_ids.h" 5 #include "chrome/app/chrome_command_ids.h"
6 #include "chrome/browser/bookmarks/bookmark_model.h" 6 #include "chrome/browser/bookmarks/bookmark_model.h"
7 #include "chrome/browser/ui/browser_list.h" 7 #include "chrome/browser/ui/browser_list.h"
8 #include "chrome/common/url_constants.h" 8 #include "chrome/common/url_constants.h"
9 #include "chrome/test/base/browser_with_test_window_test.h" 9 #include "chrome/test/base/browser_with_test_window_test.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 EXPECT_TRUE(second->GetController().CanGoBack()); 154 EXPECT_TRUE(second->GetController().CanGoBack());
155 EXPECT_FALSE(second->GetController().CanGoForward()); 155 EXPECT_FALSE(second->GetController().CanGoForward());
156 156
157 // Now do back in a new foreground tab. Don't bother re-checking every sngle 157 // Now do back in a new foreground tab. Don't bother re-checking every sngle
158 // thing above, just validate that it's opening properly. 158 // thing above, just validate that it's opening properly.
159 browser()->ActivateTabAt(2, true); 159 browser()->ActivateTabAt(2, true);
160 // TODO(brettw) bug 11055: see the comment above about why we need this. 160 // TODO(brettw) bug 11055: see the comment above about why we need this.
161 CommitPendingLoad(&second->GetController()); 161 CommitPendingLoad(&second->GetController());
162 browser()->GoBack(NEW_FOREGROUND_TAB); 162 browser()->GoBack(NEW_FOREGROUND_TAB);
163 ASSERT_EQ(3, browser()->active_index()); 163 ASSERT_EQ(3, browser()->active_index());
164 ASSERT_EQ(url1, browser()->GetSelectedTabContents()->GetURL()); 164 ASSERT_EQ(url1, browser()->GetSelectedWebContents()->GetURL());
165 165
166 // Same thing again for forward. 166 // Same thing again for forward.
167 // TODO(brettw) bug 11055: see the comment above about why we need this. 167 // TODO(brettw) bug 11055: see the comment above about why we need this.
168 CommitPendingLoad(&browser()->GetSelectedTabContents()->GetController()); 168 CommitPendingLoad(&browser()->GetSelectedWebContents()->GetController());
169 browser()->GoForward(NEW_FOREGROUND_TAB); 169 browser()->GoForward(NEW_FOREGROUND_TAB);
170 ASSERT_EQ(4, browser()->active_index()); 170 ASSERT_EQ(4, browser()->active_index());
171 ASSERT_EQ(url2, browser()->GetSelectedTabContents()->GetURL()); 171 ASSERT_EQ(url2, browser()->GetSelectedWebContents()->GetURL());
172 } 172 }
173 173
174 // Tests IDC_SEARCH (the Search key on Chrome OS devices). 174 // Tests IDC_SEARCH (the Search key on Chrome OS devices).
175 #if defined(OS_CHROMEOS) 175 #if defined(OS_CHROMEOS)
176 TEST_F(BrowserCommandsTest, Search) { 176 TEST_F(BrowserCommandsTest, Search) {
177 // Load a non-NTP URL. 177 // Load a non-NTP URL.
178 GURL non_ntp_url("http://foo/"); 178 GURL non_ntp_url("http://foo/");
179 AddTab(browser(), non_ntp_url); 179 AddTab(browser(), non_ntp_url);
180 ASSERT_EQ(1, browser()->tab_count()); 180 ASSERT_EQ(1, browser()->tab_count());
181 EXPECT_EQ(non_ntp_url, browser()->GetSelectedTabContents()->GetURL()); 181 EXPECT_EQ(non_ntp_url, browser()->GetSelectedWebContents()->GetURL());
182 182
183 // Pressing the Search key should open a new tab containing the NTP. 183 // Pressing the Search key should open a new tab containing the NTP.
184 browser()->Search(); 184 browser()->Search();
185 ASSERT_EQ(2, browser()->tab_count()); 185 ASSERT_EQ(2, browser()->tab_count());
186 ASSERT_EQ(1, browser()->active_index()); 186 ASSERT_EQ(1, browser()->active_index());
187 GURL current_url = browser()->GetSelectedTabContents()->GetURL(); 187 GURL current_url = browser()->GetSelectedWebContents()->GetURL();
188 EXPECT_TRUE(current_url.SchemeIs(chrome::kChromeUIScheme)); 188 EXPECT_TRUE(current_url.SchemeIs(chrome::kChromeUIScheme));
189 EXPECT_EQ(chrome::kChromeUINewTabHost, current_url.host()); 189 EXPECT_EQ(chrome::kChromeUINewTabHost, current_url.host());
190 190
191 // Pressing it a second time while the NTP is open shouldn't change anything. 191 // Pressing it a second time while the NTP is open shouldn't change anything.
192 browser()->Search(); 192 browser()->Search();
193 ASSERT_EQ(2, browser()->tab_count()); 193 ASSERT_EQ(2, browser()->tab_count());
194 ASSERT_EQ(1, browser()->active_index()); 194 ASSERT_EQ(1, browser()->active_index());
195 current_url = browser()->GetSelectedTabContents()->GetURL(); 195 current_url = browser()->GetSelectedWebContents()->GetURL();
196 EXPECT_TRUE(current_url.SchemeIs(chrome::kChromeUIScheme)); 196 EXPECT_TRUE(current_url.SchemeIs(chrome::kChromeUIScheme));
197 EXPECT_EQ(chrome::kChromeUINewTabHost, current_url.host()); 197 EXPECT_EQ(chrome::kChromeUINewTabHost, current_url.host());
198 } 198 }
199 #endif 199 #endif
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils.cc ('k') | chrome/browser/browser_focus_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698