Chromium Code Reviews| 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 "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 void StartFetchAndWait() { | 49 void StartFetchAndWait() { |
| 50 uma_.reset(new base::HistogramTester()); | 50 uma_.reset(new base::HistogramTester()); |
| 51 StartFetch(FROM_CHROME_ONLY); | 51 StartFetch(FROM_CHROME_ONLY); |
| 52 content::RunMessageLoop(); | 52 content::RunMessageLoop(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Returns a HistogramTester which observed the most recent call to | 55 // Returns a HistogramTester which observed the most recent call to |
| 56 // StartFetchAndWait(). | 56 // StartFetchAndWait(). |
| 57 base::HistogramTester* uma() { return uma_.get(); } | 57 base::HistogramTester* uma() { return uma_.get(); } |
| 58 | 58 |
| 59 int GetOutOfProcessIframeCount() { | |
| 60 std::vector<Bucket> buckets = | |
| 61 uma_->GetAllSamples("SiteIsolation.OutOfProcessIframes"); | |
| 62 CHECK_EQ(1U, buckets.size()); | |
| 63 return buckets[0].min; | |
| 64 } | |
| 65 | |
| 59 size_t CountPageTitles() { | 66 size_t CountPageTitles() { |
| 60 size_t count = 0; | 67 size_t count = 0; |
| 61 for (const ProcessMemoryInformation& process : ChromeBrowser()->processes) { | 68 for (const ProcessMemoryInformation& process : ChromeBrowser()->processes) { |
| 62 if (process.process_type == content::PROCESS_TYPE_RENDERER) { | 69 if (process.process_type == content::PROCESS_TYPE_RENDERER) { |
| 63 count += process.titles.size(); | 70 count += process.titles.size(); |
| 64 } | 71 } |
| 65 } | 72 } |
| 66 return count; | 73 return count; |
| 67 } | 74 } |
| 68 | 75 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 256 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 250 ElementsAre(Bucket(1, 1))); | 257 ElementsAre(Bucket(1, 1))); |
| 251 EXPECT_THAT(details->uma()->GetAllSamples( | 258 EXPECT_THAT(details->uma()->GetAllSamples( |
| 252 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 259 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 253 ElementsAre(Bucket(1, 1))); | 260 ElementsAre(Bucket(1, 1))); |
| 254 EXPECT_THAT(details->uma()->GetAllSamples( | 261 EXPECT_THAT(details->uma()->GetAllSamples( |
| 255 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 262 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 256 ElementsAre(Bucket(1, 1))); | 263 ElementsAre(Bucket(1, 1))); |
| 257 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); | 264 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); |
| 258 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(9)); | 265 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(9)); |
| 266 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 267 EqualsIfExtensionsIsolated(0)); | |
| 268 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 269 EqualsIfSitePerProcess(14)); | |
| 259 | 270 |
| 260 // Navigate to a different, disjoint set of 7 sites. | 271 // Navigate to a different, disjoint set of 7 sites. |
| 261 GURL pqrstuv_url = embedded_test_server()->GetURL( | 272 GURL pqrstuv_url = embedded_test_server()->GetURL( |
| 262 "p.com", | 273 "p.com", |
| 263 "/cross_site_iframe_factory.html?p(q(r),r(s),s(t),t(q),u(u),v(p))"); | 274 "/cross_site_iframe_factory.html?p(q(r),r(s),s(t),t(q),u(u),v(p))"); |
| 264 ui_test_utils::NavigateToURL(browser(), pqrstuv_url); | 275 ui_test_utils::NavigateToURL(browser(), pqrstuv_url); |
| 265 | 276 |
| 266 details = new TestMemoryDetails(); | 277 details = new TestMemoryDetails(); |
| 267 details->StartFetchAndWait(); | 278 details->StartFetchAndWait(); |
| 268 | 279 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 298 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 309 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 299 ElementsAre(Bucket(1, 1))); | 310 ElementsAre(Bucket(1, 1))); |
| 300 EXPECT_THAT(details->uma()->GetAllSamples( | 311 EXPECT_THAT(details->uma()->GetAllSamples( |
| 301 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 312 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 302 ElementsAre(Bucket(1, 1))); | 313 ElementsAre(Bucket(1, 1))); |
| 303 EXPECT_THAT(details->uma()->GetAllSamples( | 314 EXPECT_THAT(details->uma()->GetAllSamples( |
| 304 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 315 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 305 ElementsAre(Bucket(1, 1))); | 316 ElementsAre(Bucket(1, 1))); |
| 306 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); | 317 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); |
| 307 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(7)); | 318 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(7)); |
| 319 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 320 EqualsIfExtensionsIsolated(0)); | |
| 321 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 322 EqualsIfSitePerProcess(11)); | |
| 308 | 323 |
| 309 // Open a second tab (different BrowsingInstance) with 4 sites (a through d). | 324 // Open a second tab (different BrowsingInstance) with 4 sites (a through d). |
| 310 GURL abcd_url = embedded_test_server()->GetURL( | 325 GURL abcd_url = embedded_test_server()->GetURL( |
| 311 "a.com", "/cross_site_iframe_factory.html?a(b(c(d())))"); | 326 "a.com", "/cross_site_iframe_factory.html?a(b(c(d())))"); |
| 312 AddTabAtIndex(1, abcd_url, ui::PAGE_TRANSITION_TYPED); | 327 AddTabAtIndex(1, abcd_url, ui::PAGE_TRANSITION_TYPED); |
| 313 | 328 |
| 314 details = new TestMemoryDetails(); | 329 details = new TestMemoryDetails(); |
| 315 details->StartFetchAndWait(); | 330 details->StartFetchAndWait(); |
| 316 | 331 |
| 317 EXPECT_EQ(2U, details->CountPageTitles()); | 332 EXPECT_EQ(2U, details->CountPageTitles()); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 346 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 361 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 347 ElementsAre(Bucket(2, 1))); | 362 ElementsAre(Bucket(2, 1))); |
| 348 EXPECT_THAT(details->uma()->GetAllSamples( | 363 EXPECT_THAT(details->uma()->GetAllSamples( |
| 349 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 364 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 350 ElementsAre(Bucket(1, 1))); | 365 ElementsAre(Bucket(1, 1))); |
| 351 EXPECT_THAT(details->uma()->GetAllSamples( | 366 EXPECT_THAT(details->uma()->GetAllSamples( |
| 352 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 367 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 353 ElementsAre(Bucket(2, 1))); | 368 ElementsAre(Bucket(2, 1))); |
| 354 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(2)); | 369 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(2)); |
| 355 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(11)); | 370 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(11)); |
| 371 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 372 EqualsIfExtensionsIsolated(0)); | |
| 373 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 374 EqualsIfSitePerProcess(14)); | |
| 356 | 375 |
| 357 // Open a third tab (different BrowsingInstance) with the same 4 sites. | 376 // Open a third tab (different BrowsingInstance) with the same 4 sites. |
| 358 AddTabAtIndex(2, abcd_url, ui::PAGE_TRANSITION_TYPED); | 377 AddTabAtIndex(2, abcd_url, ui::PAGE_TRANSITION_TYPED); |
| 359 | 378 |
| 360 details = new TestMemoryDetails(); | 379 details = new TestMemoryDetails(); |
| 361 details->StartFetchAndWait(); | 380 details->StartFetchAndWait(); |
| 362 | 381 |
| 363 EXPECT_THAT( | 382 EXPECT_THAT( |
| 364 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), | 383 details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"), |
| 365 ElementsAre(Bucket(3, 1))); | 384 ElementsAre(Bucket(3, 1))); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 392 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 411 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 393 ElementsAre(Bucket(3, 1))); | 412 ElementsAre(Bucket(3, 1))); |
| 394 EXPECT_THAT(details->uma()->GetAllSamples( | 413 EXPECT_THAT(details->uma()->GetAllSamples( |
| 395 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 414 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 396 ElementsAre(Bucket(1, 1))); | 415 ElementsAre(Bucket(1, 1))); |
| 397 EXPECT_THAT(details->uma()->GetAllSamples( | 416 EXPECT_THAT(details->uma()->GetAllSamples( |
| 398 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 417 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 399 ElementsAre(Bucket(3, 1))); | 418 ElementsAre(Bucket(3, 1))); |
| 400 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 419 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
| 401 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(15)); | 420 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(15)); |
| 421 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 422 EqualsIfExtensionsIsolated(0)); | |
| 423 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 424 EqualsIfSitePerProcess(17)); | |
| 402 | 425 |
| 403 // From the third tab, window.open() a fourth tab in the same | 426 // From the third tab, window.open() a fourth tab in the same |
| 404 // BrowsingInstance, to a page using the same four sites "a-d" as third tab, | 427 // BrowsingInstance, to a page using the same four sites "a-d" as third tab, |
| 405 // plus an additional site "e". The estimated process counts should increase | 428 // plus an additional site "e". The estimated process counts should increase |
| 406 // by one (not five) from the previous scenario, as the new tab can reuse the | 429 // by one (not five) from the previous scenario, as the new tab can reuse the |
| 407 // four processes already in the BrowsingInstance. | 430 // four processes already in the BrowsingInstance. |
| 408 GURL dcbae_url = embedded_test_server()->GetURL( | 431 GURL dcbae_url = embedded_test_server()->GetURL( |
| 409 "a.com", "/cross_site_iframe_factory.html?d(c(b(a(e))))"); | 432 "a.com", "/cross_site_iframe_factory.html?d(c(b(a(e))))"); |
| 410 ui_test_utils::UrlLoadObserver load_complete( | 433 ui_test_utils::UrlLoadObserver load_complete( |
| 411 dcbae_url, content::NotificationService::AllSources()); | 434 dcbae_url, content::NotificationService::AllSources()); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 474 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 452 ElementsAre(Bucket(3, 1))); | 475 ElementsAre(Bucket(3, 1))); |
| 453 EXPECT_THAT(details->uma()->GetAllSamples( | 476 EXPECT_THAT(details->uma()->GetAllSamples( |
| 454 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 477 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 455 ElementsAre(Bucket(1, 1))); | 478 ElementsAre(Bucket(1, 1))); |
| 456 EXPECT_THAT(details->uma()->GetAllSamples( | 479 EXPECT_THAT(details->uma()->GetAllSamples( |
| 457 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 480 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 458 ElementsAre(Bucket(3, 1))); | 481 ElementsAre(Bucket(3, 1))); |
| 459 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 482 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
| 460 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(16)); | 483 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(16)); |
| 484 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 485 EqualsIfExtensionsIsolated(0)); | |
| 486 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 487 EqualsIfSitePerProcess(21)); | |
| 461 } | 488 } |
| 462 | 489 |
| 463 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) { | 490 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) { |
| 464 // We start on "about:blank", which should be credited with a process in this | 491 // We start on "about:blank", which should be credited with a process in this |
| 465 // case. | 492 // case. |
| 466 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); | 493 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); |
| 467 details->StartFetchAndWait(); | 494 details->StartFetchAndWait(); |
| 468 EXPECT_THAT(details->uma()->GetAllSamples( | 495 EXPECT_THAT(details->uma()->GetAllSamples( |
| 469 "SiteIsolation.CurrentRendererProcessCount"), | 496 "SiteIsolation.CurrentRendererProcessCount"), |
| 470 ElementsAre(Bucket(GetRenderProcessCount(), 1))); | 497 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 471 EXPECT_THAT(details->uma()->GetAllSamples( | 498 EXPECT_THAT(details->uma()->GetAllSamples( |
| 472 "SiteIsolation.IsolateNothingProcessCountEstimate"), | 499 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
| 473 ElementsAre(Bucket(1, 1))); | 500 ElementsAre(Bucket(1, 1))); |
| 474 EXPECT_THAT(details->uma()->GetAllSamples( | 501 EXPECT_THAT(details->uma()->GetAllSamples( |
| 475 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 502 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 476 ElementsAre(Bucket(1, 1))); | 503 ElementsAre(Bucket(1, 1))); |
| 477 EXPECT_THAT(details->uma()->GetAllSamples( | 504 EXPECT_THAT(details->uma()->GetAllSamples( |
| 478 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 505 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 479 ElementsAre(Bucket(1, 1))); | 506 ElementsAre(Bucket(1, 1))); |
| 480 EXPECT_THAT(details->uma()->GetAllSamples( | 507 EXPECT_THAT(details->uma()->GetAllSamples( |
| 481 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 508 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 482 ElementsAre(Bucket(1, 1))); | 509 ElementsAre(Bucket(1, 1))); |
| 483 EXPECT_THAT(GetRenderProcessCount(), 1); | 510 EXPECT_THAT(GetRenderProcessCount(), 1); |
| 511 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 512 EqualsIfExtensionsIsolated(0)); | |
| 513 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(0)); | |
|
ncarter (slow)
2015/11/18 17:48:14
replace both of these with EXPECT_THAT's with
EXP
nasko
2015/11/18 18:32:58
Done.
| |
| 484 | 514 |
| 485 // Install one script-injecting extension with background page, and an | 515 // Install one script-injecting extension with background page, and an |
| 486 // extension with web accessible resources. | 516 // extension with web accessible resources. |
| 487 const Extension* extension1 = CreateExtension("Extension One", true); | 517 const Extension* extension1 = CreateExtension("Extension One", true); |
| 488 const Extension* extension2 = CreateExtension("Extension Two", false); | 518 const Extension* extension2 = CreateExtension("Extension Two", false); |
| 489 | 519 |
| 490 // Open two a.com tabs (with cross site http iframes). IsolateExtensions mode | 520 // Open two a.com tabs (with cross site http iframes). IsolateExtensions mode |
| 491 // should have no effect so far, since there are no frames straddling the | 521 // should have no effect so far, since there are no frames straddling the |
| 492 // extension/web boundary. | 522 // extension/web boundary. |
| 493 GURL tab1_url = embedded_test_server()->GetURL( | 523 GURL tab1_url = embedded_test_server()->GetURL( |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 510 EXPECT_THAT(details->uma()->GetAllSamples( | 540 EXPECT_THAT(details->uma()->GetAllSamples( |
| 511 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 541 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 512 ElementsAre(Bucket(3, 1))); | 542 ElementsAre(Bucket(3, 1))); |
| 513 EXPECT_THAT(details->uma()->GetAllSamples( | 543 EXPECT_THAT(details->uma()->GetAllSamples( |
| 514 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 544 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 515 ElementsAre(Bucket(2, 1))); | 545 ElementsAre(Bucket(2, 1))); |
| 516 EXPECT_THAT(details->uma()->GetAllSamples( | 546 EXPECT_THAT(details->uma()->GetAllSamples( |
| 517 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 547 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 518 ElementsAre(Bucket(3, 1))); | 548 ElementsAre(Bucket(3, 1))); |
| 519 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 549 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
| 550 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 551 EqualsIfExtensionsIsolated(0)); | |
| 552 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4)); | |
| 520 | 553 |
| 521 // Test that "one process per extension" applies even when web content has an | 554 // Test that "one process per extension" applies even when web content has an |
| 522 // extension iframe. | 555 // extension iframe. |
| 523 | 556 |
| 524 // Tab1 navigates its first iframe to a resource of extension1. This shouldn't | 557 // Tab1 navigates its first iframe to a resource of extension1. This shouldn't |
| 525 // result in a new extension process (it should share with extension1's | 558 // result in a new extension process (it should share with extension1's |
| 526 // background page). | 559 // background page). |
| 527 content::NavigateIframeToURL( | 560 content::NavigateIframeToURL( |
| 528 tab1, "child-0", extension1->GetResourceURL("/blank_iframe.html")); | 561 tab1, "child-0", extension1->GetResourceURL("/blank_iframe.html")); |
| 529 details = new TestMemoryDetails(); | 562 details = new TestMemoryDetails(); |
| 530 details->StartFetchAndWait(); | 563 details->StartFetchAndWait(); |
| 531 EXPECT_THAT(details->uma()->GetAllSamples( | 564 EXPECT_THAT(details->uma()->GetAllSamples( |
| 532 "SiteIsolation.CurrentRendererProcessCount"), | 565 "SiteIsolation.CurrentRendererProcessCount"), |
| 533 ElementsAre(Bucket(GetRenderProcessCount(), 1))); | 566 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 534 EXPECT_THAT(details->uma()->GetAllSamples( | 567 EXPECT_THAT(details->uma()->GetAllSamples( |
| 535 "SiteIsolation.IsolateNothingProcessCountEstimate"), | 568 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
| 536 ElementsAre(Bucket(3, 1))); | 569 ElementsAre(Bucket(3, 1))); |
| 537 EXPECT_THAT(details->uma()->GetAllSamples( | 570 EXPECT_THAT(details->uma()->GetAllSamples( |
| 538 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 571 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 539 ElementsAre(Bucket(3, 1))); | 572 ElementsAre(Bucket(3, 1))); |
| 540 EXPECT_THAT(details->uma()->GetAllSamples( | 573 EXPECT_THAT(details->uma()->GetAllSamples( |
| 541 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 574 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 542 ElementsAre(Bucket(2, 1))); | 575 ElementsAre(Bucket(2, 1))); |
| 543 EXPECT_THAT(details->uma()->GetAllSamples( | 576 EXPECT_THAT(details->uma()->GetAllSamples( |
| 544 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 577 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 545 ElementsAre(Bucket(3, 1))); | 578 ElementsAre(Bucket(3, 1))); |
| 546 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 579 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
| 580 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 581 EqualsIfExtensionsIsolated(1)); | |
| 582 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4)); | |
| 547 | 583 |
| 548 // Tab2 navigates its first iframe to a resource of extension1. This also | 584 // Tab2 navigates its first iframe to a resource of extension1. This also |
| 549 // shouldn't result in a new extension process (it should share with the | 585 // shouldn't result in a new extension process (it should share with the |
| 550 // background page and the other iframe). | 586 // background page and the other iframe). |
| 551 content::NavigateIframeToURL( | 587 content::NavigateIframeToURL( |
| 552 tab2, "child-0", extension1->GetResourceURL("/blank_iframe.html")); | 588 tab2, "child-0", extension1->GetResourceURL("/blank_iframe.html")); |
| 553 details = new TestMemoryDetails(); | 589 details = new TestMemoryDetails(); |
| 554 details->StartFetchAndWait(); | 590 details->StartFetchAndWait(); |
| 555 EXPECT_THAT(details->uma()->GetAllSamples( | 591 EXPECT_THAT(details->uma()->GetAllSamples( |
| 556 "SiteIsolation.CurrentRendererProcessCount"), | 592 "SiteIsolation.CurrentRendererProcessCount"), |
| 557 ElementsAre(Bucket(GetRenderProcessCount(), 1))); | 593 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 558 EXPECT_THAT(details->uma()->GetAllSamples( | 594 EXPECT_THAT(details->uma()->GetAllSamples( |
| 559 "SiteIsolation.IsolateNothingProcessCountEstimate"), | 595 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
| 560 ElementsAre(Bucket(3, 1))); | 596 ElementsAre(Bucket(3, 1))); |
| 561 EXPECT_THAT(details->uma()->GetAllSamples( | 597 EXPECT_THAT(details->uma()->GetAllSamples( |
| 562 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 598 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 563 ElementsAre(Bucket(3, 1))); | 599 ElementsAre(Bucket(3, 1))); |
| 564 EXPECT_THAT(details->uma()->GetAllSamples( | 600 EXPECT_THAT(details->uma()->GetAllSamples( |
| 565 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 601 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 566 ElementsAre(Bucket(2, 1))); | 602 ElementsAre(Bucket(2, 1))); |
| 567 EXPECT_THAT(details->uma()->GetAllSamples( | 603 EXPECT_THAT(details->uma()->GetAllSamples( |
| 568 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 604 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 569 ElementsAre(Bucket(3, 1))); | 605 ElementsAre(Bucket(3, 1))); |
| 570 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 606 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
| 607 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 608 EqualsIfExtensionsIsolated(2)); | |
| 609 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4)); | |
| 571 | 610 |
| 572 // Tab1 navigates its second iframe to a resource of extension2. This SHOULD | 611 // Tab1 navigates its second iframe to a resource of extension2. This SHOULD |
| 573 // result in a new process since extension2 had no existing process. | 612 // result in a new process since extension2 had no existing process. |
| 574 content::NavigateIframeToURL( | 613 content::NavigateIframeToURL( |
| 575 tab1, "child-1", extension2->GetResourceURL("/blank_iframe.html")); | 614 tab1, "child-1", extension2->GetResourceURL("/blank_iframe.html")); |
| 576 details = new TestMemoryDetails(); | 615 details = new TestMemoryDetails(); |
| 577 details->StartFetchAndWait(); | 616 details->StartFetchAndWait(); |
| 578 EXPECT_THAT(details->uma()->GetAllSamples( | 617 EXPECT_THAT(details->uma()->GetAllSamples( |
| 579 "SiteIsolation.CurrentRendererProcessCount"), | 618 "SiteIsolation.CurrentRendererProcessCount"), |
| 580 ElementsAre(Bucket(GetRenderProcessCount(), 1))); | 619 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 581 EXPECT_THAT(details->uma()->GetAllSamples( | 620 EXPECT_THAT(details->uma()->GetAllSamples( |
| 582 "SiteIsolation.IsolateNothingProcessCountEstimate"), | 621 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
| 583 ElementsAre(Bucket(3, 1))); | 622 ElementsAre(Bucket(3, 1))); |
| 584 EXPECT_THAT(details->uma()->GetAllSamples( | 623 EXPECT_THAT(details->uma()->GetAllSamples( |
| 585 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 624 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 586 ElementsAre(Bucket(4, 1))); | 625 ElementsAre(Bucket(4, 1))); |
| 587 EXPECT_THAT(details->uma()->GetAllSamples( | 626 EXPECT_THAT(details->uma()->GetAllSamples( |
| 588 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 627 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 589 ElementsAre(Bucket(3, 1))); | 628 ElementsAre(Bucket(3, 1))); |
| 590 EXPECT_THAT(details->uma()->GetAllSamples( | 629 EXPECT_THAT(details->uma()->GetAllSamples( |
| 591 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 630 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 592 ElementsAre(Bucket(4, 1))); | 631 ElementsAre(Bucket(4, 1))); |
| 593 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); | 632 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); |
| 633 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 634 EqualsIfExtensionsIsolated(3)); | |
| 635 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4)); | |
| 594 | 636 |
| 595 // Tab2 navigates its second iframe to a resource of extension2. This should | 637 // Tab2 navigates its second iframe to a resource of extension2. This should |
| 596 // share the existing extension2 process. | 638 // share the existing extension2 process. |
| 597 content::NavigateIframeToURL( | 639 content::NavigateIframeToURL( |
| 598 tab2, "child-1", extension2->GetResourceURL("/blank_iframe.html")); | 640 tab2, "child-1", extension2->GetResourceURL("/blank_iframe.html")); |
| 599 details = new TestMemoryDetails(); | 641 details = new TestMemoryDetails(); |
| 600 details->StartFetchAndWait(); | 642 details->StartFetchAndWait(); |
| 601 EXPECT_THAT(details->uma()->GetAllSamples( | 643 EXPECT_THAT(details->uma()->GetAllSamples( |
| 602 "SiteIsolation.CurrentRendererProcessCount"), | 644 "SiteIsolation.CurrentRendererProcessCount"), |
| 603 ElementsAre(Bucket(GetRenderProcessCount(), 1))); | 645 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 604 EXPECT_THAT(details->uma()->GetAllSamples( | 646 EXPECT_THAT(details->uma()->GetAllSamples( |
| 605 "SiteIsolation.IsolateNothingProcessCountEstimate"), | 647 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
| 606 ElementsAre(Bucket(3, 1))); | 648 ElementsAre(Bucket(3, 1))); |
| 607 EXPECT_THAT(details->uma()->GetAllSamples( | 649 EXPECT_THAT(details->uma()->GetAllSamples( |
| 608 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 650 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 609 ElementsAre(Bucket(4, 1))); | 651 ElementsAre(Bucket(4, 1))); |
| 610 EXPECT_THAT(details->uma()->GetAllSamples( | 652 EXPECT_THAT(details->uma()->GetAllSamples( |
| 611 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 653 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 612 ElementsAre(Bucket(3, 1))); | 654 ElementsAre(Bucket(3, 1))); |
| 613 EXPECT_THAT(details->uma()->GetAllSamples( | 655 EXPECT_THAT(details->uma()->GetAllSamples( |
| 614 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 656 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 615 ElementsAre(Bucket(4, 1))); | 657 ElementsAre(Bucket(4, 1))); |
| 616 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); | 658 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); |
| 659 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 660 EqualsIfExtensionsIsolated(4)); | |
| 661 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4)); | |
| 617 | 662 |
| 618 // Install extension3 (identical config to extension2) | 663 // Install extension3 (identical config to extension2) |
| 619 const Extension* extension3 = CreateExtension("Extension Three", false); | 664 const Extension* extension3 = CreateExtension("Extension Three", false); |
| 620 | 665 |
| 621 // Navigate Tab2 to a top-level page from extension3. There are four processes | 666 // Navigate Tab2 to a top-level page from extension3. There are four processes |
| 622 // now: one for tab1's main frame, and one for each of the extensions: | 667 // now: one for tab1's main frame, and one for each of the extensions: |
| 623 // extension1 has a process because it has a background page; extension2 is | 668 // extension1 has a process because it has a background page; extension2 is |
| 624 // used as an iframe in tab1, and extension3 is the top-level frame in tab2. | 669 // used as an iframe in tab1, and extension3 is the top-level frame in tab2. |
| 625 ui_test_utils::NavigateToURL(browser(), | 670 ui_test_utils::NavigateToURL(browser(), |
| 626 extension3->GetResourceURL("blank_iframe.html")); | 671 extension3->GetResourceURL("blank_iframe.html")); |
| 627 details = new TestMemoryDetails(); | 672 details = new TestMemoryDetails(); |
| 628 details->StartFetchAndWait(); | 673 details->StartFetchAndWait(); |
| 629 EXPECT_THAT(details->uma()->GetAllSamples( | 674 EXPECT_THAT(details->uma()->GetAllSamples( |
| 630 "SiteIsolation.CurrentRendererProcessCount"), | 675 "SiteIsolation.CurrentRendererProcessCount"), |
| 631 ElementsAre(Bucket(GetRenderProcessCount(), 1))); | 676 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 632 EXPECT_THAT(details->uma()->GetAllSamples( | 677 EXPECT_THAT(details->uma()->GetAllSamples( |
| 633 "SiteIsolation.IsolateNothingProcessCountEstimate"), | 678 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
| 634 ElementsAre(Bucket(3, 1))); | 679 ElementsAre(Bucket(3, 1))); |
| 635 EXPECT_THAT(details->uma()->GetAllSamples( | 680 EXPECT_THAT(details->uma()->GetAllSamples( |
| 636 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 681 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 637 ElementsAre(Bucket(4, 1))); | 682 ElementsAre(Bucket(4, 1))); |
| 638 EXPECT_THAT(details->uma()->GetAllSamples( | 683 EXPECT_THAT(details->uma()->GetAllSamples( |
| 639 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 684 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 640 ElementsAre(Bucket(4, 1))); | 685 ElementsAre(Bucket(4, 1))); |
| 641 EXPECT_THAT(details->uma()->GetAllSamples( | 686 EXPECT_THAT(details->uma()->GetAllSamples( |
| 642 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 687 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 643 ElementsAre(Bucket(4, 1))); | 688 ElementsAre(Bucket(4, 1))); |
| 644 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); | 689 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); |
| 690 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 691 EqualsIfExtensionsIsolated(2)); | |
| 692 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(2)); | |
| 645 | 693 |
| 646 // Navigate tab2 to a different extension3 page containing a web iframe. The | 694 // Navigate tab2 to a different extension3 page containing a web iframe. The |
| 647 // iframe should get its own process. The lower bound number indicates that, | 695 // iframe should get its own process. The lower bound number indicates that, |
| 648 // in theory, the iframe could share a process with tab1's main frame. | 696 // in theory, the iframe could share a process with tab1's main frame. |
| 649 ui_test_utils::NavigateToURL(browser(), | 697 ui_test_utils::NavigateToURL(browser(), |
| 650 extension3->GetResourceURL("http_iframe.html")); | 698 extension3->GetResourceURL("http_iframe.html")); |
| 651 details = new TestMemoryDetails(); | 699 details = new TestMemoryDetails(); |
| 652 details->StartFetchAndWait(); | 700 details->StartFetchAndWait(); |
| 653 EXPECT_THAT(details->uma()->GetAllSamples( | 701 EXPECT_THAT(details->uma()->GetAllSamples( |
| 654 "SiteIsolation.CurrentRendererProcessCount"), | 702 "SiteIsolation.CurrentRendererProcessCount"), |
| 655 ElementsAre(Bucket(GetRenderProcessCount(), 1))); | 703 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 656 EXPECT_THAT(details->uma()->GetAllSamples( | 704 EXPECT_THAT(details->uma()->GetAllSamples( |
| 657 "SiteIsolation.IsolateNothingProcessCountEstimate"), | 705 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
| 658 ElementsAre(Bucket(3, 1))); | 706 ElementsAre(Bucket(3, 1))); |
| 659 EXPECT_THAT(details->uma()->GetAllSamples( | 707 EXPECT_THAT(details->uma()->GetAllSamples( |
| 660 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 708 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 661 ElementsAre(Bucket(5, 1))); | 709 ElementsAre(Bucket(5, 1))); |
| 662 EXPECT_THAT(details->uma()->GetAllSamples( | 710 EXPECT_THAT(details->uma()->GetAllSamples( |
| 663 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 711 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 664 ElementsAre(Bucket(4, 1))); | 712 ElementsAre(Bucket(4, 1))); |
| 665 EXPECT_THAT(details->uma()->GetAllSamples( | 713 EXPECT_THAT(details->uma()->GetAllSamples( |
| 666 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 714 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 667 ElementsAre(Bucket(5, 1))); | 715 ElementsAre(Bucket(5, 1))); |
| 668 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(5)); | 716 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(5)); |
| 717 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 718 EqualsIfExtensionsIsolated(3)); | |
| 719 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(3)); | |
| 669 | 720 |
| 670 // Navigate tab1 to an extension3 page with an extension3 iframe. There should | 721 // Navigate tab1 to an extension3 page with an extension3 iframe. There should |
| 671 // be three processes estimated by IsolateExtensions: one for extension3, one | 722 // be three processes estimated by IsolateExtensions: one for extension3, one |
| 672 // for extension1's background page, and one for the web iframe in tab2. | 723 // for extension1's background page, and one for the web iframe in tab2. |
| 673 browser()->tab_strip_model()->ActivateTabAt(0, true); | 724 browser()->tab_strip_model()->ActivateTabAt(0, true); |
| 674 ui_test_utils::NavigateToURL(browser(), | 725 ui_test_utils::NavigateToURL(browser(), |
| 675 extension3->GetResourceURL("blank_iframe.html")); | 726 extension3->GetResourceURL("blank_iframe.html")); |
| 676 details = new TestMemoryDetails(); | 727 details = new TestMemoryDetails(); |
| 677 details->StartFetchAndWait(); | 728 details->StartFetchAndWait(); |
| 678 EXPECT_THAT(details->uma()->GetAllSamples( | 729 EXPECT_THAT(details->uma()->GetAllSamples( |
| 679 "SiteIsolation.CurrentRendererProcessCount"), | 730 "SiteIsolation.CurrentRendererProcessCount"), |
| 680 ElementsAre(Bucket(GetRenderProcessCount(), 1))); | 731 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 681 EXPECT_THAT(details->uma()->GetAllSamples( | 732 EXPECT_THAT(details->uma()->GetAllSamples( |
| 682 "SiteIsolation.IsolateNothingProcessCountEstimate"), | 733 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
| 683 ElementsAre(Bucket(2, 1))); | 734 ElementsAre(Bucket(2, 1))); |
| 684 EXPECT_THAT(details->uma()->GetAllSamples( | 735 EXPECT_THAT(details->uma()->GetAllSamples( |
| 685 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 736 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 686 ElementsAre(Bucket(3, 1))); | 737 ElementsAre(Bucket(3, 1))); |
| 687 EXPECT_THAT(details->uma()->GetAllSamples( | 738 EXPECT_THAT(details->uma()->GetAllSamples( |
| 688 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 739 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 689 ElementsAre(Bucket(3, 1))); | 740 ElementsAre(Bucket(3, 1))); |
| 690 EXPECT_THAT(details->uma()->GetAllSamples( | 741 EXPECT_THAT(details->uma()->GetAllSamples( |
| 691 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 742 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 692 ElementsAre(Bucket(3, 1))); | 743 ElementsAre(Bucket(3, 1))); |
| 693 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 744 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
| 745 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 746 EqualsIfExtensionsIsolated(1)); | |
| 747 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1)); | |
| 694 | 748 |
| 695 // Now navigate tab1 to an extension3 page with a web iframe. This could share | 749 // Now navigate tab1 to an extension3 page with a web iframe. This could share |
| 696 // a process with tab2's iframe (the LowerBound number), or it could get its | 750 // a process with tab2's iframe (the LowerBound number), or it could get its |
| 697 // own process (the Estimate number). | 751 // own process (the Estimate number). |
| 698 ui_test_utils::NavigateToURL(browser(), | 752 ui_test_utils::NavigateToURL(browser(), |
| 699 extension3->GetResourceURL("http_iframe.html")); | 753 extension3->GetResourceURL("http_iframe.html")); |
| 700 details = new TestMemoryDetails(); | 754 details = new TestMemoryDetails(); |
| 701 details->StartFetchAndWait(); | 755 details->StartFetchAndWait(); |
| 702 EXPECT_THAT(details->uma()->GetAllSamples( | 756 EXPECT_THAT(details->uma()->GetAllSamples( |
| 703 "SiteIsolation.CurrentRendererProcessCount"), | 757 "SiteIsolation.CurrentRendererProcessCount"), |
| 704 ElementsAre(Bucket(GetRenderProcessCount(), 1))); | 758 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 705 EXPECT_THAT(details->uma()->GetAllSamples( | 759 EXPECT_THAT(details->uma()->GetAllSamples( |
| 706 "SiteIsolation.IsolateNothingProcessCountEstimate"), | 760 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
| 707 ElementsAre(Bucket(2, 1))); | 761 ElementsAre(Bucket(2, 1))); |
| 708 EXPECT_THAT(details->uma()->GetAllSamples( | 762 EXPECT_THAT(details->uma()->GetAllSamples( |
| 709 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 763 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 710 ElementsAre(Bucket(4, 1))); | 764 ElementsAre(Bucket(4, 1))); |
| 711 EXPECT_THAT(details->uma()->GetAllSamples( | 765 EXPECT_THAT(details->uma()->GetAllSamples( |
| 712 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 766 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 713 ElementsAre(Bucket(3, 1))); | 767 ElementsAre(Bucket(3, 1))); |
| 714 EXPECT_THAT(details->uma()->GetAllSamples( | 768 EXPECT_THAT(details->uma()->GetAllSamples( |
| 715 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 769 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 716 ElementsAre(Bucket(4, 1))); | 770 ElementsAre(Bucket(4, 1))); |
| 717 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); | 771 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); |
| 772 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 773 EqualsIfExtensionsIsolated(2)); | |
| 774 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(2)); | |
| 718 } | 775 } |
| 719 | 776 |
| 720 // Exercises accounting in the case where an extension has two different-site | 777 // Exercises accounting in the case where an extension has two different-site |
| 721 // web iframes. | 778 // web iframes. |
| 722 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) { | 779 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) { |
| 723 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); | 780 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); |
| 724 details->StartFetchAndWait(); | 781 details->StartFetchAndWait(); |
| 725 | 782 |
| 726 // Install one script-injecting extension with background page, and an | 783 // Install one script-injecting extension with background page, and an |
| 727 // extension with web accessible resources. | 784 // extension with web accessible resources. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 743 ElementsAre(Bucket(2, 1))); | 800 ElementsAre(Bucket(2, 1))); |
| 744 EXPECT_THAT(details->uma()->GetAllSamples( | 801 EXPECT_THAT(details->uma()->GetAllSamples( |
| 745 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 802 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 746 ElementsAre(Bucket(2, 1))); | 803 ElementsAre(Bucket(2, 1))); |
| 747 EXPECT_THAT(details->uma()->GetAllSamples( | 804 EXPECT_THAT(details->uma()->GetAllSamples( |
| 748 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 805 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 749 ElementsAre(Bucket(2, 1))); | 806 ElementsAre(Bucket(2, 1))); |
| 750 // TODO(nick): https://crbug.com/512560 Make the number below agree with the | 807 // TODO(nick): https://crbug.com/512560 Make the number below agree with the |
| 751 // estimates above, which assume consolidation of subframe processes. | 808 // estimates above, which assume consolidation of subframe processes. |
| 752 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 809 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
| 810 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 811 EqualsIfExtensionsIsolated(2)); | |
| 812 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(2)); | |
| 753 } | 813 } |
| 754 | 814 |
| 755 // Verifies that --isolate-extensions doesn't isolate hosted apps. | 815 // Verifies that --isolate-extensions doesn't isolate hosted apps. |
| 756 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) { | 816 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) { |
| 757 GURL app_with_web_iframe_url = embedded_test_server()->GetURL( | 817 GURL app_with_web_iframe_url = embedded_test_server()->GetURL( |
| 758 "app.org", "/cross_site_iframe_factory.html?app.org(b.com)"); | 818 "app.org", "/cross_site_iframe_factory.html?app.org(b.com)"); |
| 759 GURL app_in_web_iframe_url = embedded_test_server()->GetURL( | 819 GURL app_in_web_iframe_url = embedded_test_server()->GetURL( |
| 760 "b.com", "/cross_site_iframe_factory.html?b.com(app.org)"); | 820 "b.com", "/cross_site_iframe_factory.html?b.com(app.org)"); |
| 761 | 821 |
| 762 // No hosted app is installed: app.org just behaves like a normal domain. | 822 // No hosted app is installed: app.org just behaves like a normal domain. |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 782 EXPECT_THAT(details->uma()->GetAllSamples( | 842 EXPECT_THAT(details->uma()->GetAllSamples( |
| 783 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 843 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
| 784 ElementsAre(Bucket(2, 1))); | 844 ElementsAre(Bucket(2, 1))); |
| 785 EXPECT_THAT(details->uma()->GetAllSamples( | 845 EXPECT_THAT(details->uma()->GetAllSamples( |
| 786 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 846 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
| 787 ElementsAre(Bucket(2, 1))); | 847 ElementsAre(Bucket(2, 1))); |
| 788 EXPECT_THAT(details->uma()->GetAllSamples( | 848 EXPECT_THAT(details->uma()->GetAllSamples( |
| 789 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 849 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
| 790 ElementsAre(Bucket(2, 1))); | 850 ElementsAre(Bucket(2, 1))); |
| 791 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); | 851 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); |
| 852 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 853 EqualsIfExtensionsIsolated(0)); | |
| 854 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1)); | |
| 792 | 855 |
| 793 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); | 856 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); |
| 794 details = new TestMemoryDetails(); | 857 details = new TestMemoryDetails(); |
| 795 details->StartFetchAndWait(); | 858 details->StartFetchAndWait(); |
| 796 EXPECT_THAT(details->uma()->GetAllSamples( | 859 EXPECT_THAT(details->uma()->GetAllSamples( |
| 797 "SiteIsolation.CurrentRendererProcessCount"), | 860 "SiteIsolation.CurrentRendererProcessCount"), |
| 798 ElementsAre(Bucket(GetRenderProcessCount(), 1))); | 861 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 799 EXPECT_THAT(details->uma()->GetAllSamples( | 862 EXPECT_THAT(details->uma()->GetAllSamples( |
| 800 "SiteIsolation.IsolateNothingProcessCountEstimate"), | 863 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
| 801 ElementsAre(Bucket(1, 1))); | 864 ElementsAre(Bucket(1, 1))); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 812 EXPECT_THAT(details->uma()->GetAllSamples( | 875 EXPECT_THAT(details->uma()->GetAllSamples( |
| 813 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 876 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
| 814 ElementsAre(Bucket(2, 1))); | 877 ElementsAre(Bucket(2, 1))); |
| 815 EXPECT_THAT(details->uma()->GetAllSamples( | 878 EXPECT_THAT(details->uma()->GetAllSamples( |
| 816 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 879 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
| 817 ElementsAre(Bucket(2, 1))); | 880 ElementsAre(Bucket(2, 1))); |
| 818 EXPECT_THAT(details->uma()->GetAllSamples( | 881 EXPECT_THAT(details->uma()->GetAllSamples( |
| 819 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 882 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
| 820 ElementsAre(Bucket(2, 1))); | 883 ElementsAre(Bucket(2, 1))); |
| 821 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); | 884 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); |
| 885 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 886 EqualsIfExtensionsIsolated(0)); | |
| 887 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1)); | |
| 822 | 888 |
| 823 // Now install app.org as a hosted app. | 889 // Now install app.org as a hosted app. |
| 824 CreateHostedApp("App", GURL("http://app.org")); | 890 CreateHostedApp("App", GURL("http://app.org")); |
| 825 | 891 |
| 826 // Reload the same two pages, and verify that the hosted app still is not | 892 // Reload the same two pages, and verify that the hosted app still is not |
| 827 // isolated by --isolate-extensions, but is isolated by --site-per-process. | 893 // isolated by --isolate-extensions, but is isolated by --site-per-process. |
| 828 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); | 894 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); |
| 829 details = new TestMemoryDetails(); | 895 details = new TestMemoryDetails(); |
| 830 details->StartFetchAndWait(); | 896 details->StartFetchAndWait(); |
| 831 EXPECT_THAT(details->uma()->GetAllSamples( | 897 EXPECT_THAT(details->uma()->GetAllSamples( |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 847 EXPECT_THAT(details->uma()->GetAllSamples( | 913 EXPECT_THAT(details->uma()->GetAllSamples( |
| 848 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 914 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
| 849 ElementsAre(Bucket(2, 1))); | 915 ElementsAre(Bucket(2, 1))); |
| 850 EXPECT_THAT(details->uma()->GetAllSamples( | 916 EXPECT_THAT(details->uma()->GetAllSamples( |
| 851 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 917 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
| 852 ElementsAre(Bucket(2, 1))); | 918 ElementsAre(Bucket(2, 1))); |
| 853 EXPECT_THAT(details->uma()->GetAllSamples( | 919 EXPECT_THAT(details->uma()->GetAllSamples( |
| 854 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 920 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
| 855 ElementsAre(Bucket(2, 1))); | 921 ElementsAre(Bucket(2, 1))); |
| 856 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); | 922 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); |
| 923 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 924 EqualsIfExtensionsIsolated(0)); | |
| 925 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1)); | |
| 857 | 926 |
| 858 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); | 927 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); |
| 859 details = new TestMemoryDetails(); | 928 details = new TestMemoryDetails(); |
| 860 details->StartFetchAndWait(); | 929 details->StartFetchAndWait(); |
| 861 EXPECT_THAT(details->uma()->GetAllSamples( | 930 EXPECT_THAT(details->uma()->GetAllSamples( |
| 862 "SiteIsolation.CurrentRendererProcessCount"), | 931 "SiteIsolation.CurrentRendererProcessCount"), |
| 863 ElementsAre(Bucket(GetRenderProcessCount(), 1))); | 932 ElementsAre(Bucket(GetRenderProcessCount(), 1))); |
| 864 EXPECT_THAT(details->uma()->GetAllSamples( | 933 EXPECT_THAT(details->uma()->GetAllSamples( |
| 865 "SiteIsolation.IsolateNothingProcessCountEstimate"), | 934 "SiteIsolation.IsolateNothingProcessCountEstimate"), |
| 866 ElementsAre(Bucket(1, 1))); | 935 ElementsAre(Bucket(1, 1))); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 877 EXPECT_THAT(details->uma()->GetAllSamples( | 946 EXPECT_THAT(details->uma()->GetAllSamples( |
| 878 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), | 947 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
| 879 ElementsAre(Bucket(2, 1))); | 948 ElementsAre(Bucket(2, 1))); |
| 880 EXPECT_THAT(details->uma()->GetAllSamples( | 949 EXPECT_THAT(details->uma()->GetAllSamples( |
| 881 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), | 950 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
| 882 ElementsAre(Bucket(2, 1))); | 951 ElementsAre(Bucket(2, 1))); |
| 883 EXPECT_THAT(details->uma()->GetAllSamples( | 952 EXPECT_THAT(details->uma()->GetAllSamples( |
| 884 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), | 953 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
| 885 ElementsAre(Bucket(2, 1))); | 954 ElementsAre(Bucket(2, 1))); |
| 886 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); | 955 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); |
| 956 EXPECT_THAT(details->GetOutOfProcessIframeCount(), | |
| 957 EqualsIfExtensionsIsolated(0)); | |
| 958 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1)); | |
| 887 } | 959 } |
| OLD | NEW |