Commit dda2ff1d authored by dgozman's avatar dgozman Committed by Commit bot

[DevTools] Fix out of process iframes not working on chrome://inspect.

Regressed in recent refactoring of devtools discovery.
Added checks to existing tests.

BUG=627517

Review-Url: https://codereview.chromium.org/2332213010
Cr-Commit-Position: refs/heads/master@{#419030}
parent 770c5f8e
......@@ -49,6 +49,10 @@ void ChromeDevToolsManagerDelegate::Inspect(
DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host);
return;
}
if (type == content::DevToolsAgentHost::kTypeFrame) {
DevToolsWindow::OpenDevToolsWindow(profile, agent_host);
return;
}
content::WebContents* web_contents = agent_host->GetWebContents();
if (web_contents)
DevToolsWindow::OpenDevToolsWindow(web_contents);
......
......@@ -864,8 +864,8 @@ void RenderFrameDevToolsAgentHost::ConnectWebContents(WebContents* wc) {
}
std::string RenderFrameDevToolsAgentHost::GetParentId() {
if (IsChildFrame()) {
RenderFrameHostImpl* frame_host = current_->host();
if (IsChildFrame() && current_) {
RenderFrameHostImpl* frame_host = current_->host()->GetParent();
while (frame_host && !ShouldCreateDevToolsFor(frame_host))
frame_host = frame_host->GetParent();
if (frame_host)
......
......@@ -100,6 +100,9 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsBrowserTest,
EXPECT_EQ(main_url.spec(), list[0]->GetURL().spec());
EXPECT_EQ(DevToolsAgentHost::kTypePage, list[1]->GetType());
EXPECT_EQ(cross_site_url.spec(), list[1]->GetURL().spec());
EXPECT_EQ(std::string(), list[0]->GetParentId());
EXPECT_EQ(list[0]->GetId(), list[1]->GetParentId());
EXPECT_NE(list[1]->GetId(), list[0]->GetId());
// Attaching to both agent hosts.
scoped_refptr<DevToolsAgentHost> child_host = list[1];
......@@ -167,6 +170,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsBrowserTest, AgentHostForFrames) {
child_frame_agent =
DevToolsAgentHost::GetOrCreateFor(child->current_frame_host());
EXPECT_NE(page_agent.get(), child_frame_agent.get());
EXPECT_EQ(child_frame_agent->GetParentId(), page_agent->GetId());
EXPECT_NE(child_frame_agent->GetId(), page_agent->GetId());
}
IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsBrowserTest,
......@@ -194,6 +199,8 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsBrowserTest,
scoped_refptr<DevToolsAgentHost> main_frame_agent =
DevToolsAgentHost::GetOrCreateFor(root->current_frame_host());
EXPECT_NE(main_frame_agent.get(), child_frame_agent.get());
EXPECT_EQ(child_frame_agent->GetParentId(), main_frame_agent->GetId());
EXPECT_NE(child_frame_agent->GetId(), main_frame_agent->GetId());
// Agent for web contents should be the the main frame's one.
scoped_refptr<DevToolsAgentHost> page_agent =
......
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