| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/site_details.h" | 5 #include "chrome/browser/site_details.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 DictionaryBuilder() | 204 DictionaryBuilder() |
| 205 .Set("scripts", ListBuilder().Append("script.js").Build()) | 205 .Set("scripts", ListBuilder().Append("script.js").Build()) |
| 206 .Build()); | 206 .Build()); |
| 207 dir->WriteFile(FILE_PATH_LITERAL("script.js"), | 207 dir->WriteFile(FILE_PATH_LITERAL("script.js"), |
| 208 "console.log('" + name + " running');"); | 208 "console.log('" + name + " running');"); |
| 209 } | 209 } |
| 210 | 210 |
| 211 dir->WriteFile(FILE_PATH_LITERAL("blank_iframe.html"), | 211 dir->WriteFile(FILE_PATH_LITERAL("blank_iframe.html"), |
| 212 base::StringPrintf("<html><body>%s, blank iframe:" | 212 base::StringPrintf("<html><body>%s, blank iframe:" |
| 213 " <iframe width=80 height=80></iframe>" | 213 " <iframe width=80 height=80></iframe>" |
| 214 "<script src='foo.js'></script>" |
| 214 "</body></html>", | 215 "</body></html>", |
| 215 name.c_str())); | 216 name.c_str())); |
| 217 std::string slow_url = |
| 218 embedded_test_server()->GetURL("w.com", "/slow?10").spec(); |
| 216 std::string iframe_url = | 219 std::string iframe_url = |
| 217 embedded_test_server() | 220 embedded_test_server() |
| 218 ->GetURL("w.com", "/cross_site_iframe_factory.html?w") | 221 ->GetURL("w.com", "/cross_site_iframe_factory.html?w") |
| 219 .spec(); | 222 .spec(); |
| 220 std::string iframe_url2 = | 223 std::string iframe_url2 = |
| 221 embedded_test_server() | 224 embedded_test_server() |
| 222 ->GetURL("x.com", "/cross_site_iframe_factory.html?x") | 225 ->GetURL("x.com", "/cross_site_iframe_factory.html?x") |
| 223 .spec(); | 226 .spec(); |
| 224 dir->WriteFile( | 227 dir->WriteFile( |
| 228 FILE_PATH_LITERAL("foo.js"), |
| 229 base::StringPrintf("window.addEventListener('unload', function(event) {" |
| 230 " var request = new XMLHttpRequest();" |
| 231 " request.open('GET', '%s', false);" |
| 232 " request.send(null);" |
| 233 "});", slow_url.c_str())); |
| 234 dir->WriteFile( |
| 225 FILE_PATH_LITERAL("http_iframe.html"), | 235 FILE_PATH_LITERAL("http_iframe.html"), |
| 226 base::StringPrintf("<html><body>%s, http:// iframe:" | 236 base::StringPrintf("<html><body>%s, http:// iframe:" |
| 227 " <iframe width=80 height=80 src='%s'></iframe>" | 237 " <iframe width=80 height=80 src='%s'></iframe>" |
| 228 "</body></html>", | 238 "</body></html>", |
| 229 name.c_str(), iframe_url.c_str())); | 239 name.c_str(), iframe_url.c_str())); |
| 230 dir->WriteFile(FILE_PATH_LITERAL("two_http_iframes.html"), | 240 dir->WriteFile(FILE_PATH_LITERAL("two_http_iframes.html"), |
| 231 base::StringPrintf( | 241 base::StringPrintf( |
| 232 "<html><body>%s, two http:// iframes:" | 242 "<html><body>%s, two http:// iframes:" |
| 233 " <iframe width=80 height=80 src='%s'></iframe>" | 243 " <iframe width=80 height=80 src='%s'></iframe>" |
| 234 " <iframe width=80 height=80 src='%s'></iframe>" | 244 " <iframe width=80 height=80 src='%s'></iframe>" |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 content::NavigateIframeToURL( | 1297 content::NavigateIframeToURL( |
| 1288 tab, "child-1", extension2->GetResourceURL("/blank_iframe.html")); | 1298 tab, "child-1", extension2->GetResourceURL("/blank_iframe.html")); |
| 1289 details = new TestMemoryDetails(); | 1299 details = new TestMemoryDetails(); |
| 1290 details->StartFetchAndWait(); | 1300 details->StartFetchAndWait(); |
| 1291 EXPECT_THAT(details->uma()->GetAllSamples( | 1301 EXPECT_THAT(details->uma()->GetAllSamples( |
| 1292 "SiteIsolation.SiteInstancesPerBrowsingInstance"), | 1302 "SiteIsolation.SiteInstancesPerBrowsingInstance"), |
| 1293 DependingOnPolicy(ElementsAre(Bucket(1, 2)), | 1303 DependingOnPolicy(ElementsAre(Bucket(1, 2)), |
| 1294 ElementsAre(Bucket(1, 1), Bucket(3, 1)), | 1304 ElementsAre(Bucket(1, 1), Bucket(3, 1)), |
| 1295 ElementsAre(Bucket(1, 1), Bucket(5, 1)))); | 1305 ElementsAre(Bucket(1, 1), Bucket(5, 1)))); |
| 1296 } | 1306 } |
| OLD | NEW |