| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 kFwd, kIgnoreCase, &ordinal)); | 559 kFwd, kIgnoreCase, &ordinal)); |
| 560 EXPECT_EQ(1, ordinal); | 560 EXPECT_EQ(1, ordinal); |
| 561 | 561 |
| 562 // Make sure Find box has moved. | 562 // Make sure Find box has moved. |
| 563 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); | 563 EXPECT_TRUE(GetFindBarWindowInfo(&position, &fully_visible)); |
| 564 EXPECT_TRUE(fully_visible); | 564 EXPECT_TRUE(fully_visible); |
| 565 EXPECT_EQ(start_position.y(), position.y()); | 565 EXPECT_EQ(start_position.y(), position.y()); |
| 566 if (start_position.x() == position.x()) { | 566 if (start_position.x() == position.x()) { |
| 567 // Failure case. Try to gather more data. | 567 // Failure case. Try to gather more data. |
| 568 std::string debug_msg = "Position check failed once. "; | 568 std::string debug_msg = "Position check failed once. "; |
| 569 |
| 570 // First see if flushing the message loop has any effect. |
| 571 MessageLoop::current()->RunAllPending(); |
| 572 |
| 569 if (!GetFindBarWindowInfo(&position, &fully_visible)) { | 573 if (!GetFindBarWindowInfo(&position, &fully_visible)) { |
| 570 debug_msg += "Get failed. "; | 574 debug_msg += "Get failed. "; |
| 571 } else { | 575 } else { |
| 572 if (start_position.x() == position.x()) | 576 if (start_position.x() == position.x()) |
| 573 debug_msg += "Still the same. "; | 577 debug_msg += "Position check failed again. "; |
| 574 else | 578 else |
| 575 debug_msg += "They now differ. "; | 579 debug_msg += "They now differ. "; |
| 576 } | 580 } |
| 577 // Force the failure. | 581 // Force the failure. |
| 578 EXPECT_STREQ("", debug_msg.c_str()); | 582 EXPECT_STREQ("", debug_msg.c_str()); |
| 579 } | 583 } |
| 580 EXPECT_NE(start_position.x(), position.x()); | 584 EXPECT_NE(start_position.x(), position.x()); |
| 581 | 585 |
| 582 // Search for 'Too much' which the Find box is not obscuring. | 586 // Search for 'Too much' which the Find box is not obscuring. |
| 583 EXPECT_EQ(1, ui_test_utils::FindInPage(tab, L"Too much", | 587 EXPECT_EQ(1, ui_test_utils::FindInPage(tab, L"Too much", |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 // backspace, but that's been proven flaky in the past, so we go straight to | 684 // backspace, but that's been proven flaky in the past, so we go straight to |
| 681 // tab_contents. | 685 // tab_contents. |
| 682 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 686 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
| 683 // Stop the (non-existing) find operation, and clear the selection (which | 687 // Stop the (non-existing) find operation, and clear the selection (which |
| 684 // signals the UI is still active). | 688 // signals the UI is still active). |
| 685 tab_contents->StopFinding(true); | 689 tab_contents->StopFinding(true); |
| 686 // Make sure the Find UI flag hasn't been cleared, it must be so that the UI | 690 // Make sure the Find UI flag hasn't been cleared, it must be so that the UI |
| 687 // still responds to browser window resizing. | 691 // still responds to browser window resizing. |
| 688 ASSERT_TRUE(tab_contents->find_ui_active()); | 692 ASSERT_TRUE(tab_contents->find_ui_active()); |
| 689 } | 693 } |
| OLD | NEW |