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

Side by Side Diff: chrome/browser/site_details_browsertest.cc

Issue 1453193004: Add histogram for number of out-of-process iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initialize frames count in constructor. 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
« no previous file with comments | « chrome/browser/site_details.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
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
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
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_EQ(0, details->GetOutOfProcessIframeCount());
484 512
485 // Install one script-injecting extension with background page, and an 513 // Install one script-injecting extension with background page, and an
486 // extension with web accessible resources. 514 // extension with web accessible resources.
487 const Extension* extension1 = CreateExtension("Extension One", true); 515 const Extension* extension1 = CreateExtension("Extension One", true);
488 const Extension* extension2 = CreateExtension("Extension Two", false); 516 const Extension* extension2 = CreateExtension("Extension Two", false);
489 517
490 // Open two a.com tabs (with cross site http iframes). IsolateExtensions mode 518 // 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 519 // should have no effect so far, since there are no frames straddling the
492 // extension/web boundary. 520 // extension/web boundary.
493 GURL tab1_url = embedded_test_server()->GetURL( 521 GURL tab1_url = embedded_test_server()->GetURL(
(...skipping 16 matching lines...) Expand all
510 EXPECT_THAT(details->uma()->GetAllSamples( 538 EXPECT_THAT(details->uma()->GetAllSamples(
511 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), 539 "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
512 ElementsAre(Bucket(3, 1))); 540 ElementsAre(Bucket(3, 1)));
513 EXPECT_THAT(details->uma()->GetAllSamples( 541 EXPECT_THAT(details->uma()->GetAllSamples(
514 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), 542 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
515 ElementsAre(Bucket(2, 1))); 543 ElementsAre(Bucket(2, 1)));
516 EXPECT_THAT(details->uma()->GetAllSamples( 544 EXPECT_THAT(details->uma()->GetAllSamples(
517 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), 545 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
518 ElementsAre(Bucket(3, 1))); 546 ElementsAre(Bucket(3, 1)));
519 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); 547 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
548 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
549 EqualsIfExtensionsIsolated(0));
550 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4));
520 551
521 // Test that "one process per extension" applies even when web content has an 552 // Test that "one process per extension" applies even when web content has an
522 // extension iframe. 553 // extension iframe.
523 554
524 // Tab1 navigates its first iframe to a resource of extension1. This shouldn't 555 // 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 556 // result in a new extension process (it should share with extension1's
526 // background page). 557 // background page).
527 content::NavigateIframeToURL( 558 content::NavigateIframeToURL(
528 tab1, "child-0", extension1->GetResourceURL("/blank_iframe.html")); 559 tab1, "child-0", extension1->GetResourceURL("/blank_iframe.html"));
529 details = new TestMemoryDetails(); 560 details = new TestMemoryDetails();
530 details->StartFetchAndWait(); 561 details->StartFetchAndWait();
531 EXPECT_THAT(details->uma()->GetAllSamples( 562 EXPECT_THAT(details->uma()->GetAllSamples(
532 "SiteIsolation.CurrentRendererProcessCount"), 563 "SiteIsolation.CurrentRendererProcessCount"),
533 ElementsAre(Bucket(GetRenderProcessCount(), 1))); 564 ElementsAre(Bucket(GetRenderProcessCount(), 1)));
534 EXPECT_THAT(details->uma()->GetAllSamples( 565 EXPECT_THAT(details->uma()->GetAllSamples(
535 "SiteIsolation.IsolateNothingProcessCountEstimate"), 566 "SiteIsolation.IsolateNothingProcessCountEstimate"),
536 ElementsAre(Bucket(3, 1))); 567 ElementsAre(Bucket(3, 1)));
537 EXPECT_THAT(details->uma()->GetAllSamples( 568 EXPECT_THAT(details->uma()->GetAllSamples(
538 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), 569 "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
539 ElementsAre(Bucket(3, 1))); 570 ElementsAre(Bucket(3, 1)));
540 EXPECT_THAT(details->uma()->GetAllSamples( 571 EXPECT_THAT(details->uma()->GetAllSamples(
541 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), 572 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
542 ElementsAre(Bucket(2, 1))); 573 ElementsAre(Bucket(2, 1)));
543 EXPECT_THAT(details->uma()->GetAllSamples( 574 EXPECT_THAT(details->uma()->GetAllSamples(
544 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), 575 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
545 ElementsAre(Bucket(3, 1))); 576 ElementsAre(Bucket(3, 1)));
546 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); 577 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
578 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
579 EqualsIfExtensionsIsolated(1));
580 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4));
547 581
548 // Tab2 navigates its first iframe to a resource of extension1. This also 582 // 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 583 // shouldn't result in a new extension process (it should share with the
550 // background page and the other iframe). 584 // background page and the other iframe).
551 content::NavigateIframeToURL( 585 content::NavigateIframeToURL(
552 tab2, "child-0", extension1->GetResourceURL("/blank_iframe.html")); 586 tab2, "child-0", extension1->GetResourceURL("/blank_iframe.html"));
553 details = new TestMemoryDetails(); 587 details = new TestMemoryDetails();
554 details->StartFetchAndWait(); 588 details->StartFetchAndWait();
555 EXPECT_THAT(details->uma()->GetAllSamples( 589 EXPECT_THAT(details->uma()->GetAllSamples(
556 "SiteIsolation.CurrentRendererProcessCount"), 590 "SiteIsolation.CurrentRendererProcessCount"),
557 ElementsAre(Bucket(GetRenderProcessCount(), 1))); 591 ElementsAre(Bucket(GetRenderProcessCount(), 1)));
558 EXPECT_THAT(details->uma()->GetAllSamples( 592 EXPECT_THAT(details->uma()->GetAllSamples(
559 "SiteIsolation.IsolateNothingProcessCountEstimate"), 593 "SiteIsolation.IsolateNothingProcessCountEstimate"),
560 ElementsAre(Bucket(3, 1))); 594 ElementsAre(Bucket(3, 1)));
561 EXPECT_THAT(details->uma()->GetAllSamples( 595 EXPECT_THAT(details->uma()->GetAllSamples(
562 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), 596 "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
563 ElementsAre(Bucket(3, 1))); 597 ElementsAre(Bucket(3, 1)));
564 EXPECT_THAT(details->uma()->GetAllSamples( 598 EXPECT_THAT(details->uma()->GetAllSamples(
565 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), 599 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
566 ElementsAre(Bucket(2, 1))); 600 ElementsAre(Bucket(2, 1)));
567 EXPECT_THAT(details->uma()->GetAllSamples( 601 EXPECT_THAT(details->uma()->GetAllSamples(
568 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), 602 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
569 ElementsAre(Bucket(3, 1))); 603 ElementsAre(Bucket(3, 1)));
570 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); 604 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
605 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
606 EqualsIfExtensionsIsolated(2));
607 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4));
571 608
572 // Tab1 navigates its second iframe to a resource of extension2. This SHOULD 609 // Tab1 navigates its second iframe to a resource of extension2. This SHOULD
573 // result in a new process since extension2 had no existing process. 610 // result in a new process since extension2 had no existing process.
574 content::NavigateIframeToURL( 611 content::NavigateIframeToURL(
575 tab1, "child-1", extension2->GetResourceURL("/blank_iframe.html")); 612 tab1, "child-1", extension2->GetResourceURL("/blank_iframe.html"));
576 details = new TestMemoryDetails(); 613 details = new TestMemoryDetails();
577 details->StartFetchAndWait(); 614 details->StartFetchAndWait();
578 EXPECT_THAT(details->uma()->GetAllSamples( 615 EXPECT_THAT(details->uma()->GetAllSamples(
579 "SiteIsolation.CurrentRendererProcessCount"), 616 "SiteIsolation.CurrentRendererProcessCount"),
580 ElementsAre(Bucket(GetRenderProcessCount(), 1))); 617 ElementsAre(Bucket(GetRenderProcessCount(), 1)));
581 EXPECT_THAT(details->uma()->GetAllSamples( 618 EXPECT_THAT(details->uma()->GetAllSamples(
582 "SiteIsolation.IsolateNothingProcessCountEstimate"), 619 "SiteIsolation.IsolateNothingProcessCountEstimate"),
583 ElementsAre(Bucket(3, 1))); 620 ElementsAre(Bucket(3, 1)));
584 EXPECT_THAT(details->uma()->GetAllSamples( 621 EXPECT_THAT(details->uma()->GetAllSamples(
585 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), 622 "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
586 ElementsAre(Bucket(4, 1))); 623 ElementsAre(Bucket(4, 1)));
587 EXPECT_THAT(details->uma()->GetAllSamples( 624 EXPECT_THAT(details->uma()->GetAllSamples(
588 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), 625 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
589 ElementsAre(Bucket(3, 1))); 626 ElementsAre(Bucket(3, 1)));
590 EXPECT_THAT(details->uma()->GetAllSamples( 627 EXPECT_THAT(details->uma()->GetAllSamples(
591 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), 628 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
592 ElementsAre(Bucket(4, 1))); 629 ElementsAre(Bucket(4, 1)));
593 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); 630 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4));
631 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
632 EqualsIfExtensionsIsolated(3));
633 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4));
594 634
595 // Tab2 navigates its second iframe to a resource of extension2. This should 635 // Tab2 navigates its second iframe to a resource of extension2. This should
596 // share the existing extension2 process. 636 // share the existing extension2 process.
597 content::NavigateIframeToURL( 637 content::NavigateIframeToURL(
598 tab2, "child-1", extension2->GetResourceURL("/blank_iframe.html")); 638 tab2, "child-1", extension2->GetResourceURL("/blank_iframe.html"));
599 details = new TestMemoryDetails(); 639 details = new TestMemoryDetails();
600 details->StartFetchAndWait(); 640 details->StartFetchAndWait();
601 EXPECT_THAT(details->uma()->GetAllSamples( 641 EXPECT_THAT(details->uma()->GetAllSamples(
602 "SiteIsolation.CurrentRendererProcessCount"), 642 "SiteIsolation.CurrentRendererProcessCount"),
603 ElementsAre(Bucket(GetRenderProcessCount(), 1))); 643 ElementsAre(Bucket(GetRenderProcessCount(), 1)));
604 EXPECT_THAT(details->uma()->GetAllSamples( 644 EXPECT_THAT(details->uma()->GetAllSamples(
605 "SiteIsolation.IsolateNothingProcessCountEstimate"), 645 "SiteIsolation.IsolateNothingProcessCountEstimate"),
606 ElementsAre(Bucket(3, 1))); 646 ElementsAre(Bucket(3, 1)));
607 EXPECT_THAT(details->uma()->GetAllSamples( 647 EXPECT_THAT(details->uma()->GetAllSamples(
608 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), 648 "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
609 ElementsAre(Bucket(4, 1))); 649 ElementsAre(Bucket(4, 1)));
610 EXPECT_THAT(details->uma()->GetAllSamples( 650 EXPECT_THAT(details->uma()->GetAllSamples(
611 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), 651 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
612 ElementsAre(Bucket(3, 1))); 652 ElementsAre(Bucket(3, 1)));
613 EXPECT_THAT(details->uma()->GetAllSamples( 653 EXPECT_THAT(details->uma()->GetAllSamples(
614 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), 654 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
615 ElementsAre(Bucket(4, 1))); 655 ElementsAre(Bucket(4, 1)));
616 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); 656 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4));
657 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
658 EqualsIfExtensionsIsolated(4));
659 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4));
617 660
618 // Install extension3 (identical config to extension2) 661 // Install extension3 (identical config to extension2)
619 const Extension* extension3 = CreateExtension("Extension Three", false); 662 const Extension* extension3 = CreateExtension("Extension Three", false);
620 663
621 // Navigate Tab2 to a top-level page from extension3. There are four processes 664 // 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: 665 // 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 666 // 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. 667 // used as an iframe in tab1, and extension3 is the top-level frame in tab2.
625 ui_test_utils::NavigateToURL(browser(), 668 ui_test_utils::NavigateToURL(browser(),
626 extension3->GetResourceURL("blank_iframe.html")); 669 extension3->GetResourceURL("blank_iframe.html"));
627 details = new TestMemoryDetails(); 670 details = new TestMemoryDetails();
628 details->StartFetchAndWait(); 671 details->StartFetchAndWait();
629 EXPECT_THAT(details->uma()->GetAllSamples( 672 EXPECT_THAT(details->uma()->GetAllSamples(
630 "SiteIsolation.CurrentRendererProcessCount"), 673 "SiteIsolation.CurrentRendererProcessCount"),
631 ElementsAre(Bucket(GetRenderProcessCount(), 1))); 674 ElementsAre(Bucket(GetRenderProcessCount(), 1)));
632 EXPECT_THAT(details->uma()->GetAllSamples( 675 EXPECT_THAT(details->uma()->GetAllSamples(
633 "SiteIsolation.IsolateNothingProcessCountEstimate"), 676 "SiteIsolation.IsolateNothingProcessCountEstimate"),
634 ElementsAre(Bucket(3, 1))); 677 ElementsAre(Bucket(3, 1)));
635 EXPECT_THAT(details->uma()->GetAllSamples( 678 EXPECT_THAT(details->uma()->GetAllSamples(
636 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), 679 "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
637 ElementsAre(Bucket(4, 1))); 680 ElementsAre(Bucket(4, 1)));
638 EXPECT_THAT(details->uma()->GetAllSamples( 681 EXPECT_THAT(details->uma()->GetAllSamples(
639 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), 682 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
640 ElementsAre(Bucket(4, 1))); 683 ElementsAre(Bucket(4, 1)));
641 EXPECT_THAT(details->uma()->GetAllSamples( 684 EXPECT_THAT(details->uma()->GetAllSamples(
642 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), 685 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
643 ElementsAre(Bucket(4, 1))); 686 ElementsAre(Bucket(4, 1)));
644 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); 687 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4));
688 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
689 EqualsIfExtensionsIsolated(2));
690 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(2));
645 691
646 // Navigate tab2 to a different extension3 page containing a web iframe. The 692 // 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, 693 // 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. 694 // in theory, the iframe could share a process with tab1's main frame.
649 ui_test_utils::NavigateToURL(browser(), 695 ui_test_utils::NavigateToURL(browser(),
650 extension3->GetResourceURL("http_iframe.html")); 696 extension3->GetResourceURL("http_iframe.html"));
651 details = new TestMemoryDetails(); 697 details = new TestMemoryDetails();
652 details->StartFetchAndWait(); 698 details->StartFetchAndWait();
653 EXPECT_THAT(details->uma()->GetAllSamples( 699 EXPECT_THAT(details->uma()->GetAllSamples(
654 "SiteIsolation.CurrentRendererProcessCount"), 700 "SiteIsolation.CurrentRendererProcessCount"),
655 ElementsAre(Bucket(GetRenderProcessCount(), 1))); 701 ElementsAre(Bucket(GetRenderProcessCount(), 1)));
656 EXPECT_THAT(details->uma()->GetAllSamples( 702 EXPECT_THAT(details->uma()->GetAllSamples(
657 "SiteIsolation.IsolateNothingProcessCountEstimate"), 703 "SiteIsolation.IsolateNothingProcessCountEstimate"),
658 ElementsAre(Bucket(3, 1))); 704 ElementsAre(Bucket(3, 1)));
659 EXPECT_THAT(details->uma()->GetAllSamples( 705 EXPECT_THAT(details->uma()->GetAllSamples(
660 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), 706 "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
661 ElementsAre(Bucket(5, 1))); 707 ElementsAre(Bucket(5, 1)));
662 EXPECT_THAT(details->uma()->GetAllSamples( 708 EXPECT_THAT(details->uma()->GetAllSamples(
663 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), 709 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
664 ElementsAre(Bucket(4, 1))); 710 ElementsAre(Bucket(4, 1)));
665 EXPECT_THAT(details->uma()->GetAllSamples( 711 EXPECT_THAT(details->uma()->GetAllSamples(
666 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), 712 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
667 ElementsAre(Bucket(5, 1))); 713 ElementsAre(Bucket(5, 1)));
668 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(5)); 714 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(5));
715 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
716 EqualsIfExtensionsIsolated(3));
717 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(3));
669 718
670 // Navigate tab1 to an extension3 page with an extension3 iframe. There should 719 // Navigate tab1 to an extension3 page with an extension3 iframe. There should
671 // be three processes estimated by IsolateExtensions: one for extension3, one 720 // be three processes estimated by IsolateExtensions: one for extension3, one
672 // for extension1's background page, and one for the web iframe in tab2. 721 // for extension1's background page, and one for the web iframe in tab2.
673 browser()->tab_strip_model()->ActivateTabAt(0, true); 722 browser()->tab_strip_model()->ActivateTabAt(0, true);
674 ui_test_utils::NavigateToURL(browser(), 723 ui_test_utils::NavigateToURL(browser(),
675 extension3->GetResourceURL("blank_iframe.html")); 724 extension3->GetResourceURL("blank_iframe.html"));
676 details = new TestMemoryDetails(); 725 details = new TestMemoryDetails();
677 details->StartFetchAndWait(); 726 details->StartFetchAndWait();
678 EXPECT_THAT(details->uma()->GetAllSamples( 727 EXPECT_THAT(details->uma()->GetAllSamples(
679 "SiteIsolation.CurrentRendererProcessCount"), 728 "SiteIsolation.CurrentRendererProcessCount"),
680 ElementsAre(Bucket(GetRenderProcessCount(), 1))); 729 ElementsAre(Bucket(GetRenderProcessCount(), 1)));
681 EXPECT_THAT(details->uma()->GetAllSamples( 730 EXPECT_THAT(details->uma()->GetAllSamples(
682 "SiteIsolation.IsolateNothingProcessCountEstimate"), 731 "SiteIsolation.IsolateNothingProcessCountEstimate"),
683 ElementsAre(Bucket(2, 1))); 732 ElementsAre(Bucket(2, 1)));
684 EXPECT_THAT(details->uma()->GetAllSamples( 733 EXPECT_THAT(details->uma()->GetAllSamples(
685 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), 734 "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
686 ElementsAre(Bucket(3, 1))); 735 ElementsAre(Bucket(3, 1)));
687 EXPECT_THAT(details->uma()->GetAllSamples( 736 EXPECT_THAT(details->uma()->GetAllSamples(
688 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), 737 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
689 ElementsAre(Bucket(3, 1))); 738 ElementsAre(Bucket(3, 1)));
690 EXPECT_THAT(details->uma()->GetAllSamples( 739 EXPECT_THAT(details->uma()->GetAllSamples(
691 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), 740 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
692 ElementsAre(Bucket(3, 1))); 741 ElementsAre(Bucket(3, 1)));
693 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); 742 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
743 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
744 EqualsIfExtensionsIsolated(1));
745 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1));
694 746
695 // Now navigate tab1 to an extension3 page with a web iframe. This could share 747 // 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 748 // a process with tab2's iframe (the LowerBound number), or it could get its
697 // own process (the Estimate number). 749 // own process (the Estimate number).
698 ui_test_utils::NavigateToURL(browser(), 750 ui_test_utils::NavigateToURL(browser(),
699 extension3->GetResourceURL("http_iframe.html")); 751 extension3->GetResourceURL("http_iframe.html"));
700 details = new TestMemoryDetails(); 752 details = new TestMemoryDetails();
701 details->StartFetchAndWait(); 753 details->StartFetchAndWait();
702 EXPECT_THAT(details->uma()->GetAllSamples( 754 EXPECT_THAT(details->uma()->GetAllSamples(
703 "SiteIsolation.CurrentRendererProcessCount"), 755 "SiteIsolation.CurrentRendererProcessCount"),
704 ElementsAre(Bucket(GetRenderProcessCount(), 1))); 756 ElementsAre(Bucket(GetRenderProcessCount(), 1)));
705 EXPECT_THAT(details->uma()->GetAllSamples( 757 EXPECT_THAT(details->uma()->GetAllSamples(
706 "SiteIsolation.IsolateNothingProcessCountEstimate"), 758 "SiteIsolation.IsolateNothingProcessCountEstimate"),
707 ElementsAre(Bucket(2, 1))); 759 ElementsAre(Bucket(2, 1)));
708 EXPECT_THAT(details->uma()->GetAllSamples( 760 EXPECT_THAT(details->uma()->GetAllSamples(
709 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), 761 "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
710 ElementsAre(Bucket(4, 1))); 762 ElementsAre(Bucket(4, 1)));
711 EXPECT_THAT(details->uma()->GetAllSamples( 763 EXPECT_THAT(details->uma()->GetAllSamples(
712 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), 764 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
713 ElementsAre(Bucket(3, 1))); 765 ElementsAre(Bucket(3, 1)));
714 EXPECT_THAT(details->uma()->GetAllSamples( 766 EXPECT_THAT(details->uma()->GetAllSamples(
715 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), 767 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
716 ElementsAre(Bucket(4, 1))); 768 ElementsAre(Bucket(4, 1)));
717 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4)); 769 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4));
770 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
771 EqualsIfExtensionsIsolated(2));
772 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(2));
718 } 773 }
719 774
720 // Exercises accounting in the case where an extension has two different-site 775 // Exercises accounting in the case where an extension has two different-site
721 // web iframes. 776 // web iframes.
722 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) { 777 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) {
723 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); 778 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
724 details->StartFetchAndWait(); 779 details->StartFetchAndWait();
725 780
726 // Install one script-injecting extension with background page, and an 781 // Install one script-injecting extension with background page, and an
727 // extension with web accessible resources. 782 // extension with web accessible resources.
(...skipping 15 matching lines...) Expand all
743 ElementsAre(Bucket(2, 1))); 798 ElementsAre(Bucket(2, 1)));
744 EXPECT_THAT(details->uma()->GetAllSamples( 799 EXPECT_THAT(details->uma()->GetAllSamples(
745 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), 800 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
746 ElementsAre(Bucket(2, 1))); 801 ElementsAre(Bucket(2, 1)));
747 EXPECT_THAT(details->uma()->GetAllSamples( 802 EXPECT_THAT(details->uma()->GetAllSamples(
748 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), 803 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
749 ElementsAre(Bucket(2, 1))); 804 ElementsAre(Bucket(2, 1)));
750 // TODO(nick): https://crbug.com/512560 Make the number below agree with the 805 // TODO(nick): https://crbug.com/512560 Make the number below agree with the
751 // estimates above, which assume consolidation of subframe processes. 806 // estimates above, which assume consolidation of subframe processes.
752 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); 807 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
808 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
809 EqualsIfExtensionsIsolated(2));
810 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(2));
753 } 811 }
754 812
755 // Verifies that --isolate-extensions doesn't isolate hosted apps. 813 // Verifies that --isolate-extensions doesn't isolate hosted apps.
756 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) { 814 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) {
757 GURL app_with_web_iframe_url = embedded_test_server()->GetURL( 815 GURL app_with_web_iframe_url = embedded_test_server()->GetURL(
758 "app.org", "/cross_site_iframe_factory.html?app.org(b.com)"); 816 "app.org", "/cross_site_iframe_factory.html?app.org(b.com)");
759 GURL app_in_web_iframe_url = embedded_test_server()->GetURL( 817 GURL app_in_web_iframe_url = embedded_test_server()->GetURL(
760 "b.com", "/cross_site_iframe_factory.html?b.com(app.org)"); 818 "b.com", "/cross_site_iframe_factory.html?b.com(app.org)");
761 819
762 // No hosted app is installed: app.org just behaves like a normal domain. 820 // No hosted app is installed: app.org just behaves like a normal domain.
(...skipping 19 matching lines...) Expand all
782 EXPECT_THAT(details->uma()->GetAllSamples( 840 EXPECT_THAT(details->uma()->GetAllSamples(
783 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), 841 "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
784 ElementsAre(Bucket(2, 1))); 842 ElementsAre(Bucket(2, 1)));
785 EXPECT_THAT(details->uma()->GetAllSamples( 843 EXPECT_THAT(details->uma()->GetAllSamples(
786 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), 844 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
787 ElementsAre(Bucket(2, 1))); 845 ElementsAre(Bucket(2, 1)));
788 EXPECT_THAT(details->uma()->GetAllSamples( 846 EXPECT_THAT(details->uma()->GetAllSamples(
789 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), 847 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
790 ElementsAre(Bucket(2, 1))); 848 ElementsAre(Bucket(2, 1)));
791 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); 849 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2));
850 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
851 EqualsIfExtensionsIsolated(0));
852 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1));
792 853
793 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); 854 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url);
794 details = new TestMemoryDetails(); 855 details = new TestMemoryDetails();
795 details->StartFetchAndWait(); 856 details->StartFetchAndWait();
796 EXPECT_THAT(details->uma()->GetAllSamples( 857 EXPECT_THAT(details->uma()->GetAllSamples(
797 "SiteIsolation.CurrentRendererProcessCount"), 858 "SiteIsolation.CurrentRendererProcessCount"),
798 ElementsAre(Bucket(GetRenderProcessCount(), 1))); 859 ElementsAre(Bucket(GetRenderProcessCount(), 1)));
799 EXPECT_THAT(details->uma()->GetAllSamples( 860 EXPECT_THAT(details->uma()->GetAllSamples(
800 "SiteIsolation.IsolateNothingProcessCountEstimate"), 861 "SiteIsolation.IsolateNothingProcessCountEstimate"),
801 ElementsAre(Bucket(1, 1))); 862 ElementsAre(Bucket(1, 1)));
(...skipping 10 matching lines...) Expand all
812 EXPECT_THAT(details->uma()->GetAllSamples( 873 EXPECT_THAT(details->uma()->GetAllSamples(
813 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), 874 "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
814 ElementsAre(Bucket(2, 1))); 875 ElementsAre(Bucket(2, 1)));
815 EXPECT_THAT(details->uma()->GetAllSamples( 876 EXPECT_THAT(details->uma()->GetAllSamples(
816 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), 877 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
817 ElementsAre(Bucket(2, 1))); 878 ElementsAre(Bucket(2, 1)));
818 EXPECT_THAT(details->uma()->GetAllSamples( 879 EXPECT_THAT(details->uma()->GetAllSamples(
819 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), 880 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
820 ElementsAre(Bucket(2, 1))); 881 ElementsAre(Bucket(2, 1)));
821 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); 882 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2));
883 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
884 EqualsIfExtensionsIsolated(0));
885 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1));
822 886
823 // Now install app.org as a hosted app. 887 // Now install app.org as a hosted app.
824 CreateHostedApp("App", GURL("http://app.org")); 888 CreateHostedApp("App", GURL("http://app.org"));
825 889
826 // Reload the same two pages, and verify that the hosted app still is not 890 // 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. 891 // isolated by --isolate-extensions, but is isolated by --site-per-process.
828 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); 892 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url);
829 details = new TestMemoryDetails(); 893 details = new TestMemoryDetails();
830 details->StartFetchAndWait(); 894 details->StartFetchAndWait();
831 EXPECT_THAT(details->uma()->GetAllSamples( 895 EXPECT_THAT(details->uma()->GetAllSamples(
(...skipping 15 matching lines...) Expand all
847 EXPECT_THAT(details->uma()->GetAllSamples( 911 EXPECT_THAT(details->uma()->GetAllSamples(
848 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), 912 "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
849 ElementsAre(Bucket(2, 1))); 913 ElementsAre(Bucket(2, 1)));
850 EXPECT_THAT(details->uma()->GetAllSamples( 914 EXPECT_THAT(details->uma()->GetAllSamples(
851 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), 915 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
852 ElementsAre(Bucket(2, 1))); 916 ElementsAre(Bucket(2, 1)));
853 EXPECT_THAT(details->uma()->GetAllSamples( 917 EXPECT_THAT(details->uma()->GetAllSamples(
854 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), 918 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
855 ElementsAre(Bucket(2, 1))); 919 ElementsAre(Bucket(2, 1)));
856 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); 920 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2));
921 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
922 EqualsIfExtensionsIsolated(0));
923 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1));
857 924
858 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); 925 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url);
859 details = new TestMemoryDetails(); 926 details = new TestMemoryDetails();
860 details->StartFetchAndWait(); 927 details->StartFetchAndWait();
861 EXPECT_THAT(details->uma()->GetAllSamples( 928 EXPECT_THAT(details->uma()->GetAllSamples(
862 "SiteIsolation.CurrentRendererProcessCount"), 929 "SiteIsolation.CurrentRendererProcessCount"),
863 ElementsAre(Bucket(GetRenderProcessCount(), 1))); 930 ElementsAre(Bucket(GetRenderProcessCount(), 1)));
864 EXPECT_THAT(details->uma()->GetAllSamples( 931 EXPECT_THAT(details->uma()->GetAllSamples(
865 "SiteIsolation.IsolateNothingProcessCountEstimate"), 932 "SiteIsolation.IsolateNothingProcessCountEstimate"),
866 ElementsAre(Bucket(1, 1))); 933 ElementsAre(Bucket(1, 1)));
(...skipping 10 matching lines...) Expand all
877 EXPECT_THAT(details->uma()->GetAllSamples( 944 EXPECT_THAT(details->uma()->GetAllSamples(
878 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), 945 "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
879 ElementsAre(Bucket(2, 1))); 946 ElementsAre(Bucket(2, 1)));
880 EXPECT_THAT(details->uma()->GetAllSamples( 947 EXPECT_THAT(details->uma()->GetAllSamples(
881 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), 948 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
882 ElementsAre(Bucket(2, 1))); 949 ElementsAre(Bucket(2, 1)));
883 EXPECT_THAT(details->uma()->GetAllSamples( 950 EXPECT_THAT(details->uma()->GetAllSamples(
884 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), 951 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
885 ElementsAre(Bucket(2, 1))); 952 ElementsAre(Bucket(2, 1)));
886 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); 953 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2));
954 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
955 EqualsIfExtensionsIsolated(0));
956 EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1));
887 } 957 }
OLDNEW
« no previous file with comments | « chrome/browser/site_details.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698