OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser())); | 1317 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser())); |
1318 | 1318 |
1319 // Close the Find box. | 1319 // Close the Find box. |
1320 browser()->GetFindBarController()->EndFindSession( | 1320 browser()->GetFindBarController()->EndFindSession( |
1321 FindBarController::kKeepSelectionOnPage, | 1321 FindBarController::kKeepSelectionOnPage, |
1322 FindBarController::kKeepResultsInFindBox); | 1322 FindBarController::kKeepResultsInFindBox); |
1323 | 1323 |
1324 // Open a new incognito window and navigate to the same page. | 1324 // Open a new incognito window and navigate to the same page. |
1325 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); | 1325 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
1326 Browser* incognito_browser = | 1326 Browser* incognito_browser = |
1327 new Browser(Browser::CreateParams(incognito_profile, | 1327 new Browser(Browser::CreateParams(incognito_profile)); |
1328 browser()->host_desktop_type())); | |
1329 content::WindowedNotificationObserver observer( | 1328 content::WindowedNotificationObserver observer( |
1330 content::NOTIFICATION_LOAD_STOP, | 1329 content::NOTIFICATION_LOAD_STOP, |
1331 content::NotificationService::AllSources()); | 1330 content::NotificationService::AllSources()); |
1332 chrome::AddSelectedTabWithURL(incognito_browser, url, | 1331 chrome::AddSelectedTabWithURL(incognito_browser, url, |
1333 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); | 1332 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); |
1334 observer.Wait(); | 1333 observer.Wait(); |
1335 incognito_browser->window()->Show(); | 1334 incognito_browser->window()->Show(); |
1336 | 1335 |
1337 // Open the find box and make sure that it is prepopulated with "page". | 1336 // Open the find box and make sure that it is prepopulated with "page". |
1338 EnsureFindBoxOpenForBrowser(incognito_browser); | 1337 EnsureFindBoxOpenForBrowser(incognito_browser); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 | 1378 |
1380 // End the find session, click on the link. | 1379 // End the find session, click on the link. |
1381 content::WindowedNotificationObserver observer( | 1380 content::WindowedNotificationObserver observer( |
1382 content::NOTIFICATION_LOAD_STOP, | 1381 content::NOTIFICATION_LOAD_STOP, |
1383 content::Source<NavigationController>(&web_contents->GetController())); | 1382 content::Source<NavigationController>(&web_contents->GetController())); |
1384 find_tab_helper->StopFinding(FindBarController::kActivateSelectionOnPage); | 1383 find_tab_helper->StopFinding(FindBarController::kActivateSelectionOnPage); |
1385 observer.Wait(); | 1384 observer.Wait(); |
1386 } | 1385 } |
1387 | 1386 |
1388 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FitWindow) { | 1387 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FitWindow) { |
1389 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile(), | 1388 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile()); |
1390 browser()->host_desktop_type()); | |
1391 params.initial_bounds = gfx::Rect(0, 0, 250, 500); | 1389 params.initial_bounds = gfx::Rect(0, 0, 250, 500); |
1392 Browser* popup = new Browser(params); | 1390 Browser* popup = new Browser(params); |
1393 content::WindowedNotificationObserver observer( | 1391 content::WindowedNotificationObserver observer( |
1394 content::NOTIFICATION_LOAD_STOP, | 1392 content::NOTIFICATION_LOAD_STOP, |
1395 content::NotificationService::AllSources()); | 1393 content::NotificationService::AllSources()); |
1396 chrome::AddSelectedTabWithURL( | 1394 chrome::AddSelectedTabWithURL( |
1397 popup, GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK); | 1395 popup, GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK); |
1398 // Wait for the page to finish loading. | 1396 // Wait for the page to finish loading. |
1399 observer.Wait(); | 1397 observer.Wait(); |
1400 popup->window()->Show(); | 1398 popup->window()->Show(); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 | 1553 |
1556 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); | 1554 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); |
1557 WebContents* web_contents_incognito = | 1555 WebContents* web_contents_incognito = |
1558 browser_incognito->tab_strip_model()->GetActiveWebContents(); | 1556 browser_incognito->tab_strip_model()->GetActiveWebContents(); |
1559 ui_test_utils::FindInPageNotificationObserver observer( | 1557 ui_test_utils::FindInPageNotificationObserver observer( |
1560 web_contents_incognito); | 1558 web_contents_incognito); |
1561 observer.Wait(); | 1559 observer.Wait(); |
1562 EXPECT_EQ(ASCIIToUTF16("bar"), | 1560 EXPECT_EQ(ASCIIToUTF16("bar"), |
1563 GetFindBarTextForBrowser(browser_incognito)); | 1561 GetFindBarTextForBrowser(browser_incognito)); |
1564 } | 1562 } |
OLD | NEW |