| Index: chrome/browser/site_details_browsertest.cc
|
| diff --git a/chrome/browser/site_details_browsertest.cc b/chrome/browser/site_details_browsertest.cc
|
| index d79acb1e276248b822d21cc200d0f00353d43b44..c364c923d555948be0c32016e50fb34188884886 100644
|
| --- a/chrome/browser/site_details_browsertest.cc
|
| +++ b/chrome/browser/site_details_browsertest.cc
|
| @@ -46,8 +46,8 @@ using extensions::DictionaryBuilder;
|
| using extensions::Extension;
|
| using extensions::ListBuilder;
|
| using extensions::TestExtensionDir;
|
| -using testing::ContainerEq;
|
| using testing::ElementsAre;
|
| +using testing::PrintToString;
|
|
|
| namespace {
|
|
|
| @@ -97,13 +97,88 @@ class TestMemoryDetails : public MetricsMemoryDetails {
|
| DISALLOW_COPY_AND_ASSIGN(TestMemoryDetails);
|
| };
|
|
|
| +IsolationScenarioType GetCurrentPolicy() {
|
| + if (content::AreAllSitesIsolatedForTesting())
|
| + return ISOLATE_ALL_SITES;
|
| + if (extensions::IsIsolateExtensionsEnabled())
|
| + return ISOLATE_EXTENSIONS;
|
| + return ISOLATE_NOTHING;
|
| +}
|
| +
|
| +// This matcher takes three other matchers as arguments, and applies one of them
|
| +// depending on the current site isolation mode. The first applies if no site
|
| +// isolation mode is active; the second applies under --isolate-extensions mode;
|
| +// and the third applies under --site-per-process mode.
|
| +MATCHER_P3(DependingOnPolicy,
|
| + isolate_nothing,
|
| + isolate_extensions,
|
| + isolate_all_sites,
|
| + GetCurrentPolicy() == ISOLATE_NOTHING
|
| + ? std::string("(with oopifs disabled) ") +
|
| + PrintToString(isolate_nothing)
|
| + : GetCurrentPolicy() == ISOLATE_EXTENSIONS
|
| + ? std::string("(under --isolate-extensions) ") +
|
| + PrintToString(isolate_extensions)
|
| + : std::string("(under --site-per-process) ") +
|
| + PrintToString(isolate_all_sites)) {
|
| + switch (GetCurrentPolicy()) {
|
| + case ISOLATE_NOTHING:
|
| + return ExplainMatchResult(isolate_nothing, arg, result_listener);
|
| + case ISOLATE_EXTENSIONS:
|
| + return ExplainMatchResult(isolate_extensions, arg, result_listener);
|
| + case ISOLATE_ALL_SITES:
|
| + return ExplainMatchResult(isolate_all_sites, arg, result_listener);
|
| + default:
|
| + return false;
|
| + }
|
| +}
|
| +
|
| +// Matcher for base::Bucket objects that allows bucket_min to be a matcher.
|
| +MATCHER_P2(Sample,
|
| + bucket_min,
|
| + count,
|
| + std::string("is a Bucket whose count is ") + PrintToString(count) +
|
| + std::string(" and whose value is ") +
|
| + PrintToString(bucket_min)) {
|
| + return ExplainMatchResult(count, arg.count, result_listener) &&
|
| + ExplainMatchResult(bucket_min, arg.min, result_listener);
|
| +}
|
| +
|
| +// Allow matchers to be pretty-printed when passed to PrintToString() for the
|
| +// cases we care about.
|
| +template <typename P1, typename P2, typename P3>
|
| +void PrintTo(const DependingOnPolicyMatcherP3<P1, P2, P3>& matcher,
|
| + std::ostream* os) {
|
| + testing::Matcher<int> matcherCast = matcher;
|
| + matcherCast.DescribeTo(os);
|
| +}
|
| +
|
| +template <typename P1, typename P2>
|
| +void PrintTo(const SampleMatcherP2<P1, P2>& matcher, std::ostream* os) {
|
| + testing::Matcher<Bucket> matcherCast = matcher;
|
| + matcherCast.DescribeTo(os);
|
| +}
|
| +
|
| +// Matches a container of histogram samples, for the common case where the
|
| +// histogram received just one sample.
|
| +#define HasOneSample(x) ElementsAre(Sample(x, 1))
|
| +
|
| } // namespace
|
|
|
| -class SiteDetailsBrowserTest : public ExtensionBrowserTest {
|
| +class SiteDetailsBrowserTest : public ExtensionBrowserTest,
|
| + public testing::WithParamInterface<const char*> {
|
| public:
|
| SiteDetailsBrowserTest() {}
|
| ~SiteDetailsBrowserTest() override {}
|
|
|
| + void SetUpCommandLine(base::CommandLine* command_line) override {
|
| + ExtensionBrowserTest::SetUpCommandLine(command_line);
|
| + std::string switch_name = GetParam();
|
| + if (!switch_name.empty()) {
|
| + command_line->AppendSwitch(switch_name);
|
| + }
|
| + }
|
| +
|
| void SetUpOnMainThread() override {
|
| host_resolver()->AddRule("*", "127.0.0.1");
|
|
|
| @@ -245,22 +320,11 @@ class SiteDetailsBrowserTest : public ExtensionBrowserTest {
|
| DISALLOW_COPY_AND_ASSIGN(SiteDetailsBrowserTest);
|
| };
|
|
|
| -MATCHER_P(EqualsIfExtensionsIsolated, expected, "") {
|
| - if (content::AreAllSitesIsolatedForTesting())
|
| - return arg >= expected;
|
| - if (extensions::IsIsolateExtensionsEnabled())
|
| - return arg == expected;
|
| - return true;
|
| -}
|
| -
|
| -MATCHER_P(EqualsIfSitePerProcess, expected, "") {
|
| - return !content::AreAllSitesIsolatedForTesting() || expected == arg;
|
| -}
|
|
|
| // Test the accuracy of SiteDetails process estimation, in the presence of
|
| // multiple iframes, navigation, multiple BrowsingInstances, and multiple tabs
|
| // in the same BrowsingInstance.
|
| -IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
|
| +IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest, ManyIframes) {
|
| // Page with 14 nested oopifs across 9 sites (a.com through i.com).
|
| // None of these are https.
|
| GURL abcdefghi_url = embedded_test_server()->GetURL(
|
| @@ -275,46 +339,43 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
|
| EXPECT_EQ(1U, details->CountPageTitles());
|
| EXPECT_THAT(
|
| details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(9, 1)));
|
| + HasOneSample(9));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(9, 1)));
|
| + HasOneSample(9));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(9, 1)));
|
| + HasOneSample(9));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(1, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(9));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(0));
|
| + HasOneSample(1));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 9));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfSitePerProcess(14));
|
| + DependingOnPolicy(0, 0, 14));
|
|
|
| // Navigate to a different, disjoint set of 7 sites.
|
| GURL pqrstuv_url = embedded_test_server()->GetURL(
|
| @@ -328,46 +389,43 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
|
| EXPECT_EQ(1U, details->CountPageTitles());
|
| EXPECT_THAT(
|
| details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(7, 1)));
|
| + HasOneSample(7));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(7, 1)));
|
| + HasOneSample(7));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(7, 1)));
|
| + HasOneSample(7));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(1, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(7));
|
| + HasOneSample(1));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 7));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(0));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfSitePerProcess(11));
|
| + DependingOnPolicy(0, 0, 11));
|
|
|
| // Open a second tab (different BrowsingInstance) with 4 sites (a through d).
|
| GURL abcd_url = embedded_test_server()->GetURL(
|
| @@ -380,46 +438,43 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
|
| EXPECT_EQ(2U, details->CountPageTitles());
|
| EXPECT_THAT(
|
| details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(11, 1)));
|
| + HasOneSample(11));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(11, 1)));
|
| + HasOneSample(11));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(11, 1)));
|
| + HasOneSample(11));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1))); // TODO(nick): This should be 2.
|
| + HasOneSample(1)); // TODO(nick): This should be 2.
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(2, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(2));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(11));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(0));
|
| + HasOneSample(2));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(2, 2, 11));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfSitePerProcess(14));
|
| + DependingOnPolicy(0, 0, 14));
|
|
|
| // Open a third tab (different BrowsingInstance) with the same 4 sites.
|
| AddTabAtIndex(2, abcd_url, ui::PAGE_TRANSITION_TYPED);
|
| @@ -429,47 +484,44 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
|
|
|
| EXPECT_THAT(
|
| details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| // Could be 11 if subframe processes were reused across BrowsingInstances.
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(15, 1)));
|
| + HasOneSample(15));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(11, 1)));
|
| + HasOneSample(11));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(15, 1)));
|
| + HasOneSample(15));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1))); // TODO(nick): This should be 3.
|
| + HasOneSample(1)); // TODO(nick): This should be 3.
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(3, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(15));
|
| + HasOneSample(3));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(3, 3, 15));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(0));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfSitePerProcess(17));
|
| + DependingOnPolicy(0, 0, 17));
|
|
|
| // From the third tab, window.open() a fourth tab in the same
|
| // BrowsingInstance, to a page using the same four sites "a-d" as third tab,
|
| @@ -492,73 +544,70 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
|
|
|
| EXPECT_THAT(
|
| details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| // Could be 11 if subframe processes were reused across BrowsingInstances.
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(16, 1)));
|
| + HasOneSample(16));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(12, 1)));
|
| + HasOneSample(12));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(16, 1)));
|
| + HasOneSample(16));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1))); // TODO(nick): This should be 3.
|
| + HasOneSample(1)); // TODO(nick): This should be 3.
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateHttpsSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(3, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(16));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(0));
|
| + HasOneSample(3));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(3, 3, 16));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfSitePerProcess(21));
|
| + DependingOnPolicy(0, 0, 21));
|
|
|
| // This test doesn't navigate to any extensions URLs, so it should not be
|
| // in any of the field trial groups.
|
| EXPECT_FALSE(IsInTrial("SiteIsolationExtensionsActive"));
|
| }
|
|
|
| -IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
|
| +IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest, IsolateExtensions) {
|
| // We start on "about:blank", which should be credited with a process in this
|
| // case.
|
| scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(GetRenderProcessCount(), 1);
|
| EXPECT_EQ(0, details->GetOutOfProcessIframeCount());
|
|
|
| @@ -583,23 +632,22 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(3, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
|
| + HasOneSample(3));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(3, 3, 7));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(0));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4));
|
| + DependingOnPolicy(0, 0, 4));
|
|
|
| // Test that "one process per extension" applies even when web content has an
|
| // extension iframe.
|
| @@ -613,23 +661,22 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(3, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
|
| + HasOneSample(3));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(3, 3, 6));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(1));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4));
|
| + DependingOnPolicy(0, 1, 4));
|
|
|
| // Tab2 navigates its first iframe to a resource of extension1. This also
|
| // shouldn't result in a new extension process (it should share with the
|
| @@ -640,23 +687,22 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(3, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
|
| + HasOneSample(3));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(3, 3, 5));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(2));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4));
|
| + DependingOnPolicy(0, 2, 4));
|
|
|
| // Tab1 navigates its second iframe to a resource of extension2. This SHOULD
|
| // result in a new process since extension2 had no existing process.
|
| @@ -666,23 +712,22 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(4, 1)));
|
| + HasOneSample(4));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(4, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4));
|
| + HasOneSample(4));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(3, 4, 5));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(3));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4));
|
| + DependingOnPolicy(0, 3, 4));
|
|
|
| // Tab2 navigates its second iframe to a resource of extension2. This should
|
| // share the existing extension2 process.
|
| @@ -692,23 +737,22 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(4, 1)));
|
| + HasOneSample(4));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(4, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4));
|
| + HasOneSample(4));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(3, 4, 4));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(4));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(4));
|
| + DependingOnPolicy(0, 4, 4));
|
|
|
| // Install extension3 (identical config to extension2)
|
| const Extension* extension3 = CreateExtension("Extension Three", false);
|
| @@ -723,23 +767,22 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(4, 1)));
|
| + HasOneSample(4));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(4, 1)));
|
| + HasOneSample(4));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(4, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4));
|
| + HasOneSample(4));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(3, 4, 4));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(2));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(2));
|
| + DependingOnPolicy(0, 2, 2));
|
|
|
| // Navigate tab2 to a different extension3 page containing a web iframe. The
|
| // iframe should get its own process. The lower bound number indicates that,
|
| @@ -750,23 +793,22 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(5, 1)));
|
| + HasOneSample(5));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(4, 1)));
|
| + HasOneSample(4));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(5, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(5));
|
| + HasOneSample(5));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(3, 5, 5));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(3));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(3));
|
| + DependingOnPolicy(0, 3, 3));
|
|
|
| // Navigate tab1 to an extension3 page with an extension3 iframe. There should
|
| // be three processes estimated by IsolateExtensions: one for extension3, one
|
| @@ -778,23 +820,22 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(3, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
|
| + HasOneSample(3));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(2, 3, 3));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(1));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1));
|
| + DependingOnPolicy(0, 1, 1));
|
|
|
| // Now navigate tab1 to an extension3 page with a web iframe. This could share
|
| // a process with tab2's iframe (the LowerBound number), or it could get its
|
| @@ -805,30 +846,29 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(4, 1)));
|
| + HasOneSample(4));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(3, 1)));
|
| + HasOneSample(3));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(4, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(4));
|
| + HasOneSample(4));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(2, 4, 4));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(2));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(2));
|
| + DependingOnPolicy(0, 2, 2));
|
|
|
| EXPECT_TRUE(IsInTrial("SiteIsolationExtensionsActive"));
|
| }
|
|
|
| // Exercises accounting in the case where an extension has two different-site
|
| // web iframes.
|
| -IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) {
|
| +IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) {
|
| scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
|
| details->StartFetchAndWait();
|
|
|
| @@ -843,31 +883,30 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| // TODO(nick): https://crbug.com/512560 Make the number below agree with the
|
| // estimates above, which assume consolidation of subframe processes.
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(3));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 3, 3));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(2));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(2));
|
| + DependingOnPolicy(0, 2, 2));
|
|
|
| EXPECT_TRUE(IsInTrial("SiteIsolationExtensionsActive"));
|
| }
|
|
|
| // Verifies that --isolate-extensions doesn't isolate hosted apps.
|
| -IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) {
|
| +IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) {
|
| GURL app_with_web_iframe_url = embedded_test_server()->GetURL(
|
| "app.org", "/cross_site_iframe_factory.html?app.org(b.com)");
|
| GURL app_in_web_iframe_url = embedded_test_server()->GetURL(
|
| @@ -879,66 +918,64 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(1, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1));
|
| + HasOneSample(1));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(2, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2));
|
| + HasOneSample(2));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 2));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(0));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1));
|
| + DependingOnPolicy(0, 0, 1));
|
|
|
| ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url);
|
| details = new TestMemoryDetails();
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(1, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1));
|
| + HasOneSample(1));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(2, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2));
|
| + HasOneSample(2));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 2));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(0));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1));
|
| + DependingOnPolicy(0, 0, 1));
|
|
|
| // Now install app.org as a hosted app.
|
| CreateHostedApp("App", GURL("http://app.org"));
|
| @@ -950,66 +987,64 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) {
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(1, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1));
|
| + HasOneSample(1));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(2, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2));
|
| + HasOneSample(2));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 2));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(0));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1));
|
| + DependingOnPolicy(0, 0, 1));
|
|
|
| ui_test_utils::NavigateToURL(browser(), app_in_web_iframe_url);
|
| details = new TestMemoryDetails();
|
| details->StartFetchAndWait();
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.CurrentRendererProcessCount"),
|
| - ElementsAre(Bucket(GetRenderProcessCount(), 1)));
|
| + HasOneSample(GetRenderProcessCount()));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateNothingProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountEstimate"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountLowerBound"),
|
| - ElementsAre(Bucket(1, 1)));
|
| + HasOneSample(1));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
|
| - ElementsAre(Bucket(1, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfExtensionsIsolated(1));
|
| + HasOneSample(1));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountEstimate"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountLowerBound"),
|
| - ElementsAre(Bucket(2, 1)));
|
| + HasOneSample(2));
|
| EXPECT_THAT(details->uma()->GetAllSamples(
|
| "SiteIsolation.IsolateAllSitesProcessCountNoLimit"),
|
| - ElementsAre(Bucket(2, 1)));
|
| - EXPECT_THAT(GetRenderProcessCount(), EqualsIfSitePerProcess(2));
|
| + HasOneSample(2));
|
| + EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 2));
|
| EXPECT_THAT(details->GetOutOfProcessIframeCount(),
|
| - EqualsIfExtensionsIsolated(0));
|
| - EXPECT_THAT(details->GetOutOfProcessIframeCount(), EqualsIfSitePerProcess(1));
|
| + DependingOnPolicy(0, 0, 1));
|
|
|
| // Since hosted apps are excluded from isolation, this test should not be
|
| // in any of the field trial groups.
|
| @@ -1017,7 +1052,7 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) {
|
| }
|
|
|
| // Verifies that the client is put in the appropriate field trial group.
|
| -IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, VerifyFieldTrialGroup) {
|
| +IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest, VerifyFieldTrialGroup) {
|
| const Extension* extension = CreateExtension("Extension", false);
|
| GURL tab1_url = embedded_test_server()->GetURL(
|
| "a.com", "/cross_site_iframe_factory.html?a(b,c)");
|
| @@ -1048,7 +1083,7 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, VerifyFieldTrialGroup) {
|
|
|
| // Verifies that the UMA counter for SiteInstances in a BrowsingInstance is
|
| // correct when using tabs with web pages.
|
| -IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest,
|
| +IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest,
|
| VerifySiteInstanceCountInBrowsingInstance) {
|
| // Page with 14 nested oopifs across 9 sites (a.com through i.com).
|
| GURL abcdefghi_url = embedded_test_server()->GetURL(
|
| @@ -1059,17 +1094,12 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest,
|
| // Get the metrics.
|
| scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
|
| details->StartFetchAndWait();
|
| - if (content::AreAllSitesIsolatedForTesting()) {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(9, 1)));
|
| - } else {
|
| - // Since there are no extensions involved, the results in the default case
|
| - // and extensions::IsIsolateExtensionsEnabled() are the same.
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(1, 1)));
|
| - }
|
| +
|
| + // Since there are no extensions involved, the results in the default case
|
| + // and extensions::IsIsolateExtensionsEnabled() are the same.
|
| + EXPECT_THAT(details->uma()->GetAllSamples(
|
| + "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| + HasOneSample(DependingOnPolicy(1, 1, 9)));
|
|
|
| // Open another tab through window.open(), which will be in the same
|
| // BrowsingInstance.
|
| @@ -1086,15 +1116,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest,
|
|
|
| details = new TestMemoryDetails();
|
| details->StartFetchAndWait();
|
| - if (content::AreAllSitesIsolatedForTesting()) {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(11, 1)));
|
| - } else {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(1, 1)));
|
| - }
|
| + EXPECT_THAT(details->uma()->GetAllSamples(
|
| + "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| + HasOneSample(DependingOnPolicy(1, 1, 11)));
|
|
|
| // Open a tab, which will be in a different BrowsingInstance.
|
| GURL abcd_url = embedded_test_server()->GetURL(
|
| @@ -1103,20 +1127,16 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest,
|
|
|
| details = new TestMemoryDetails();
|
| details->StartFetchAndWait();
|
| - if (content::AreAllSitesIsolatedForTesting()) {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(4, 1), Bucket(11, 1)));
|
| - } else {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(1, 2)));
|
| - }
|
| + EXPECT_THAT(
|
| + details->uma()->GetAllSamples(
|
| + "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| + DependingOnPolicy(ElementsAre(Sample(1, 2)), ElementsAre(Sample(1, 2)),
|
| + ElementsAre(Sample(4, 1), Sample(11, 1))));
|
| }
|
|
|
| // Verifies that the UMA counter for SiteInstances in a BrowsingInstance is
|
| // correct when extensions and web pages are mixed together.
|
| -IN_PROC_BROWSER_TEST_F(
|
| +IN_PROC_BROWSER_TEST_P(
|
| SiteDetailsBrowserTest,
|
| VerifySiteInstanceCountInBrowsingInstanceWithExtensions) {
|
| // Open two a.com tabs (with cross site http iframes). IsolateExtensions mode
|
| @@ -1128,17 +1148,12 @@ IN_PROC_BROWSER_TEST_F(
|
| WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(0);
|
| scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
|
| details->StartFetchAndWait();
|
| - if (content::AreAllSitesIsolatedForTesting()) {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(5, 1)));
|
| - } else {
|
| - // Since there are no extensions loaded yet, the results in the default case
|
| - // and extensions::IsIsolateExtensionsEnabled() are the same.
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(1, 1)));
|
| - }
|
| +
|
| + // Since there are no extensions loaded yet, the results in the default case
|
| + // and extensions::IsIsolateExtensionsEnabled() are the same.
|
| + EXPECT_THAT(details->uma()->GetAllSamples(
|
| + "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| + HasOneSample(DependingOnPolicy(1, 1, 5)));
|
|
|
| // Load an extension without a background page, which will avoid creating a
|
| // BrowsingInstance for it.
|
| @@ -1151,38 +1166,20 @@ IN_PROC_BROWSER_TEST_F(
|
| tab, "child-0", extension1->GetResourceURL("/blank_iframe.html"));
|
| details = new TestMemoryDetails();
|
| details->StartFetchAndWait();
|
| - if (content::AreAllSitesIsolatedForTesting()) {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(5, 1)));
|
| - } else if (extensions::IsIsolateExtensionsEnabled()) {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(2, 1)));
|
| - } else {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(1, 1)));
|
| - }
|
| + EXPECT_THAT(details->uma()->GetAllSamples(
|
| + "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| + HasOneSample(DependingOnPolicy(1, 2, 5)));
|
|
|
| // Now load an extension with a background page. This will result in a
|
| // BrowsingInstance for the background page.
|
| const Extension* extension2 = CreateExtension("Extension One", true);
|
| details = new TestMemoryDetails();
|
| details->StartFetchAndWait();
|
| - if (content::AreAllSitesIsolatedForTesting()) {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(1, 1), Bucket(5, 1)));
|
| - } else if (extensions::IsIsolateExtensionsEnabled()) {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(1, 1), Bucket(2, 1)));
|
| - } else {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(1, 2)));
|
| - }
|
| + EXPECT_THAT(details->uma()->GetAllSamples(
|
| + "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| + DependingOnPolicy(ElementsAre(Bucket(1, 2)),
|
| + ElementsAre(Bucket(1, 1), Bucket(2, 1)),
|
| + ElementsAre(Bucket(1, 1), Bucket(5, 1))));
|
|
|
| // Navigate the second iframe of the tab to the second extension. It should
|
| // stay in the same BrowsingInstance as the page.
|
| @@ -1190,17 +1187,16 @@ IN_PROC_BROWSER_TEST_F(
|
| tab, "child-1", extension2->GetResourceURL("/blank_iframe.html"));
|
| details = new TestMemoryDetails();
|
| details->StartFetchAndWait();
|
| - if (content::AreAllSitesIsolatedForTesting()) {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(1, 1), Bucket(5, 1)));
|
| - } else if (extensions::IsIsolateExtensionsEnabled()) {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(1, 1), Bucket(3, 1)));
|
| - } else {
|
| - EXPECT_THAT(details->uma()->GetAllSamples(
|
| - "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| - ElementsAre(Bucket(1, 2)));
|
| - }
|
| + EXPECT_THAT(details->uma()->GetAllSamples(
|
| + "SiteIsolation.SiteInstancesPerBrowsingInstance"),
|
| + DependingOnPolicy(ElementsAre(Bucket(1, 2)),
|
| + ElementsAre(Bucket(1, 1), Bucket(3, 1)),
|
| + ElementsAre(Bucket(1, 1), Bucket(5, 1))));
|
| }
|
| +
|
| +INSTANTIATE_TEST_CASE_P(
|
| + ,
|
| + SiteDetailsBrowserTest,
|
| + testing::Values("",
|
| + extensions::switches::kIsolateExtensions,
|
| + switches::kSitePerProcess));
|
|
|