| 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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 // Make sure it is open. | 857 // Make sure it is open. |
| 858 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); | 858 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); |
| 859 EXPECT_TRUE(fully_visible); | 859 EXPECT_TRUE(fully_visible); |
| 860 | 860 |
| 861 // Reload and make sure the find window goes away. | 861 // Reload and make sure the find window goes away. |
| 862 content::WindowedNotificationObserver observer( | 862 content::WindowedNotificationObserver observer( |
| 863 content::NOTIFICATION_LOAD_STOP, | 863 content::NOTIFICATION_LOAD_STOP, |
| 864 content::Source<NavigationController>( | 864 content::Source<NavigationController>( |
| 865 &browser()->tab_strip_model()->GetActiveWebContents()-> | 865 &browser()->tab_strip_model()->GetActiveWebContents()-> |
| 866 GetController())); | 866 GetController())); |
| 867 chrome::Reload(browser(), CURRENT_TAB); | 867 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
| 868 observer.Wait(); | 868 observer.Wait(); |
| 869 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); | 869 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); |
| 870 EXPECT_FALSE(fully_visible); | 870 EXPECT_FALSE(fully_visible); |
| 871 | 871 |
| 872 // Open the find bar again. | 872 // Open the find bar again. |
| 873 chrome::ShowFindBar(browser()); | 873 chrome::ShowFindBar(browser()); |
| 874 | 874 |
| 875 // Make sure it is open. | 875 // Make sure it is open. |
| 876 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); | 876 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); |
| 877 EXPECT_TRUE(fully_visible); | 877 EXPECT_TRUE(fully_visible); |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 FindMovesOnTabClose_Issue1343052) { | 1413 FindMovesOnTabClose_Issue1343052) { |
| 1414 EnsureFindBoxOpen(); | 1414 EnsureFindBoxOpen(); |
| 1415 content::RunAllPendingInMessageLoop(); // Needed on Linux. | 1415 content::RunAllPendingInMessageLoop(); // Needed on Linux. |
| 1416 | 1416 |
| 1417 gfx::Point position; | 1417 gfx::Point position; |
| 1418 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); | 1418 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); |
| 1419 | 1419 |
| 1420 // Open another tab. | 1420 // Open another tab. |
| 1421 GURL url = GetURL(kSimple); | 1421 GURL url = GetURL(kSimple); |
| 1422 ui_test_utils::NavigateToURLWithDisposition( | 1422 ui_test_utils::NavigateToURLWithDisposition( |
| 1423 browser(), url, NEW_FOREGROUND_TAB, | 1423 browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 1424 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1424 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 1425 | 1425 |
| 1426 // Close it. | 1426 // Close it. |
| 1427 chrome::CloseTab(browser()); | 1427 chrome::CloseTab(browser()); |
| 1428 | 1428 |
| 1429 // See if the Find window has moved. | 1429 // See if the Find window has moved. |
| 1430 gfx::Point position2; | 1430 gfx::Point position2; |
| 1431 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); | 1431 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); |
| 1432 EXPECT_EQ(position, position2); | 1432 EXPECT_EQ(position, position2); |
| 1433 | 1433 |
| 1434 // Toggle the bookmark bar state. Note that this starts an animation, and | 1434 // Toggle the bookmark bar state. Note that this starts an animation, and |
| 1435 // there isn't a good way other than looping and polling to see when it's | 1435 // there isn't a good way other than looping and polling to see when it's |
| 1436 // done. So instead we change the state and open a new tab, since the new tab | 1436 // done. So instead we change the state and open a new tab, since the new tab |
| 1437 // animation doesn't happen on tab change. | 1437 // animation doesn't happen on tab change. |
| 1438 chrome::ToggleBookmarkBar(browser()); | 1438 chrome::ToggleBookmarkBar(browser()); |
| 1439 | 1439 |
| 1440 ui_test_utils::NavigateToURLWithDisposition( | 1440 ui_test_utils::NavigateToURLWithDisposition( |
| 1441 browser(), url, NEW_FOREGROUND_TAB, | 1441 browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 1442 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1442 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 1443 | 1443 |
| 1444 EnsureFindBoxOpen(); | 1444 EnsureFindBoxOpen(); |
| 1445 content::RunAllPendingInMessageLoop(); // Needed on Linux. | 1445 content::RunAllPendingInMessageLoop(); // Needed on Linux. |
| 1446 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); | 1446 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); |
| 1447 | 1447 |
| 1448 ui_test_utils::NavigateToURLWithDisposition( | 1448 ui_test_utils::NavigateToURLWithDisposition( |
| 1449 browser(), url, NEW_FOREGROUND_TAB, | 1449 browser(), url, WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 1450 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1450 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 1451 chrome::CloseTab(browser()); | 1451 chrome::CloseTab(browser()); |
| 1452 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); | 1452 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); |
| 1453 EXPECT_EQ(position, position2); | 1453 EXPECT_EQ(position, position2); |
| 1454 } | 1454 } |
| 1455 | 1455 |
| 1456 // Verify that if there's a global pasteboard (for example on Mac) then doing | 1456 // Verify that if there's a global pasteboard (for example on Mac) then doing |
| 1457 // a search on one tab will clear the matches label on the other tabs. | 1457 // a search on one tab will clear the matches label on the other tabs. |
| 1458 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, | 1458 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, |
| 1459 GlobalPasteBoardClearMatches) { | 1459 GlobalPasteBoardClearMatches) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |