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

Side by Side Diff: chrome/browser/ui/find_bar/find_bar_host_browsertest.cc

Issue 11392004: Remove TabContents from AddBlankTabAt, kill AddBlankTab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_util.h" 5 #include "base/file_util.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/common/cancelable_request.h" 10 #include "chrome/browser/common/cancelable_request.h"
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 // Find "Default". 1134 // Find "Default".
1135 int ordinal = 0; 1135 int ordinal = 0;
1136 WebContents* web_contents_1 = chrome::GetActiveWebContents(browser()); 1136 WebContents* web_contents_1 = chrome::GetActiveWebContents(browser());
1137 EXPECT_EQ(1, FindInPageWchar(web_contents_1, L"text", 1137 EXPECT_EQ(1, FindInPageWchar(web_contents_1, L"text",
1138 kFwd, kIgnoreCase, &ordinal)); 1138 kFwd, kIgnoreCase, &ordinal));
1139 1139
1140 // Create a second tab. 1140 // Create a second tab.
1141 // For some reason we can't use AddSelectedTabWithURL here on ChromeOS. It 1141 // For some reason we can't use AddSelectedTabWithURL here on ChromeOS. It
1142 // could be some delicate assumption about the tab starting off unselected or 1142 // could be some delicate assumption about the tab starting off unselected or
1143 // something relating to user gesture. 1143 // something relating to user gesture.
1144 chrome::AddBlankTab(browser(), true); 1144 chrome::AddBlankTabAt(browser(), -1, true);
1145 ui_test_utils::NavigateToURL(browser(), url); 1145 ui_test_utils::NavigateToURL(browser(), url);
1146 WebContents* web_contents_2 = chrome::GetActiveWebContents(browser()); 1146 WebContents* web_contents_2 = chrome::GetActiveWebContents(browser());
1147 EXPECT_NE(web_contents_1, web_contents_2); 1147 EXPECT_NE(web_contents_1, web_contents_2);
1148 1148
1149 // Find "given". 1149 // Find "given".
1150 FindInPageWchar(web_contents_2, L"given", kFwd, kIgnoreCase, &ordinal); 1150 FindInPageWchar(web_contents_2, L"given", kFwd, kIgnoreCase, &ordinal);
1151 1151
1152 // Switch back to first tab. 1152 // Switch back to first tab.
1153 chrome::ActivateTabAt(browser(), 0, false); 1153 chrome::ActivateTabAt(browser(), 0, false);
1154 browser()->GetFindBarController()->EndFindSession( 1154 browser()->GetFindBarController()->EndFindSession(
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 EnsureFindBoxOpen(); 1257 EnsureFindBoxOpen();
1258 1258
1259 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText()); 1259 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText());
1260 1260
1261 // Close the Find box. 1261 // Close the Find box.
1262 browser()->GetFindBarController()->EndFindSession( 1262 browser()->GetFindBarController()->EndFindSession(
1263 FindBarController::kKeepSelectionOnPage, 1263 FindBarController::kKeepSelectionOnPage,
1264 FindBarController::kKeepResultsInFindBox); 1264 FindBarController::kKeepResultsInFindBox);
1265 1265
1266 // Now create a second tab and load the same page. 1266 // Now create a second tab and load the same page.
1267 chrome::AddBlankTab(browser(), true); 1267 chrome::AddBlankTabAt(browser(), -1, true);
1268 ui_test_utils::NavigateToURL(browser(), url); 1268 ui_test_utils::NavigateToURL(browser(), url);
1269 WebContents* web_contents_2 = chrome::GetActiveWebContents(browser()); 1269 WebContents* web_contents_2 = chrome::GetActiveWebContents(browser());
1270 EXPECT_NE(web_contents_1, web_contents_2); 1270 EXPECT_NE(web_contents_1, web_contents_2);
1271 1271
1272 // Search for the word "text". 1272 // Search for the word "text".
1273 FindInPageWchar(web_contents_2, L"text", kFwd, kIgnoreCase, &ordinal); 1273 FindInPageWchar(web_contents_2, L"text", kFwd, kIgnoreCase, &ordinal);
1274 1274
1275 // Go back to the first tab and make sure we have NOT switched the prepopulate 1275 // Go back to the first tab and make sure we have NOT switched the prepopulate
1276 // text to "text". 1276 // text to "text".
1277 chrome::ActivateTabAt(browser(), 0, false); 1277 chrome::ActivateTabAt(browser(), 0, false);
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 content::RunAllPendingInMessageLoop(); // Needed on Linux. 1462 content::RunAllPendingInMessageLoop(); // Needed on Linux.
1463 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); 1463 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL));
1464 1464
1465 ui_test_utils::NavigateToURLWithDisposition( 1465 ui_test_utils::NavigateToURLWithDisposition(
1466 browser(), url, NEW_FOREGROUND_TAB, 1466 browser(), url, NEW_FOREGROUND_TAB,
1467 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 1467 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
1468 chrome::CloseTab(browser()); 1468 chrome::CloseTab(browser());
1469 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); 1469 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL));
1470 EXPECT_EQ(position, position2); 1470 EXPECT_EQ(position, position2);
1471 } 1471 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm ('k') | chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698