| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/renderer_host/render_view_host.h" | 9 #include "chrome/browser/renderer_host/render_view_host.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 EXPECT_EQ(0, FindInPageWchar(tab, L"goa ", | 422 EXPECT_EQ(0, FindInPageWchar(tab, L"goa ", |
| 423 kFwd, kIgnoreCase, &ordinal)); | 423 kFwd, kIgnoreCase, &ordinal)); |
| 424 EXPECT_EQ(0, ordinal); | 424 EXPECT_EQ(0, ordinal); |
| 425 // Remove the space, should be back to '3 out of 6') | 425 // Remove the space, should be back to '3 out of 6') |
| 426 EXPECT_EQ(6, FindInPageWchar(tab, L"goa", | 426 EXPECT_EQ(6, FindInPageWchar(tab, L"goa", |
| 427 kFwd, kIgnoreCase, &ordinal)); | 427 kFwd, kIgnoreCase, &ordinal)); |
| 428 EXPECT_EQ(3, ordinal); | 428 EXPECT_EQ(3, ordinal); |
| 429 } | 429 } |
| 430 | 430 |
| 431 // Load a page with no selectable text and make sure we don't crash. | 431 // Load a page with no selectable text and make sure we don't crash. |
| 432 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindUnSelectableText) { | 432 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindUnselectableText) { |
| 433 ASSERT_TRUE(test_server()->Start()); | 433 ASSERT_TRUE(test_server()->Start()); |
| 434 | 434 |
| 435 // First we navigate to our page. | 435 // First we navigate to our page. |
| 436 GURL url = test_server()->GetURL(kUserSelectPage); | 436 GURL url = test_server()->GetURL(kUserSelectPage); |
| 437 ui_test_utils::NavigateToURL(browser(), url); | 437 ui_test_utils::NavigateToURL(browser(), url); |
| 438 | 438 |
| 439 int ordinal = 0; | 439 int ordinal = 0; |
| 440 TabContents* tab = browser()->GetSelectedTabContents(); | 440 TabContents* tab = browser()->GetSelectedTabContents(); |
| 441 | 441 EXPECT_EQ(1, FindInPageWchar(tab, L"text", kFwd, kIgnoreCase, &ordinal)); |
| 442 int match_count = | 442 EXPECT_EQ(1, ordinal); |
| 443 FindInPageWchar(tab, L"text", kFwd, kIgnoreCase, &ordinal); | |
| 444 // TODO(finnur): These two values are currently 0 and 0 but will change to | |
| 445 // 1 and 1 when we merge down a fix for un-selectable text in patch from | |
| 446 // revision 75784 (https://bugs.webkit.org/show_bug.cgi?id=52367). Once the | |
| 447 // patch has been rolled into Chromium I'll change this back to check for 1 | |
| 448 // explicitly (as opposed to using equality). | |
| 449 EXPECT_EQ(match_count, ordinal); | |
| 450 } | 443 } |
| 451 | 444 |
| 452 // Try to reproduce the crash seen in issue 1341577. | 445 // Try to reproduce the crash seen in issue 1341577. |
| 453 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) { | 446 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) { |
| 454 ASSERT_TRUE(test_server()->Start()); | 447 ASSERT_TRUE(test_server()->Start()); |
| 455 | 448 |
| 456 // First we navigate to our page. | 449 // First we navigate to our page. |
| 457 GURL url = test_server()->GetURL(kCrashPage); | 450 GURL url = test_server()->GetURL(kCrashPage); |
| 458 ui_test_utils::NavigateToURL(browser(), url); | 451 ui_test_utils::NavigateToURL(browser(), url); |
| 459 | 452 |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 | 1072 |
| 1080 TabContents* tab = browser()->GetSelectedTabContents(); | 1073 TabContents* tab = browser()->GetSelectedTabContents(); |
| 1081 int ordinal = 0; | 1074 int ordinal = 0; |
| 1082 FindInPageWchar(tab, L"link", kFwd, kIgnoreCase, &ordinal); | 1075 FindInPageWchar(tab, L"link", kFwd, kIgnoreCase, &ordinal); |
| 1083 EXPECT_EQ(ordinal, 1); | 1076 EXPECT_EQ(ordinal, 1); |
| 1084 | 1077 |
| 1085 // End the find session, click on the link. | 1078 // End the find session, click on the link. |
| 1086 tab->StopFinding(FindBarController::kActivateSelection); | 1079 tab->StopFinding(FindBarController::kActivateSelection); |
| 1087 EXPECT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 1080 EXPECT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
| 1088 } | 1081 } |
| OLD | NEW |