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

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

Issue 562603002: Move PageTransition from //content/public/common to //ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
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/files/file_util.h" 5 #include "base/files/file_util.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/string16.h" 8 #include "base/strings/string16.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 1196
1197 // Search for the word "page". 1197 // Search for the word "page".
1198 int ordinal = 0; 1198 int ordinal = 0;
1199 WebContents* web_contents_1 = 1199 WebContents* web_contents_1 =
1200 browser()->tab_strip_model()->GetActiveWebContents(); 1200 browser()->tab_strip_model()->GetActiveWebContents();
1201 EXPECT_EQ(1, FindInPageWchar(web_contents_1, L"page", 1201 EXPECT_EQ(1, FindInPageWchar(web_contents_1, L"page",
1202 kFwd, kIgnoreCase, &ordinal)); 1202 kFwd, kIgnoreCase, &ordinal));
1203 EXPECT_EQ(ASCIIToUTF16("1 of 1"), GetMatchCountText()); 1203 EXPECT_EQ(ASCIIToUTF16("1 of 1"), GetMatchCountText());
1204 1204
1205 // Now create a second tab and load the same page. 1205 // Now create a second tab and load the same page.
1206 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); 1206 chrome::AddSelectedTabWithURL(browser(), url, ui::PAGE_TRANSITION_TYPED);
1207 WebContents* web_contents_2 = 1207 WebContents* web_contents_2 =
1208 browser()->tab_strip_model()->GetActiveWebContents(); 1208 browser()->tab_strip_model()->GetActiveWebContents();
1209 EXPECT_NE(web_contents_1, web_contents_2); 1209 EXPECT_NE(web_contents_1, web_contents_2);
1210 1210
1211 // Open the Find box. 1211 // Open the Find box.
1212 EnsureFindBoxOpen(); 1212 EnsureFindBoxOpen();
1213 1213
1214 // The new tab should have "page" prepopulated, since that was the last search 1214 // The new tab should have "page" prepopulated, since that was the last search
1215 // in the first tab. 1215 // in the first tab.
1216 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText()); 1216 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText());
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 1321
1322 // Open a new incognito window and navigate to the same page. 1322 // Open a new incognito window and navigate to the same page.
1323 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); 1323 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile();
1324 Browser* incognito_browser = 1324 Browser* incognito_browser =
1325 new Browser(Browser::CreateParams(incognito_profile, 1325 new Browser(Browser::CreateParams(incognito_profile,
1326 browser()->host_desktop_type())); 1326 browser()->host_desktop_type()));
1327 content::WindowedNotificationObserver observer( 1327 content::WindowedNotificationObserver observer(
1328 content::NOTIFICATION_LOAD_STOP, 1328 content::NOTIFICATION_LOAD_STOP,
1329 content::NotificationService::AllSources()); 1329 content::NotificationService::AllSources());
1330 chrome::AddSelectedTabWithURL(incognito_browser, url, 1330 chrome::AddSelectedTabWithURL(incognito_browser, url,
1331 content::PAGE_TRANSITION_AUTO_TOPLEVEL); 1331 ui::PAGE_TRANSITION_AUTO_TOPLEVEL);
1332 observer.Wait(); 1332 observer.Wait();
1333 incognito_browser->window()->Show(); 1333 incognito_browser->window()->Show();
1334 1334
1335 // Open the find box and make sure that it is prepopulated with "page". 1335 // Open the find box and make sure that it is prepopulated with "page".
1336 EnsureFindBoxOpenForBrowser(incognito_browser); 1336 EnsureFindBoxOpenForBrowser(incognito_browser);
1337 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(incognito_browser)); 1337 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(incognito_browser));
1338 1338
1339 // Search for the word "text" in the incognito tab. 1339 // Search for the word "text" in the incognito tab.
1340 WebContents* incognito_tab = 1340 WebContents* incognito_tab =
1341 incognito_browser->tab_strip_model()->GetActiveWebContents(); 1341 incognito_browser->tab_strip_model()->GetActiveWebContents();
1342 EXPECT_EQ(1, FindInPageWchar(incognito_tab, L"text", 1342 EXPECT_EQ(1, FindInPageWchar(incognito_tab, L"text",
1343 kFwd, kIgnoreCase, &ordinal)); 1343 kFwd, kIgnoreCase, &ordinal));
1344 EXPECT_EQ(ASCIIToUTF16("text"), GetFindBarTextForBrowser(incognito_browser)); 1344 EXPECT_EQ(ASCIIToUTF16("text"), GetFindBarTextForBrowser(incognito_browser));
1345 1345
1346 // Close the Find box. 1346 // Close the Find box.
1347 incognito_browser->GetFindBarController()->EndFindSession( 1347 incognito_browser->GetFindBarController()->EndFindSession(
1348 FindBarController::kKeepSelectionOnPage, 1348 FindBarController::kKeepSelectionOnPage,
1349 FindBarController::kKeepResultsInFindBox); 1349 FindBarController::kKeepResultsInFindBox);
1350 1350
1351 // Now open a new tab in the original (non-incognito) browser. 1351 // Now open a new tab in the original (non-incognito) browser.
1352 chrome::AddSelectedTabWithURL(browser(), url, content::PAGE_TRANSITION_TYPED); 1352 chrome::AddSelectedTabWithURL(browser(), url, ui::PAGE_TRANSITION_TYPED);
1353 WebContents* web_contents_2 = 1353 WebContents* web_contents_2 =
1354 browser()->tab_strip_model()->GetActiveWebContents(); 1354 browser()->tab_strip_model()->GetActiveWebContents();
1355 EXPECT_NE(web_contents_1, web_contents_2); 1355 EXPECT_NE(web_contents_1, web_contents_2);
1356 1356
1357 // Open the Find box and make sure it is prepopulated with the search term 1357 // Open the Find box and make sure it is prepopulated with the search term
1358 // from the original browser, not the search term from the incognito window. 1358 // from the original browser, not the search term from the incognito window.
1359 EnsureFindBoxOpenForBrowser(browser()); 1359 EnsureFindBoxOpenForBrowser(browser());
1360 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser())); 1360 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser()));
1361 } 1361 }
1362 1362
(...skipping 22 matching lines...) Expand all
1385 1385
1386 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FitWindow) { 1386 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FitWindow) {
1387 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile(), 1387 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile(),
1388 browser()->host_desktop_type()); 1388 browser()->host_desktop_type());
1389 params.initial_bounds = gfx::Rect(0, 0, 250, 500); 1389 params.initial_bounds = gfx::Rect(0, 0, 250, 500);
1390 Browser* popup = new Browser(params); 1390 Browser* popup = new Browser(params);
1391 content::WindowedNotificationObserver observer( 1391 content::WindowedNotificationObserver observer(
1392 content::NOTIFICATION_LOAD_STOP, 1392 content::NOTIFICATION_LOAD_STOP,
1393 content::NotificationService::AllSources()); 1393 content::NotificationService::AllSources());
1394 chrome::AddSelectedTabWithURL( 1394 chrome::AddSelectedTabWithURL(
1395 popup, GURL(url::kAboutBlankURL), content::PAGE_TRANSITION_LINK); 1395 popup, GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK);
1396 // Wait for the page to finish loading. 1396 // Wait for the page to finish loading.
1397 observer.Wait(); 1397 observer.Wait();
1398 popup->window()->Show(); 1398 popup->window()->Show();
1399 1399
1400 // On GTK, bounds change is asynchronous. 1400 // On GTK, bounds change is asynchronous.
1401 base::MessageLoop::current()->RunUntilIdle(); 1401 base::MessageLoop::current()->RunUntilIdle();
1402 1402
1403 EnsureFindBoxOpenForBrowser(popup); 1403 EnsureFindBoxOpenForBrowser(popup);
1404 1404
1405 // GTK adjusts FindBar size asynchronously. 1405 // GTK adjusts FindBar size asynchronously.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 1553
1554 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); 1554 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT));
1555 WebContents* web_contents_incognito = 1555 WebContents* web_contents_incognito =
1556 browser_incognito->tab_strip_model()->GetActiveWebContents(); 1556 browser_incognito->tab_strip_model()->GetActiveWebContents();
1557 ui_test_utils::FindInPageNotificationObserver observer( 1557 ui_test_utils::FindInPageNotificationObserver observer(
1558 web_contents_incognito); 1558 web_contents_incognito);
1559 observer.Wait(); 1559 observer.Wait();
1560 EXPECT_EQ(ASCIIToUTF16("bar"), 1560 EXPECT_EQ(ASCIIToUTF16("bar"),
1561 GetFindBarTextForBrowser(browser_incognito)); 1561 GetFindBarTextForBrowser(browser_incognito));
1562 } 1562 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_controller.cc ('k') | chrome/browser/ui/fullscreen/fullscreen_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698