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

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

Issue 2063863002: Use DCHECKs when observing only a single notification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/browser/web_applications/update_shortcut_worker_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/find_in_page_observer.cc
diff --git a/chrome/test/base/find_in_page_observer.cc b/chrome/test/base/find_in_page_observer.cc
index c41b81efc23ed7fc96dacd431584821b83be0708..4cfce7c550afd9524c6b33d67e09f2065b915f57 100644
--- a/chrome/test/base/find_in_page_observer.cc
+++ b/chrome/test/base/find_in_page_observer.cc
@@ -38,28 +38,27 @@ void FindInPageNotificationObserver::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
- if (type == chrome::NOTIFICATION_FIND_RESULT_AVAILABLE) {
- content::Details<FindNotificationDetails> find_details(details);
- 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) {
- 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();
- seen_ = true;
- if (running_) {
- running_ = false;
- message_loop_runner_->Quit();
- }
- } else {
- DVLOG(1) << "Ignoring, since we only care about the final message";
- }
+ DCHECK_EQ(chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, type);
+
+ content::Details<FindNotificationDetails> find_details(details);
+ if (find_details->request_id() != current_find_request_id_)
+ return;
+
+ // 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) {
+ 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();
+ seen_ = true;
+ if (running_) {
+ running_ = false;
+ message_loop_runner_->Quit();
}
} else {
- NOTREACHED();
+ DVLOG(1) << "Ignoring, since we only care about the final message";
}
}
« no previous file with comments | « chrome/browser/web_applications/update_shortcut_worker_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698