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 "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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/renderer_host/render_view_host.h" | 10 #include "chrome/browser/renderer_host/render_view_host.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // The search string is present but doesn't qualify to be found | 441 |
442 EXPECT_EQ(0, FindInPageWchar(tab, L"text", | 442 int match_count = |
443 kFwd, kIgnoreCase, &ordinal)); | 443 FindInPageWchar(tab, L"text", kFwd, kIgnoreCase, &ordinal); |
444 // With zero results there should be no current selection. | 444 // TODO(finnur): These two values are currently 0 and 0 but will change to |
445 EXPECT_EQ(0, ordinal); | 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); |
446 } | 450 } |
447 | 451 |
448 // Try to reproduce the crash seen in issue 1341577. | 452 // Try to reproduce the crash seen in issue 1341577. |
449 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) { | 453 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindCrash_Issue1341577) { |
450 ASSERT_TRUE(test_server()->Start()); | 454 ASSERT_TRUE(test_server()->Start()); |
451 | 455 |
452 // First we navigate to our page. | 456 // First we navigate to our page. |
453 GURL url = test_server()->GetURL(kCrashPage); | 457 GURL url = test_server()->GetURL(kCrashPage); |
454 ui_test_utils::NavigateToURL(browser(), url); | 458 ui_test_utils::NavigateToURL(browser(), url); |
455 | 459 |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 | 1079 |
1076 TabContents* tab = browser()->GetSelectedTabContents(); | 1080 TabContents* tab = browser()->GetSelectedTabContents(); |
1077 int ordinal = 0; | 1081 int ordinal = 0; |
1078 FindInPageWchar(tab, L"link", kFwd, kIgnoreCase, &ordinal); | 1082 FindInPageWchar(tab, L"link", kFwd, kIgnoreCase, &ordinal); |
1079 EXPECT_EQ(ordinal, 1); | 1083 EXPECT_EQ(ordinal, 1); |
1080 | 1084 |
1081 // End the find session, click on the link. | 1085 // End the find session, click on the link. |
1082 tab->StopFinding(FindBarController::kActivateSelection); | 1086 tab->StopFinding(FindBarController::kActivateSelection); |
1083 EXPECT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); | 1087 EXPECT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
1084 } | 1088 } |
OLD | NEW |