Chromium Code Reviews| 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 "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 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 832 browser()->tab_strip_model()->GetActiveWebContents(); | 832 browser()->tab_strip_model()->GetActiveWebContents(); |
| 833 ASSERT_TRUE(NULL != web_contents); | 833 ASSERT_TRUE(NULL != web_contents); |
| 834 | 834 |
| 835 // Search for a text that exists within a link on the page. | 835 // Search for a text that exists within a link on the page. |
| 836 int ordinal = 0; | 836 int ordinal = 0; |
| 837 EXPECT_EQ(2, FindInPageWchar(web_contents, L"html ", | 837 EXPECT_EQ(2, FindInPageWchar(web_contents, L"html ", |
| 838 kFwd, kIgnoreCase, &ordinal)); | 838 kFwd, kIgnoreCase, &ordinal)); |
| 839 EXPECT_EQ(1, ordinal); | 839 EXPECT_EQ(1, ordinal); |
| 840 } | 840 } |
| 841 | 841 |
| 842 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindDisappearOnNavigate) { | 842 // This test will verify that the Find bar should disappear |
|
msw
2014/09/08 18:16:55
nit: consider: "Verify that the find bar is hidden
Deepak
2014/09/09 03:56:06
Done.
| |
| 843 // on reload and on navigation. | |
| 844 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, | |
| 845 FindDisappearOnNavigateAndReload) { | |
|
msw
2014/09/08 18:16:55
nit: HideFindOnNavigateAndReload fits on the line
Deepak
2014/09/09 03:56:06
Done.
| |
| 843 // First we navigate to our special focus tracking page. | 846 // First we navigate to our special focus tracking page. |
| 844 GURL url = GetURL(kSimple); | 847 GURL url = GetURL(kSimple); |
| 845 GURL url2 = GetURL(kFramePage); | 848 GURL url2 = GetURL(kFramePage); |
| 846 ui_test_utils::NavigateToURL(browser(), url); | 849 ui_test_utils::NavigateToURL(browser(), url); |
| 847 | 850 |
| 848 chrome::ShowFindBar(browser()); | 851 chrome::ShowFindBar(browser()); |
| 849 | 852 |
| 850 gfx::Point position; | 853 gfx::Point position; |
| 851 bool fully_visible = false; | 854 bool fully_visible = false; |
| 852 | 855 |
| 853 // Make sure it is open. | 856 // Make sure it is open. |
| 854 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); | 857 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); |
| 855 EXPECT_TRUE(fully_visible); | 858 EXPECT_TRUE(fully_visible); |
| 856 | 859 |
| 857 // Reload the tab and make sure Find window doesn't go away. | 860 // Reload and make sure the Find window goes away. |
|
msw
2014/09/08 18:16:55
nit: s/Find/find
Deepak
2014/09/09 03:56:06
Done.
| |
| 858 content::WindowedNotificationObserver observer( | 861 content::WindowedNotificationObserver observer( |
| 859 content::NOTIFICATION_LOAD_STOP, | 862 content::NOTIFICATION_LOAD_STOP, |
| 860 content::Source<NavigationController>( | 863 content::Source<NavigationController>( |
| 861 &browser()->tab_strip_model()->GetActiveWebContents()-> | 864 &browser()->tab_strip_model()->GetActiveWebContents()-> |
| 862 GetController())); | 865 GetController())); |
| 863 chrome::Reload(browser(), CURRENT_TAB); | 866 chrome::Reload(browser(), CURRENT_TAB); |
| 864 observer.Wait(); | 867 observer.Wait(); |
| 868 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); | |
| 869 EXPECT_FALSE(fully_visible); | |
| 865 | 870 |
| 871 // Opening Findbar again. | |
|
msw
2014/09/08 18:16:55
nit: "Open the find bar again." Or remove this sup
Deepak
2014/09/09 03:56:06
Done.
msw
2014/09/09 04:25:03
You missed this nit; the comment should read. "Ope
| |
| 872 chrome::ShowFindBar(browser()); | |
| 873 | |
| 874 // Make sure it is open. | |
| 866 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); | 875 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); |
| 867 EXPECT_TRUE(fully_visible); | 876 EXPECT_TRUE(fully_visible); |
| 868 | 877 |
| 869 // Navigate and make sure the Find window goes away. | 878 // Navigate and make sure the Find window goes away. |
| 870 ui_test_utils::NavigateToURL(browser(), url2); | 879 ui_test_utils::NavigateToURL(browser(), url2); |
| 871 | 880 |
| 872 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); | 881 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); |
| 873 EXPECT_FALSE(fully_visible); | 882 EXPECT_FALSE(fully_visible); |
| 874 } | 883 } |
| 875 | 884 |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1545 | 1554 |
| 1546 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); | 1555 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); |
| 1547 WebContents* web_contents_incognito = | 1556 WebContents* web_contents_incognito = |
| 1548 browser_incognito->tab_strip_model()->GetActiveWebContents(); | 1557 browser_incognito->tab_strip_model()->GetActiveWebContents(); |
| 1549 ui_test_utils::FindInPageNotificationObserver observer( | 1558 ui_test_utils::FindInPageNotificationObserver observer( |
| 1550 web_contents_incognito); | 1559 web_contents_incognito); |
| 1551 observer.Wait(); | 1560 observer.Wait(); |
| 1552 EXPECT_EQ(ASCIIToUTF16("bar"), | 1561 EXPECT_EQ(ASCIIToUTF16("bar"), |
| 1553 GetFindBarTextForBrowser(browser_incognito)); | 1562 GetFindBarTextForBrowser(browser_incognito)); |
| 1554 } | 1563 } |
| OLD | NEW |