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

Side by Side Diff: content/browser/devtools/site_per_process_devtools_browsertest.cc

Issue 1411073005: Migrating tests to use EmbeddedTestServer (/content) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
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 5
6 #include "content/browser/frame_host/frame_tree.h" 6 #include "content/browser/frame_host/frame_tree.h"
7 #include "content/browser/site_per_process_browsertest.h" 7 #include "content/browser/site_per_process_browsertest.h"
8 #include "content/browser/web_contents/web_contents_impl.h" 8 #include "content/browser/web_contents/web_contents_impl.h"
9 #include "content/public/browser/devtools_agent_host.h" 9 #include "content/public/browser/devtools_agent_host.h"
10 #include "content/public/test/content_browser_test_utils.h" 10 #include "content/public/test/content_browser_test_utils.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // Fails on Android, http://crbug.com/464993. 46 // Fails on Android, http://crbug.com/464993.
47 #if defined(OS_ANDROID) 47 #if defined(OS_ANDROID)
48 #define MAYBE_CrossSiteIframeAgentHost DISABLED_CrossSiteIframeAgentHost 48 #define MAYBE_CrossSiteIframeAgentHost DISABLED_CrossSiteIframeAgentHost
49 #else 49 #else
50 #define MAYBE_CrossSiteIframeAgentHost CrossSiteIframeAgentHost 50 #define MAYBE_CrossSiteIframeAgentHost CrossSiteIframeAgentHost
51 #endif 51 #endif
52 IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsBrowserTest, 52 IN_PROC_BROWSER_TEST_F(SitePerProcessDevToolsBrowserTest,
53 MAYBE_CrossSiteIframeAgentHost) { 53 MAYBE_CrossSiteIframeAgentHost) {
54 DevToolsAgentHost::List list; 54 DevToolsAgentHost::List list;
55 host_resolver()->AddRule("*", "127.0.0.1"); 55 host_resolver()->AddRule("*", "127.0.0.1");
56 ASSERT_TRUE(test_server()->Start()); 56 GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html"));
57 GURL main_url(test_server()->GetURL("files/site_per_process_main.html"));
58 NavigateToURL(shell(), main_url); 57 NavigateToURL(shell(), main_url);
59 58
60 // It is safe to obtain the root frame tree node here, as it doesn't change. 59 // It is safe to obtain the root frame tree node here, as it doesn't change.
61 FrameTreeNode* root = 60 FrameTreeNode* root =
62 static_cast<WebContentsImpl*>(shell()->web_contents())-> 61 static_cast<WebContentsImpl*>(shell()->web_contents())->
63 GetFrameTree()->root(); 62 GetFrameTree()->root();
64 63
65 list = DevToolsAgentHost::GetOrCreateAll(); 64 list = DevToolsAgentHost::GetOrCreateAll();
66 EXPECT_EQ(1U, list.size()); 65 EXPECT_EQ(1U, list.size());
67 EXPECT_EQ(DevToolsAgentHost::TYPE_WEB_CONTENTS, list[0]->GetType()); 66 EXPECT_EQ(DevToolsAgentHost::TYPE_WEB_CONTENTS, list[0]->GetType());
68 EXPECT_EQ(main_url.spec(), list[0]->GetURL().spec()); 67 EXPECT_EQ(main_url.spec(), list[0]->GetURL().spec());
69 68
70 // Load same-site page into iframe. 69 // Load same-site page into iframe.
71 FrameTreeNode* child = root->child_at(0); 70 FrameTreeNode* child = root->child_at(0);
72 GURL http_url(test_server()->GetURL("files/title1.html")); 71 GURL http_url(embedded_test_server()->GetURL("/title1.html"));
73 NavigateFrameToURL(child, http_url); 72 NavigateFrameToURL(child, http_url);
74 73
75 list = DevToolsAgentHost::GetOrCreateAll(); 74 list = DevToolsAgentHost::GetOrCreateAll();
76 EXPECT_EQ(1U, list.size()); 75 EXPECT_EQ(1U, list.size());
77 EXPECT_EQ(DevToolsAgentHost::TYPE_WEB_CONTENTS, list[0]->GetType()); 76 EXPECT_EQ(DevToolsAgentHost::TYPE_WEB_CONTENTS, list[0]->GetType());
78 EXPECT_EQ(main_url.spec(), list[0]->GetURL().spec()); 77 EXPECT_EQ(main_url.spec(), list[0]->GetURL().spec());
79 78
80 // Load cross-site page into iframe. 79 // Load cross-site page into iframe.
81 GURL::Replacements replace_host; 80 GURL::Replacements replace_host;
82 GURL cross_site_url(test_server()->GetURL("files/title2.html")); 81 GURL cross_site_url(embedded_test_server()->GetURL("/title2.html"));
83 replace_host.SetHostStr("foo.com"); 82 replace_host.SetHostStr("foo.com");
84 cross_site_url = cross_site_url.ReplaceComponents(replace_host); 83 cross_site_url = cross_site_url.ReplaceComponents(replace_host);
85 NavigateFrameToURL(root->child_at(0), cross_site_url); 84 NavigateFrameToURL(root->child_at(0), cross_site_url);
86 85
87 list = DevToolsAgentHost::GetOrCreateAll(); 86 list = DevToolsAgentHost::GetOrCreateAll();
88 EXPECT_EQ(2U, list.size()); 87 EXPECT_EQ(2U, list.size());
89 EXPECT_EQ(DevToolsAgentHost::TYPE_WEB_CONTENTS, list[0]->GetType()); 88 EXPECT_EQ(DevToolsAgentHost::TYPE_WEB_CONTENTS, list[0]->GetType());
90 EXPECT_EQ(main_url.spec(), list[0]->GetURL().spec()); 89 EXPECT_EQ(main_url.spec(), list[0]->GetURL().spec());
91 EXPECT_EQ(DevToolsAgentHost::TYPE_FRAME, list[1]->GetType()); 90 EXPECT_EQ(DevToolsAgentHost::TYPE_FRAME, list[1]->GetType());
92 EXPECT_EQ(cross_site_url.spec(), list[1]->GetURL().spec()); 91 EXPECT_EQ(cross_site_url.spec(), list[1]->GetURL().spec());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 replace_host.SetHostStr("foo.com"); 140 replace_host.SetHostStr("foo.com");
142 cross_site_url = cross_site_url.ReplaceComponents(replace_host); 141 cross_site_url = cross_site_url.ReplaceComponents(replace_host);
143 NavigateFrameToURL(root->child_at(0), cross_site_url); 142 NavigateFrameToURL(root->child_at(0), cross_site_url);
144 143
145 child_frame_agent = 144 child_frame_agent =
146 DevToolsAgentHost::GetOrCreateFor(child->current_frame_host()); 145 DevToolsAgentHost::GetOrCreateFor(child->current_frame_host());
147 EXPECT_NE(page_agent.get(), child_frame_agent.get()); 146 EXPECT_NE(page_agent.get(), child_frame_agent.get());
148 } 147 }
149 148
150 } // namespace content 149 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/devtools_protocol_browsertest.cc ('k') | content/browser/download/download_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698