Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: chrome/browser/views/find_bar_win_browsertest.cc

Issue 176004: Move observers out of automation_provider.cc to declutter the file. (Closed)
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/message_loop.h" 5 #include "base/message_loop.h"
6 #include "chrome/browser/browser.h" 6 #include "chrome/browser/browser.h"
7 #include "chrome/browser/browser_window.h" 7 #include "chrome/browser/browser_window.h"
8 #include "chrome/browser/find_bar_controller.h" 8 #include "chrome/browser/find_bar_controller.h"
9 #include "chrome/browser/find_notification_details.h" 9 #include "chrome/browser/find_notification_details.h"
10 #include "chrome/browser/renderer_host/render_view_host.h" 10 #include "chrome/browser/renderer_host/render_view_host.h"
11 #include "chrome/browser/tab_contents/tab_contents.h" 11 #include "chrome/browser/tab_contents/tab_contents.h"
12 #include "chrome/browser/tab_contents/tab_contents_view.h" 12 #include "chrome/browser/tab_contents/tab_contents_view.h"
13 #include "chrome/browser/views/find_bar_win.h" 13 #include "chrome/browser/views/find_bar_win.h"
14 #include "chrome/common/notification_service.h" 14 #include "chrome/common/notification_service.h"
15 #include "chrome/test/in_process_browser_test.h" 15 #include "chrome/test/in_process_browser_test.h"
16 #include "chrome/test/ui_test_utils.h" 16 #include "chrome/test/ui_test_utils.h"
17 #include "views/focus/focus_manager.h" 17 #include "views/focus/focus_manager.h"
18 18
19 const std::wstring kSimplePage = L"404_is_enough_for_us.html"; 19 const std::wstring kSimplePage = L"404_is_enough_for_us.html";
20 const std::wstring kFramePage = L"files/find_in_page/frames.html"; 20 const std::wstring kFramePage = L"files/find_in_page/frames.html";
21 const std::wstring kFrameData = L"files/find_in_page/framedata_general.html"; 21 const std::wstring kFrameData = L"files/find_in_page/framedata_general.html";
22 const std::wstring kUserSelectPage = L"files/find_in_page/user-select.html"; 22 const std::wstring kUserSelectPage = L"files/find_in_page/user-select.html";
23 const std::wstring kCrashPage = L"files/find_in_page/crash_1341577.html"; 23 const std::wstring kCrashPage = L"files/find_in_page/crash_1341577.html";
24 const std::wstring kTooFewMatchesPage = L"files/find_in_page/bug_1155639.html"; 24 const std::wstring kTooFewMatchesPage = L"files/find_in_page/bug_1155639.html";
25 const std::wstring kEndState = L"files/find_in_page/end_state.html"; 25 const std::wstring kEndState = L"files/find_in_page/end_state.html";
26 const std::wstring kPrematureEnd = L"files/find_in_page/premature_end.html"; 26 const std::wstring kPrematureEnd = L"files/find_in_page/premature_end.html";
27 const std::wstring kMoveIfOver = L"files/find_in_page/move_if_obscuring.html"; 27 const std::wstring kMoveIfOver = L"files/find_in_page/move_if_obscuring.html";
28 const std::wstring kBitstackCrash = L"files/find_in_page/crash_14491.html"; 28 const std::wstring kBitstackCrash = L"files/find_in_page/crash_14491.html";
29 29
30 namespace {
31
30 class FindInPageNotificationObserver : public NotificationObserver { 32 class FindInPageNotificationObserver : public NotificationObserver {
31 public: 33 public:
32 explicit FindInPageNotificationObserver(TabContents* parent_tab) 34 explicit FindInPageNotificationObserver(TabContents* parent_tab)
33 : parent_tab_(parent_tab), 35 : parent_tab_(parent_tab),
34 active_match_ordinal_(-1), 36 active_match_ordinal_(-1),
35 number_of_matches_(0) { 37 number_of_matches_(0) {
36 current_find_request_id_ = parent_tab->current_find_request_id(); 38 current_find_request_id_ = parent_tab->current_find_request_id();
37 registrar_.Add(this, NotificationType::FIND_RESULT_AVAILABLE, 39 registrar_.Add(this, NotificationType::FIND_RESULT_AVAILABLE,
38 Source<TabContents>(parent_tab_)); 40 Source<TabContents>(parent_tab_));
39 ui_test_utils::RunMessageLoop(); 41 ui_test_utils::RunMessageLoop();
(...skipping 29 matching lines...) Expand all
69 TabContents* parent_tab_; 71 TabContents* parent_tab_;
70 // We will at some point (before final update) be notified of the ordinal and 72 // We will at some point (before final update) be notified of the ordinal and
71 // we need to preserve it so we can send it later. 73 // we need to preserve it so we can send it later.
72 int active_match_ordinal_; 74 int active_match_ordinal_;
73 int number_of_matches_; 75 int number_of_matches_;
74 // The id of the current find request, obtained from TabContents. Allows us 76 // The id of the current find request, obtained from TabContents. Allows us
75 // to monitor when the search completes. 77 // to monitor when the search completes.
76 int current_find_request_id_; 78 int current_find_request_id_;
77 }; 79 };
78 80
81 } // namespace
82
79 typedef enum { BACK = 0, FWD = 1 } FindInPageDirection; 83 typedef enum { BACK = 0, FWD = 1 } FindInPageDirection;
80 typedef enum { IGNORE_CASE = 0, CASE_SENSITIVE = 1 } FindInPageCase; 84 typedef enum { IGNORE_CASE = 0, CASE_SENSITIVE = 1 } FindInPageCase;
81 85
82 class FindInPageControllerTest : public InProcessBrowserTest { 86 class FindInPageControllerTest : public InProcessBrowserTest {
83 public: 87 public:
84 FindInPageControllerTest() { 88 FindInPageControllerTest() {
85 EnableDOMAutomation(); 89 EnableDOMAutomation();
86 } 90 }
87 91
88 protected: 92 protected:
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 // backspace, but that's been proven flaky in the past, so we go straight to 626 // backspace, but that's been proven flaky in the past, so we go straight to
623 // tab_contents. 627 // tab_contents.
624 TabContents* tab_contents = browser()->GetSelectedTabContents(); 628 TabContents* tab_contents = browser()->GetSelectedTabContents();
625 // Stop the (non-existing) find operation, and clear the selection (which 629 // Stop the (non-existing) find operation, and clear the selection (which
626 // signals the UI is still active). 630 // signals the UI is still active).
627 tab_contents->StopFinding(true); 631 tab_contents->StopFinding(true);
628 // Make sure the Find UI flag hasn't been cleared, it must be so that the UI 632 // Make sure the Find UI flag hasn't been cleared, it must be so that the UI
629 // still responds to browser window resizing. 633 // still responds to browser window resizing.
630 ASSERT_TRUE(tab_contents->find_ui_active()); 634 ASSERT_TRUE(tab_contents->find_ui_active());
631 } 635 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698