Commit c515c08b authored by alexmos's avatar alexmos Committed by Commit bot

Use FrameMatchingPredicate() to find RenderFrameHosts in ExtensionWebUITest.

When looking for a RFH by last committed URL, there is no need to do a ForEach with a private FindFrame() predicate, since that logic is already available from a public FrameMatchingPredicate method in browser_test_utils.

BUG=

Review URL: https://codereview.chromium.org/807463003

Cr-Commit-Position: refs/heads/master@{#308458}
parent 5f88815a
...@@ -26,17 +26,6 @@ namespace OnMessage = core_api::test::OnMessage; ...@@ -26,17 +26,6 @@ namespace OnMessage = core_api::test::OnMessage;
namespace { namespace {
void FindFrame(const GURL& url,
content::RenderFrameHost** out,
content::RenderFrameHost* frame) {
if (frame->GetLastCommittedURL() == url) {
if (*out != NULL) {
ADD_FAILURE() << "Found multiple frames at " << url;
}
*out = frame;
}
}
// Tests running extension APIs on WebUI. // Tests running extension APIs on WebUI.
class ExtensionWebUITest : public ExtensionApiTest { class ExtensionWebUITest : public ExtensionApiTest {
protected: protected:
...@@ -119,10 +108,9 @@ class ExtensionWebUITest : public ExtensionApiTest { ...@@ -119,10 +108,9 @@ class ExtensionWebUITest : public ExtensionApiTest {
if (active_web_contents->GetLastCommittedURL() == frame_url) if (active_web_contents->GetLastCommittedURL() == frame_url)
return active_web_contents->GetMainFrame(); return active_web_contents->GetMainFrame();
content::RenderFrameHost* frame_host = NULL; return FrameMatchingPredicate(
active_web_contents->ForEachFrame( active_web_contents,
base::Bind(&FindFrame, frame_url, &frame_host)); base::Bind(&content::FrameHasSourceUrl, frame_url));
return frame_host;
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment