| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 class FindInPageControllerTest : public InProcessBrowserTest { | 37 class FindInPageControllerTest : public InProcessBrowserTest { |
| 38 public: | 38 public: |
| 39 FindInPageControllerTest() { | 39 FindInPageControllerTest() { |
| 40 EnableDOMAutomation(); | 40 EnableDOMAutomation(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 void GetFindBarWindowInfo(gfx::Point* position, bool* fully_visible) { | 44 void GetFindBarWindowInfo(gfx::Point* position, bool* fully_visible) { |
| 45 FindBarTesting* find_bar = | 45 FindBarTesting* find_bar = |
| 46 browser()->find_bar()->find_bar()->GetFindBarTesting(); | 46 browser()->GetFindBarController()->find_bar()->GetFindBarTesting(); |
| 47 find_bar->GetFindBarWindowInfo(position, fully_visible); | 47 find_bar->GetFindBarWindowInfo(position, fully_visible); |
| 48 } | 48 } |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // This test loads a page with frames and starts FindInPage requests. | 51 // This test loads a page with frames and starts FindInPage requests. |
| 52 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageFrames) { | 52 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindInPageFrames) { |
| 53 HTTPTestServer* server = StartHTTPServer(); | 53 HTTPTestServer* server = StartHTTPServer(); |
| 54 | 54 |
| 55 // First we navigate to our frames page. | 55 // First we navigate to our frames page. |
| 56 GURL url = server->TestServerPageW(kFramePage); | 56 GURL url = server->TestServerPageW(kFramePage); |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 browser()->ShowFindBar(); | 598 browser()->ShowFindBar(); |
| 599 | 599 |
| 600 // Our Find bar should be the new target. | 600 // Our Find bar should be the new target. |
| 601 views::AcceleratorTarget* new_target = | 601 views::AcceleratorTarget* new_target = |
| 602 focus_manager->GetCurrentTargetForAccelerator(escape); | 602 focus_manager->GetCurrentTargetForAccelerator(escape); |
| 603 | 603 |
| 604 EXPECT_TRUE(new_target != NULL); | 604 EXPECT_TRUE(new_target != NULL); |
| 605 EXPECT_NE(new_target, old_target); | 605 EXPECT_NE(new_target, old_target); |
| 606 | 606 |
| 607 // Close the Find box. | 607 // Close the Find box. |
| 608 browser()->find_bar()->EndFindSession(); | 608 browser()->GetFindBarController()->EndFindSession(); |
| 609 | 609 |
| 610 // The accelerator for Escape should be back to what it was before. | 610 // The accelerator for Escape should be back to what it was before. |
| 611 EXPECT_EQ(old_target, focus_manager->GetCurrentTargetForAccelerator(escape)); | 611 EXPECT_EQ(old_target, focus_manager->GetCurrentTargetForAccelerator(escape)); |
| 612 } | 612 } |
| 613 | 613 |
| 614 // Make sure Find box does not become UI-inactive when no text is in the box as | 614 // Make sure Find box does not become UI-inactive when no text is in the box as |
| 615 // we switch to a tab contents with an empty find string. See issue 13570. | 615 // we switch to a tab contents with an empty find string. See issue 13570. |
| 616 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, StayActive) { | 616 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, StayActive) { |
| 617 HTTPTestServer* server = StartHTTPServer(); | 617 HTTPTestServer* server = StartHTTPServer(); |
| 618 | 618 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 629 // backspace, but that's been proven flaky in the past, so we go straight to | 629 // backspace, but that's been proven flaky in the past, so we go straight to |
| 630 // tab_contents. | 630 // tab_contents. |
| 631 TabContents* tab_contents = browser()->GetSelectedTabContents(); | 631 TabContents* tab_contents = browser()->GetSelectedTabContents(); |
| 632 // Stop the (non-existing) find operation, and clear the selection (which | 632 // Stop the (non-existing) find operation, and clear the selection (which |
| 633 // signals the UI is still active). | 633 // signals the UI is still active). |
| 634 tab_contents->StopFinding(true); | 634 tab_contents->StopFinding(true); |
| 635 // Make sure the Find UI flag hasn't been cleared, it must be so that the UI | 635 // Make sure the Find UI flag hasn't been cleared, it must be so that the UI |
| 636 // still responds to browser window resizing. | 636 // still responds to browser window resizing. |
| 637 ASSERT_TRUE(tab_contents->find_ui_active()); | 637 ASSERT_TRUE(tab_contents->find_ui_active()); |
| 638 } | 638 } |
| OLD | NEW |