| 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 "base/keyboard_codes.h" | 5 #include "base/keyboard_codes.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/browser/browser_window.h" | 8 #include "chrome/browser/browser_window.h" |
| 9 #include "chrome/browser/find_bar_controller.h" | 9 #include "chrome/browser/find_bar_controller.h" |
| 10 #include "chrome/browser/find_notification_details.h" | 10 #include "chrome/browser/find_notification_details.h" |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 EXPECT_TRUE(fully_visible); | 585 EXPECT_TRUE(fully_visible); |
| 586 | 586 |
| 587 // If the Find box has moved then we are done. | 587 // If the Find box has moved then we are done. |
| 588 if (position.x() != start_position.x()) | 588 if (position.x() != start_position.x()) |
| 589 break; | 589 break; |
| 590 } | 590 } |
| 591 | 591 |
| 592 // We should not have reached the end. | 592 // We should not have reached the end. |
| 593 ASSERT_GT(kMoveIterations, index); | 593 ASSERT_GT(kMoveIterations, index); |
| 594 | 594 |
| 595 // Search backwards once to get the Find box to move back. | 595 // Search for something guaranteed not to be obscured by the Find box. |
| 596 EXPECT_EQ(kMoveIterations, FindInPageWchar(tab, L"Chromium", | 596 EXPECT_EQ(1, FindInPageWchar(tab, L"Done", |
| 597 kBack, kIgnoreCase, &ordinal)); | 597 kFwd, kIgnoreCase, &ordinal)); |
| 598 // Check the position. | 598 // Check the position. |
| 599 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); | 599 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); |
| 600 EXPECT_TRUE(fully_visible); | 600 EXPECT_TRUE(fully_visible); |
| 601 | 601 |
| 602 // Make sure Find box has moved back to its original location. | 602 // Make sure Find box has moved back to its original location. |
| 603 EXPECT_EQ(position.x(), start_position.x()); | 603 EXPECT_EQ(position.x(), start_position.x()); |
| 604 } | 604 } |
| 605 | 605 |
| 606 // Make sure F3 in a new tab works if Find has previous string to search for. | 606 // Make sure F3 in a new tab works if Find has previous string to search for. |
| 607 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, | 607 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 // Find "given". | 785 // Find "given". |
| 786 FindInPageWchar(tab2, L"given", kFwd, kIgnoreCase, &ordinal); | 786 FindInPageWchar(tab2, L"given", kFwd, kIgnoreCase, &ordinal); |
| 787 | 787 |
| 788 // Switch back to first tab. | 788 // Switch back to first tab. |
| 789 browser()->SelectTabContentsAt(0, false); | 789 browser()->SelectTabContentsAt(0, false); |
| 790 browser()->GetFindBarController()->EndFindSession(); | 790 browser()->GetFindBarController()->EndFindSession(); |
| 791 // Simulate F3. | 791 // Simulate F3. |
| 792 ui_test_utils::FindInPage(tab1, string16(), kFwd, kIgnoreCase, &ordinal); | 792 ui_test_utils::FindInPage(tab1, string16(), kFwd, kIgnoreCase, &ordinal); |
| 793 EXPECT_EQ(tab1->find_text(), WideToUTF16(L"Default")); | 793 EXPECT_EQ(tab1->find_text(), WideToUTF16(L"Default")); |
| 794 } | 794 } |
| OLD | NEW |