OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/run_loop.h" | 5 #include "base/run_loop.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "content/browser/frame_host/frame_tree.h" | 7 #include "content/browser/frame_host/frame_tree.h" |
8 #include "content/browser/site_per_process_browsertest.h" | 8 #include "content/browser/site_per_process_browsertest.h" |
9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
10 #include "content/public/browser/devtools_agent_host.h" | 10 #include "content/public/browser/devtools_agent_host.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 GURL::Replacements replace_host; | 91 GURL::Replacements replace_host; |
92 GURL cross_site_url(embedded_test_server()->GetURL("/title2.html")); | 92 GURL cross_site_url(embedded_test_server()->GetURL("/title2.html")); |
93 replace_host.SetHostStr("foo.com"); | 93 replace_host.SetHostStr("foo.com"); |
94 cross_site_url = cross_site_url.ReplaceComponents(replace_host); | 94 cross_site_url = cross_site_url.ReplaceComponents(replace_host); |
95 NavigateFrameToURL(root->child_at(0), cross_site_url); | 95 NavigateFrameToURL(root->child_at(0), cross_site_url); |
96 | 96 |
97 list = DevToolsAgentHost::GetOrCreateAll(); | 97 list = DevToolsAgentHost::GetOrCreateAll(); |
98 EXPECT_EQ(2U, list.size()); | 98 EXPECT_EQ(2U, list.size()); |
99 EXPECT_EQ(DevToolsAgentHost::kTypePage, list[0]->GetType()); | 99 EXPECT_EQ(DevToolsAgentHost::kTypePage, list[0]->GetType()); |
100 EXPECT_EQ(main_url.spec(), list[0]->GetURL().spec()); | 100 EXPECT_EQ(main_url.spec(), list[0]->GetURL().spec()); |
101 EXPECT_EQ(DevToolsAgentHost::kTypePage, list[1]->GetType()); | 101 EXPECT_EQ(DevToolsAgentHost::kTypeFrame, list[1]->GetType()); |
102 EXPECT_EQ(cross_site_url.spec(), list[1]->GetURL().spec()); | 102 EXPECT_EQ(cross_site_url.spec(), list[1]->GetURL().spec()); |
103 EXPECT_EQ(std::string(), list[0]->GetParentId()); | 103 EXPECT_EQ(std::string(), list[0]->GetParentId()); |
104 EXPECT_EQ(list[0]->GetId(), list[1]->GetParentId()); | 104 EXPECT_EQ(list[0]->GetId(), list[1]->GetParentId()); |
105 EXPECT_NE(list[1]->GetId(), list[0]->GetId()); | 105 EXPECT_NE(list[1]->GetId(), list[0]->GetId()); |
106 | 106 |
107 // Attaching to both agent hosts. | 107 // Attaching to both agent hosts. |
108 scoped_refptr<DevToolsAgentHost> child_host = list[1]; | 108 scoped_refptr<DevToolsAgentHost> child_host = list[1]; |
109 TestClient child_client; | 109 TestClient child_client; |
110 child_host->AttachClient(&child_client); | 110 child_host->AttachClient(&child_client); |
111 scoped_refptr<DevToolsAgentHost> parent_host = list[0]; | 111 scoped_refptr<DevToolsAgentHost> parent_host = list[0]; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 EXPECT_EQ(child_frame_agent->GetParentId(), main_frame_agent->GetId()); | 202 EXPECT_EQ(child_frame_agent->GetParentId(), main_frame_agent->GetId()); |
203 EXPECT_NE(child_frame_agent->GetId(), main_frame_agent->GetId()); | 203 EXPECT_NE(child_frame_agent->GetId(), main_frame_agent->GetId()); |
204 | 204 |
205 // Agent for web contents should be the the main frame's one. | 205 // Agent for web contents should be the the main frame's one. |
206 scoped_refptr<DevToolsAgentHost> page_agent = | 206 scoped_refptr<DevToolsAgentHost> page_agent = |
207 DevToolsAgentHost::GetOrCreateFor(shell()->web_contents()); | 207 DevToolsAgentHost::GetOrCreateFor(shell()->web_contents()); |
208 EXPECT_EQ(page_agent.get(), main_frame_agent.get()); | 208 EXPECT_EQ(page_agent.get(), main_frame_agent.get()); |
209 } | 209 } |
210 | 210 |
211 } // namespace content | 211 } // namespace content |
OLD | NEW |