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

Unified Diff: chrome/test/base/ui_test_utils.cc

Issue 10823392: Let ui_test_utils::FindInPage optionally return the selection rect. This will be used in a future c… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/base/ui_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/ui_test_utils.cc
===================================================================
--- chrome/test/base/ui_test_utils.cc (revision 152084)
+++ chrome/test/base/ui_test_utils.cc (working copy)
@@ -106,8 +106,8 @@
}
int active_match_ordinal() const { return active_match_ordinal_; }
-
int number_of_matches() const { return number_of_matches_; }
+ gfx::Rect selection_rect() const { return selection_rect_; }
virtual void Observe(int type, const content::NotificationSource& source,
const content::NotificationDetails& details) {
@@ -116,8 +116,10 @@
if (find_details->request_id() == current_find_request_id_) {
// We get multiple responses and one of those will contain the ordinal.
// This message comes to us before the final update is sent.
- if (find_details->active_match_ordinal() > -1)
+ if (find_details->active_match_ordinal() > -1) {
active_match_ordinal_ = find_details->active_match_ordinal();
+ selection_rect_ = find_details->selection_rect();
+ }
if (find_details->final_update()) {
number_of_matches_ = find_details->number_of_matches();
message_loop_runner_->Quit();
@@ -137,6 +139,7 @@
// we need to preserve it so we can send it later.
int active_match_ordinal_;
int number_of_matches_;
+ gfx::Rect selection_rect_;
// The id of the current find request, obtained from WebContents. Allows us
// to monitor when the search completes.
int current_find_request_id_;
@@ -367,12 +370,15 @@
}
int FindInPage(TabContents* tab_contents, const string16& search_string,
- bool forward, bool match_case, int* ordinal) {
+ bool forward, bool match_case, int* ordinal,
+ gfx::Rect* selection_rect) {
tab_contents->
find_tab_helper()->StartFinding(search_string, forward, match_case);
FindInPageNotificationObserver observer(tab_contents);
if (ordinal)
*ordinal = observer.active_match_ordinal();
+ if (selection_rect)
+ *selection_rect = observer.selection_rect();
return observer.number_of_matches();
}
« no previous file with comments | « chrome/test/base/ui_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698