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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 684 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
685 ElementsAre(Bucket(2, 1))); | 685 ElementsAre(Bucket(2, 1))); |
686 EXPECT_THAT(details->uma()->GetAllSamples( | 686 EXPECT_THAT(details->uma()->GetAllSamples( |
687 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 687 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
688 ElementsAre(Bucket(2, 1))); | 688 ElementsAre(Bucket(2, 1))); |
689 // TODO(nick): https://crbug.com/512560 Make the number below agree with the | 689 // TODO(nick): https://crbug.com/512560 Make the number below agree with the |
690 // estimates above, which assume consolidation of subframe processes. | 690 // estimates above, which assume consolidation of subframe processes. |
691 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); | 691 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3)); |
692 } | 692 } |
693 | 693 |
694 // TODO(nick): This test demonstrates that --isolate-extensions currently | 694 // Verifies that --isolate-extensions doesn't isolate hosted apps. |
695 // isolates hosted apps too. It shouldn't. http://crbug.com/535073 | |
696 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) { | 695 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) { |
697 GURL app_with_web_iframe_url = embedded_test_server()->GetURL( | 696 GURL app_with_web_iframe_url = embedded_test_server()->GetURL( |
698 "app.org", "/cross_site_iframe_factory.html?app.org(b.com)"); | 697 "app.org", "/cross_site_iframe_factory.html?app.org(b.com)"); |
699 GURL app_in_web_iframe_url = embedded_test_server()->GetURL( | 698 GURL app_in_web_iframe_url = embedded_test_server()->GetURL( |
700 "b.com", "/cross_site_iframe_factory.html?b.com(app.org)"); | 699 "b.com", "/cross_site_iframe_factory.html?b.com(app.org)"); |
701 | 700 |
702 // No hosted app is installed: app.org just behaves like a normal domain. | 701 // No hosted app is installed: app.org just behaves like a normal domain. |
703 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); | 702 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); |
704 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); | 703 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); |
705 details->StartFetchAndWait(); | 704 details->StartFetchAndWait(); |
706 EXPECT_THAT(details->uma()->GetAllSamples( | 705 EXPECT_THAT(details->uma()->GetAllSamples( |
707 "SiteIsolation.CurrentRendererProcessCount"), | 706 "SiteIsolation.CurrentRendererProcessCount"), |
708 ElementsAre(Bucket(1, 1))); | 707 ElementsAre(Bucket(1, 1))); |
709 EXPECT_THAT(details->uma()->GetAllSamples( | 708 EXPECT_THAT(details->uma()->GetAllSamples( |
710 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 709 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
711 ElementsAre(Bucket(1, 1))); | 710 ElementsAre(Bucket(1, 1))); |
712 EXPECT_THAT(details->uma()->GetAllSamples( | 711 EXPECT_THAT(details->uma()->GetAllSamples( |
713 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 712 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
714 ElementsAre(Bucket(1, 1))); | 713 ElementsAre(Bucket(1, 1))); |
715 EXPECT_THAT(details->uma()->GetAllSamples( | 714 EXPECT_THAT(details->uma()->GetAllSamples( |
716 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 715 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
717 ElementsAre(Bucket(1, 1))); | 716 ElementsAre(Bucket(1, 1))); |
718 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); | 717 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); |
| 718 EXPECT_THAT(details->uma()->GetAllSamples( |
| 719 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
| 720 ElementsAre(Bucket(2, 1))); |
| 721 EXPECT_THAT(details->uma()->GetAllSamples( |
| 722 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
| 723 ElementsAre(Bucket(2, 1))); |
| 724 EXPECT_THAT(details->uma()->GetAllSamples( |
| 725 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
| 726 ElementsAre(Bucket(2, 1))); |
| 727 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); |
719 | 728 |
720 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); | 729 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); |
721 details = new TestMemoryDetails(); | 730 details = new TestMemoryDetails(); |
722 details->StartFetchAndWait(); | 731 details->StartFetchAndWait(); |
723 EXPECT_THAT(details->uma()->GetAllSamples( | 732 EXPECT_THAT(details->uma()->GetAllSamples( |
724 "SiteIsolation.CurrentRendererProcessCount"), | 733 "SiteIsolation.CurrentRendererProcessCount"), |
725 ElementsAre(Bucket(1, 1))); | 734 ElementsAre(Bucket(1, 1))); |
726 EXPECT_THAT(details->uma()->GetAllSamples( | 735 EXPECT_THAT(details->uma()->GetAllSamples( |
727 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 736 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
728 ElementsAre(Bucket(1, 1))); | 737 ElementsAre(Bucket(1, 1))); |
729 EXPECT_THAT(details->uma()->GetAllSamples( | 738 EXPECT_THAT(details->uma()->GetAllSamples( |
730 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 739 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
731 ElementsAre(Bucket(1, 1))); | 740 ElementsAre(Bucket(1, 1))); |
732 EXPECT_THAT(details->uma()->GetAllSamples( | 741 EXPECT_THAT(details->uma()->GetAllSamples( |
733 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 742 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
734 ElementsAre(Bucket(1, 1))); | 743 ElementsAre(Bucket(1, 1))); |
735 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); | 744 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); |
| 745 EXPECT_THAT(details->uma()->GetAllSamples( |
| 746 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
| 747 ElementsAre(Bucket(2, 1))); |
| 748 EXPECT_THAT(details->uma()->GetAllSamples( |
| 749 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
| 750 ElementsAre(Bucket(2, 1))); |
| 751 EXPECT_THAT(details->uma()->GetAllSamples( |
| 752 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
| 753 ElementsAre(Bucket(2, 1))); |
| 754 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); |
736 | 755 |
737 // Now install app.org as a hosted app. | 756 // Now install app.org as a hosted app. |
738 CreateHostedApp("App", GURL("http://app.org")); | 757 CreateHostedApp("App", GURL("http://app.org")); |
739 | 758 |
740 // Reload the same two pages. | 759 // Reload the same two pages, and verify that the hosted app still is not |
| 760 // isolated by --isolate-extensions, but is isolated by --site-per-process. |
741 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); | 761 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); |
742 details = new TestMemoryDetails(); | 762 details = new TestMemoryDetails(); |
743 details->StartFetchAndWait(); | 763 details->StartFetchAndWait(); |
744 EXPECT_THAT(details->uma()->GetAllSamples( | 764 EXPECT_THAT(details->uma()->GetAllSamples( |
745 "SiteIsolation.CurrentRendererProcessCount"), | 765 "SiteIsolation.CurrentRendererProcessCount"), |
746 ElementsAre(Bucket(1, 1))); | 766 ElementsAre(Bucket(1, 1))); |
747 EXPECT_THAT(details->uma()->GetAllSamples( | 767 EXPECT_THAT(details->uma()->GetAllSamples( |
748 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 768 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 769 ElementsAre(Bucket(1, 1))); |
| 770 EXPECT_THAT(details->uma()->GetAllSamples( |
| 771 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 772 ElementsAre(Bucket(1, 1))); |
| 773 EXPECT_THAT(details->uma()->GetAllSamples( |
| 774 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 775 ElementsAre(Bucket(1, 1))); |
| 776 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); |
| 777 EXPECT_THAT(details->uma()->GetAllSamples( |
| 778 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
749 ElementsAre(Bucket(2, 1))); | 779 ElementsAre(Bucket(2, 1))); |
750 EXPECT_THAT(details->uma()->GetAllSamples( | 780 EXPECT_THAT(details->uma()->GetAllSamples( |
751 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 781 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
752 ElementsAre(Bucket(2, 1))); | 782 ElementsAre(Bucket(2, 1))); |
753 EXPECT_THAT(details->uma()->GetAllSamples( | 783 EXPECT_THAT(details->uma()->GetAllSamples( |
754 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 784 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
755 ElementsAre(Bucket(2, 1))); | 785 ElementsAre(Bucket(2, 1))); |
756 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(2)); | 786 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); |
757 | 787 |
758 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); | 788 ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url); |
759 details = new TestMemoryDetails(); | 789 details = new TestMemoryDetails(); |
760 details->StartFetchAndWait(); | 790 details->StartFetchAndWait(); |
761 EXPECT_THAT(details->uma()->GetAllSamples( | 791 EXPECT_THAT(details->uma()->GetAllSamples( |
762 "SiteIsolation.CurrentRendererProcessCount"), | 792 "SiteIsolation.CurrentRendererProcessCount"), |
763 ElementsAre(Bucket(1, 1))); | 793 ElementsAre(Bucket(1, 1))); |
764 EXPECT_THAT(details->uma()->GetAllSamples( | 794 EXPECT_THAT(details->uma()->GetAllSamples( |
765 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), | 795 "SiteIsolation.IsolateExtensionsProcessCountEstimate"), |
| 796 ElementsAre(Bucket(1, 1))); |
| 797 EXPECT_THAT(details->uma()->GetAllSamples( |
| 798 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), |
| 799 ElementsAre(Bucket(1, 1))); |
| 800 EXPECT_THAT(details->uma()->GetAllSamples( |
| 801 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), |
| 802 ElementsAre(Bucket(1, 1))); |
| 803 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1)); |
| 804 EXPECT_THAT(details->uma()->GetAllSamples( |
| 805 "SiteIsolation.IsolateAllSitesProcessCountEstimate"), |
766 ElementsAre(Bucket(2, 1))); | 806 ElementsAre(Bucket(2, 1))); |
767 EXPECT_THAT(details->uma()->GetAllSamples( | 807 EXPECT_THAT(details->uma()->GetAllSamples( |
768 "SiteIsolation.IsolateExtensionsProcessCountLowerBound"), | 808 "SiteIsolation.IsolateAllSitesProcessCountLowerBound"), |
769 ElementsAre(Bucket(2, 1))); | 809 ElementsAre(Bucket(2, 1))); |
770 EXPECT_THAT(details->uma()->GetAllSamples( | 810 EXPECT_THAT(details->uma()->GetAllSamples( |
771 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), | 811 "SiteIsolation.IsolateAllSitesProcessCountNoLimit"), |
772 ElementsAre(Bucket(2, 1))); | 812 ElementsAre(Bucket(2, 1))); |
773 | 813 EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2)); |
774 EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(2)); | |
775 } | 814 } |
OLD | NEW |