| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/keyboard_codes.h" | 5 #include "app/keyboard_codes.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
| 10 #include "chrome/browser/browser_window.h" | 10 #include "chrome/browser/browser_window.h" |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 // This string appears 5 times at the bottom of a long page. If Find restarts | 495 // This string appears 5 times at the bottom of a long page. If Find restarts |
| 496 // properly after a timeout, it will find 5 matches, not just 1. | 496 // properly after a timeout, it will find 5 matches, not just 1. |
| 497 int ordinal = 0; | 497 int ordinal = 0; |
| 498 EXPECT_EQ(5, FindInPageWchar(browser()->GetSelectedTabContents(), | 498 EXPECT_EQ(5, FindInPageWchar(browser()->GetSelectedTabContents(), |
| 499 L"008.xml", | 499 L"008.xml", |
| 500 kFwd, kIgnoreCase, &ordinal)); | 500 kFwd, kIgnoreCase, &ordinal)); |
| 501 EXPECT_EQ(1, ordinal); | 501 EXPECT_EQ(1, ordinal); |
| 502 } | 502 } |
| 503 | 503 |
| 504 // This tests bug 11761: FindInPage terminates search prematurely. | 504 // This tests bug 11761: FindInPage terminates search prematurely. |
| 505 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FAILS_FindInPagePrematureEnd) { | 505 // This test is not expected to pass until bug 11761 is fixed. |
| 506 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, |
| 507 DISABLED_FindInPagePrematureEnd) { |
| 506 ASSERT_TRUE(test_server()->Start()); | 508 ASSERT_TRUE(test_server()->Start()); |
| 507 | 509 |
| 508 // First we navigate to our special focus tracking page. | 510 // First we navigate to our special focus tracking page. |
| 509 GURL url = test_server()->GetURL(kPrematureEnd); | 511 GURL url = test_server()->GetURL(kPrematureEnd); |
| 510 ui_test_utils::NavigateToURL(browser(), url); | 512 ui_test_utils::NavigateToURL(browser(), url); |
| 511 | 513 |
| 512 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 514 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
| 513 ASSERT_TRUE(NULL != tab_contents); | 515 ASSERT_TRUE(NULL != tab_contents); |
| 514 | 516 |
| 515 // Search for a text that exists within a link on the page. | 517 // Search for a text that exists within a link on the page. |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 | 978 |
| 977 // After the Find box has been reopened, it should have been prepopulated with | 979 // After the Find box has been reopened, it should have been prepopulated with |
| 978 // the word "page" again, since that was the last search in that tab. | 980 // the word "page" again, since that was the last search in that tab. |
| 979 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText()); | 981 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText()); |
| 980 } | 982 } |
| 981 | 983 |
| 982 // TODO(rohitrao): Searching in incognito tabs does not work in browser tests in | 984 // TODO(rohitrao): Searching in incognito tabs does not work in browser tests in |
| 983 // linux views. Investigate and fix. http://crbug.com/40948 | 985 // linux views. Investigate and fix. http://crbug.com/40948 |
| 984 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) | 986 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) |
| 985 #define MAYBE_NoIncognitoPrepopulate DISABLED_NoIncognitoPrepopulate | 987 #define MAYBE_NoIncognitoPrepopulate DISABLED_NoIncognitoPrepopulate |
| 986 #elif defined (OS_WIN) | |
| 987 // On windows, this test is flaky. http://crbug.com/40948 | |
| 988 #define MAYBE_NoIncognitoPrepopulate FLAKY_NoIncognitoPrepopulate | |
| 989 #else | 988 #else |
| 990 #define MAYBE_NoIncognitoPrepopulate NoIncognitoPrepopulate | 989 #define MAYBE_NoIncognitoPrepopulate NoIncognitoPrepopulate |
| 991 #endif | 990 #endif |
| 992 | 991 |
| 993 // This tests that search terms entered into an incognito find bar are not used | 992 // This tests that search terms entered into an incognito find bar are not used |
| 994 // as prepopulate terms for non-incognito windows. | 993 // as prepopulate terms for non-incognito windows. |
| 995 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) { | 994 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_NoIncognitoPrepopulate) { |
| 996 #if defined(OS_MACOSX) | 995 #if defined(OS_MACOSX) |
| 997 // FindInPage on Mac doesn't use prepopulated values. Search there is global. | 996 // FindInPage on Mac doesn't use prepopulated values. Search there is global. |
| 998 return; | 997 return; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 browser()->SelectTabContentsAt(1, false); | 1050 browser()->SelectTabContentsAt(1, false); |
| 1052 TabContents* tab2 = browser()->GetSelectedTabContents(); | 1051 TabContents* tab2 = browser()->GetSelectedTabContents(); |
| 1053 EXPECT_NE(tab1, tab2); | 1052 EXPECT_NE(tab1, tab2); |
| 1054 | 1053 |
| 1055 // Open the Find box and make sure it is prepopulated with the search term | 1054 // Open the Find box and make sure it is prepopulated with the search term |
| 1056 // from the original browser, not the search term from the incognito window. | 1055 // from the original browser, not the search term from the incognito window. |
| 1057 EnsureFindBoxOpenForBrowser(browser()); | 1056 EnsureFindBoxOpenForBrowser(browser()); |
| 1058 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser())); | 1057 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(browser())); |
| 1059 } | 1058 } |
| 1060 | 1059 |
| 1061 // See http://crbug.com/45594. On Windows, it crashes sometimes. | |
| 1062 #if defined(OS_WIN) | |
| 1063 #define MAYBE_ActivateLinkNavigatesPage DISABLED_ActivateLinkNavigatesPage | |
| 1064 #else | |
| 1065 #define MAYBE_ActivateLinkNavigatesPage ActivateLinkNavigatesPage | |
| 1066 #endif | |
| 1067 // This makes sure that dismissing the find bar with kActivateSelection works. | 1060 // This makes sure that dismissing the find bar with kActivateSelection works. |
| 1068 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, | 1061 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, ActivateLinkNavigatesPage) { |
| 1069 MAYBE_ActivateLinkNavigatesPage) { | |
| 1070 ASSERT_TRUE(test_server()->Start()); | 1062 ASSERT_TRUE(test_server()->Start()); |
| 1071 | 1063 |
| 1072 // First we navigate to our test content. | 1064 // First we navigate to our test content. |
| 1073 GURL url = test_server()->GetURL(kLinkPage); | 1065 GURL url = test_server()->GetURL(kLinkPage); |
| 1074 ui_test_utils::NavigateToURL(browser(), url); | 1066 ui_test_utils::NavigateToURL(browser(), url); |
| 1075 | 1067 |
| 1076 TabContents* tab = browser()->GetSelectedTabContents(); | 1068 TabContents* tab = browser()->GetSelectedTabContents(); |
| 1077 int ordinal = 0; | 1069 int ordinal = 0; |
| 1078 FindInPageWchar(tab, L"link", kFwd, kIgnoreCase, &ordinal); | 1070 FindInPageWchar(tab, L"link", kFwd, kIgnoreCase, &ordinal); |
| 1079 EXPECT_EQ(ordinal, 1); | 1071 EXPECT_EQ(ordinal, 1); |
| 1080 | 1072 |
| 1081 // End the find session, click on the link. | 1073 // End the find session, click on the link. |
| 1082 tab->StopFinding(FindBarController::kActivateSelection); | 1074 tab->StopFinding(FindBarController::kActivateSelection); |
| 1083 EXPECT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 1075 EXPECT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
| 1084 } | 1076 } |
| OLD | NEW |