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

Unified Diff: content/public/test/browser_test_utils.cc

Issue 2849603005: Do not reinvent the wheel / use content APIs to find a frame by name. (Closed)
Patch Set: Making the return statement in FrameMatchingPredicate safe against null dereferencing. Created 3 years, 8 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 | « content/browser/webui/web_ui_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/browser_test_utils.cc
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index 0864b5a2ae4d89bf797a839f21ec40f8e937e24a..f8ebb882ae270176a5266368db6087904d41b6e7 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -935,8 +935,8 @@ RenderFrameHost* FrameMatchingPredicate(
std::set<RenderFrameHost*> frame_set;
web_contents->ForEachFrame(
base::Bind(&AddToSetIfFrameMatchesPredicate, &frame_set, predicate));
- DCHECK_EQ(1U, frame_set.size());
- return *frame_set.begin();
+ EXPECT_EQ(1U, frame_set.size());
+ return frame_set.size() == 1 ? *frame_set.begin() : nullptr;
}
bool FrameMatchesName(const std::string& name, RenderFrameHost* frame) {
« no previous file with comments | « content/browser/webui/web_ui_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698