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/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser())); | 1326 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser())); |
1327 | 1327 |
1328 // Close the Find box. | 1328 // Close the Find box. |
1329 browser()->GetFindBarController()->EndFindSession( | 1329 browser()->GetFindBarController()->EndFindSession( |
1330 FindBarController::kKeepSelectionOnPage, | 1330 FindBarController::kKeepSelectionOnPage, |
1331 FindBarController::kKeepResultsInFindBox); | 1331 FindBarController::kKeepResultsInFindBox); |
1332 | 1332 |
1333 // Open a new incognito window and navigate to the same page. | 1333 // Open a new incognito window and navigate to the same page. |
1334 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); | 1334 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
1335 Browser* incognito_browser = | 1335 Browser* incognito_browser = |
1336 new Browser(Browser::CreateParams(incognito_profile)); | 1336 new Browser(Browser::CreateParams(incognito_profile, true)); |
1337 content::WindowedNotificationObserver observer( | 1337 content::WindowedNotificationObserver observer( |
1338 content::NOTIFICATION_LOAD_STOP, | 1338 content::NOTIFICATION_LOAD_STOP, |
1339 content::NotificationService::AllSources()); | 1339 content::NotificationService::AllSources()); |
1340 chrome::AddSelectedTabWithURL(incognito_browser, url, | 1340 chrome::AddSelectedTabWithURL(incognito_browser, url, |
1341 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); | 1341 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); |
1342 observer.Wait(); | 1342 observer.Wait(); |
1343 incognito_browser->window()->Show(); | 1343 incognito_browser->window()->Show(); |
1344 | 1344 |
1345 // Open the find box and make sure that it is prepopulated with "page". | 1345 // Open the find box and make sure that it is prepopulated with "page". |
1346 EnsureFindBoxOpenForBrowser(incognito_browser); | 1346 EnsureFindBoxOpenForBrowser(incognito_browser); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 | 1387 |
1388 // End the find session, click on the link. | 1388 // End the find session, click on the link. |
1389 content::WindowedNotificationObserver observer( | 1389 content::WindowedNotificationObserver observer( |
1390 content::NOTIFICATION_LOAD_STOP, | 1390 content::NOTIFICATION_LOAD_STOP, |
1391 content::Source<NavigationController>(&web_contents->GetController())); | 1391 content::Source<NavigationController>(&web_contents->GetController())); |
1392 find_tab_helper->StopFinding(FindBarController::kActivateSelectionOnPage); | 1392 find_tab_helper->StopFinding(FindBarController::kActivateSelectionOnPage); |
1393 observer.Wait(); | 1393 observer.Wait(); |
1394 } | 1394 } |
1395 | 1395 |
1396 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FitWindow) { | 1396 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FitWindow) { |
1397 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile()); | 1397 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile(), true); |
1398 params.initial_bounds = gfx::Rect(0, 0, 250, 500); | 1398 params.initial_bounds = gfx::Rect(0, 0, 250, 500); |
1399 Browser* popup = new Browser(params); | 1399 Browser* popup = new Browser(params); |
1400 content::WindowedNotificationObserver observer( | 1400 content::WindowedNotificationObserver observer( |
1401 content::NOTIFICATION_LOAD_STOP, | 1401 content::NOTIFICATION_LOAD_STOP, |
1402 content::NotificationService::AllSources()); | 1402 content::NotificationService::AllSources()); |
1403 chrome::AddSelectedTabWithURL( | 1403 chrome::AddSelectedTabWithURL( |
1404 popup, GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK); | 1404 popup, GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK); |
1405 // Wait for the page to finish loading. | 1405 // Wait for the page to finish loading. |
1406 observer.Wait(); | 1406 observer.Wait(); |
1407 popup->window()->Show(); | 1407 popup->window()->Show(); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1562 | 1562 |
1563 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); | 1563 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); |
1564 WebContents* web_contents_incognito = | 1564 WebContents* web_contents_incognito = |
1565 browser_incognito->tab_strip_model()->GetActiveWebContents(); | 1565 browser_incognito->tab_strip_model()->GetActiveWebContents(); |
1566 ui_test_utils::FindInPageNotificationObserver observer( | 1566 ui_test_utils::FindInPageNotificationObserver observer( |
1567 web_contents_incognito); | 1567 web_contents_incognito); |
1568 observer.Wait(); | 1568 observer.Wait(); |
1569 EXPECT_EQ(ASCIIToUTF16("bar"), | 1569 EXPECT_EQ(ASCIIToUTF16("bar"), |
1570 GetFindBarTextForBrowser(browser_incognito)); | 1570 GetFindBarTextForBrowser(browser_incognito)); |
1571 } | 1571 } |
OLD | NEW |