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

Side by Side Diff: content/test/content_browser_test_utils_internal.cc

Issue 1685213002: Propagate window coordinates to out-of-process iframes renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sendscreenrects
Patch Set: rebase Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 "content/test/content_browser_test_utils_internal.h" 5 #include "content/test/content_browser_test_utils_internal.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // Traversal 3: Assign names to the proxies and add them to |legend| too. 80 // Traversal 3: Assign names to the proxies and add them to |legend| too.
81 // Typically, only openers should have their names assigned this way. 81 // Typically, only openers should have their names assigned this way.
82 for (to_explore.push(root); !to_explore.empty();) { 82 for (to_explore.push(root); !to_explore.empty();) {
83 FrameTreeNode* node = to_explore.top(); 83 FrameTreeNode* node = to_explore.top();
84 to_explore.pop(); 84 to_explore.pop();
85 for (size_t i = node->child_count(); i-- != 0;) { 85 for (size_t i = node->child_count(); i-- != 0;) {
86 to_explore.push(node->child_at(i)); 86 to_explore.push(node->child_at(i));
87 } 87 }
88 88
89 // Sort the proxies by SiteInstance ID to avoid hash_map ordering. 89 // Sort the proxies by SiteInstance ID to avoid hash_map ordering.
90 std::map<int, RenderFrameProxyHost*> sorted_proxy_hosts = 90 std::vector<SiteInstance*> site_instances;
91 node->render_manager()->GetAllProxyHostsForTesting(); 91 for (const auto& proxy_pair :
92 for (auto& proxy_pair : sorted_proxy_hosts) { 92 node->render_manager()->GetAllProxyHostsForTesting())
93 RenderFrameProxyHost* proxy = proxy_pair.second; 93 site_instances.push_back(proxy_pair.second->GetSiteInstance());
94 legend[GetName(proxy->GetSiteInstance())] = proxy->GetSiteInstance(); 94 std::sort(site_instances.begin(), site_instances.end(),
95 } 95 [](SiteInstance* lhs, SiteInstance* rhs) {
96 return lhs->GetId() < rhs->GetId();
97 });
98
99 for (SiteInstance* site_instance : site_instances)
100 legend[GetName(site_instance)] = site_instance;
96 } 101 }
97 102
98 // Traversal 4: Now that all names are assigned, make a big loop to pretty- 103 // Traversal 4: Now that all names are assigned, make a big loop to pretty-
99 // print the tree. Each iteration produces exactly one line of format. 104 // print the tree. Each iteration produces exactly one line of format.
100 std::string result; 105 std::string result;
101 for (to_explore.push(root); !to_explore.empty();) { 106 for (to_explore.push(root); !to_explore.empty();) {
102 FrameTreeNode* node = to_explore.top(); 107 FrameTreeNode* node = to_explore.top();
103 to_explore.pop(); 108 to_explore.pop();
104 for (size_t i = node->child_count(); i-- != 0;) { 109 for (size_t i = node->child_count(); i-- != 0;) {
105 to_explore.push(node->child_at(i)); 110 to_explore.push(node->child_at(i));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 if (pending) { 153 if (pending) {
149 base::StringAppendF(&line, " (%s pending)", 154 base::StringAppendF(&line, " (%s pending)",
150 GetName(pending->GetSiteInstance()).c_str()); 155 GetName(pending->GetSiteInstance()).c_str());
151 } 156 }
152 if (spec) { 157 if (spec) {
153 base::StringAppendF(&line, " (%s speculative)", 158 base::StringAppendF(&line, " (%s speculative)",
154 GetName(spec->GetSiteInstance()).c_str()); 159 GetName(spec->GetSiteInstance()).c_str());
155 } 160 }
156 161
157 // Show the SiteInstances of the RenderFrameProxyHosts of this node. 162 // Show the SiteInstances of the RenderFrameProxyHosts of this node.
158 std::map<int, RenderFrameProxyHost*> sorted_proxy_host_map = 163 const auto& proxy_host_map =
159 node->render_manager()->GetAllProxyHostsForTesting(); 164 node->render_manager()->GetAllProxyHostsForTesting();
160 if (!sorted_proxy_host_map.empty()) { 165 if (!proxy_host_map.empty()) {
161 // Show a dashed line of variable length before the proxy list. Always at 166 // Show a dashed line of variable length before the proxy list. Always at
162 // least two dashes. 167 // least two dashes.
163 line.append(" --"); 168 line.append(" --");
164 169
165 // To make proxy lists align vertically for the first three tree levels, 170 // To make proxy lists align vertically for the first three tree levels,
166 // pad with dashes up to a first tab stop at column 19 (which works out to 171 // pad with dashes up to a first tab stop at column 19 (which works out to
167 // text editor column 28 in the typical diagram fed to EXPECT_EQ as a 172 // text editor column 28 in the typical diagram fed to EXPECT_EQ as a
168 // string literal). Lining the lists up vertically makes differences in 173 // string literal). Lining the lists up vertically makes differences in
169 // the proxy sets easier to spot visually. We choose not to use the 174 // the proxy sets easier to spot visually. We choose not to use the
170 // *actual* tree height here, because that would make the diagram's 175 // *actual* tree height here, because that would make the diagram's
171 // appearance less stable as the tree's shape evolves. 176 // appearance less stable as the tree's shape evolves.
172 while (line.length() < 20) { 177 while (line.length() < 20) {
173 line.append("-"); 178 line.append("-");
174 } 179 }
175 line.append(" proxies for"); 180 line.append(" proxies for");
176 181
177 // Sort these alphabetically, to avoid hash_map ordering dependency. 182 // Sort these alphabetically, to avoid hash_map ordering dependency.
178 std::vector<std::string> sorted_proxy_hosts; 183 std::vector<std::string> sorted_proxy_hosts;
179 for (auto& proxy_pair : sorted_proxy_host_map) { 184 for (const auto& proxy_pair : proxy_host_map) {
180 sorted_proxy_hosts.push_back( 185 sorted_proxy_hosts.push_back(
181 GetName(proxy_pair.second->GetSiteInstance())); 186 GetName(proxy_pair.second->GetSiteInstance()));
182 } 187 }
183 std::sort(sorted_proxy_hosts.begin(), sorted_proxy_hosts.end()); 188 std::sort(sorted_proxy_hosts.begin(), sorted_proxy_hosts.end());
184 for (std::string& proxy_name : sorted_proxy_hosts) { 189 for (std::string& proxy_name : sorted_proxy_hosts) {
185 base::StringAppendF(&line, " %s", proxy_name.c_str()); 190 base::StringAppendF(&line, " %s", proxy_name.c_str());
186 } 191 }
187 } 192 }
188 if (node != root) 193 if (node != root)
189 result.append("\n"); 194 result.append("\n");
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 content::ResourceContext* resource_context, 268 content::ResourceContext* resource_context,
264 content::AppCacheService* appcache_service, 269 content::AppCacheService* appcache_service,
265 ResourceType resource_type, 270 ResourceType resource_type,
266 ScopedVector<content::ResourceThrottle>* throttles) { 271 ScopedVector<content::ResourceThrottle>* throttles) {
267 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 272 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
268 if (request->url() == url_) 273 if (request->url() == url_)
269 throttles->push_back(new HttpRequestStallThrottle); 274 throttles->push_back(new HttpRequestStallThrottle);
270 } 275 }
271 276
272 } // namespace content 277 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698