Index: chrome/browser/metrics/metrics_memory_details_browsertest.cc |
diff --git a/chrome/browser/metrics/metrics_memory_details_browsertest.cc b/chrome/browser/metrics/metrics_memory_details_browsertest.cc |
index d38bfda6c6ea11c221fc75ab99747acb8e6bde9d..e6182d656edf979ef04f2f35de3b81b51f7a03b9 100644 |
--- a/chrome/browser/metrics/metrics_memory_details_browsertest.cc |
+++ b/chrome/browser/metrics/metrics_memory_details_browsertest.cc |
@@ -9,6 +9,8 @@ |
#include "base/test/histogram_tester.h" |
#include "chrome/test/base/in_process_browser_test.h" |
#include "content/public/test/test_utils.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
+#include "net/dns/mock_host_resolver.h" |
namespace { |
@@ -41,6 +43,11 @@ class MetricsMemoryDetailsBrowserTest : public InProcessBrowserTest { |
MetricsMemoryDetailsBrowserTest() {} |
~MetricsMemoryDetailsBrowserTest() override {} |
+ void SetUpOnMainThread() override { |
+ host_resolver()->AddRule("*", "127.0.0.1"); |
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
+ } |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(MetricsMemoryDetailsBrowserTest); |
}; |
@@ -58,3 +65,32 @@ IN_PROC_BROWSER_TEST_F(MetricsMemoryDetailsBrowserTest, TestMemoryDetails) { |
ASSERT_TRUE(samples); |
EXPECT_NE(0, samples->sum()); |
} |
+ |
+IN_PROC_BROWSER_TEST_F(MetricsMemoryDetailsBrowserTest, TestSiteIsolation) { |
+ // One page, with a buttload of oopifs. |
+ GURL url1 = test_server()->GetUrl("a.com", |
+ "cross_site_iframe_factory.html?a(b(a(b,c,d,e,f,g,h)),c,d,e,f,g,h)"); |
+ |
+ ui_test_utils::NavigateToURL(browser(), url1); |
+ |
+ // Get the metrics. |
+ base::HistogramTester histogram_tester; |
+ |
+ scoped_refptr<TestMemoryDetails> details(new TestMemoryDetails); |
+ details->StartFetchAndWait(); |
+ |
+ base::HistogramTester::CountsMap expected_metrics; |
+ expected_metrics["SiteIsolation.BrowsingInstanceCount"] = 1; |
+ expected_metrics["SiteIsolation.CurrentRendererProcessCount"] = 1; |
+ expected_metrics["SiteIsolation.IsolateAllSitesProcessCountEstimate"] = 1; |
+ expected_metrics["SiteIsolation.IsolateAllSitesProcessCountLowerBound"] = 1; |
+ expected_metrics["SiteIsolation.IsolateAllSitesProcessCountNoLimit"] = 1; |
+ expected_metrics["SiteIsolation.IsolateAllSitesTotalProcessCountEstimate"] = 1; |
+ expected_metrics["SiteIsolation.IsolateHttpsSitesProcessCountEstimate"] = 1; |
+ expected_metrics["SiteIsolation.IsolateHttpsSitesProcessCountLowerBound"] = 1; |
+ expected_metrics["SiteIsolation.IsolateHttpsSitesProcessCountNoLimit"] = 1; |
+ expected_metrics["SiteIsolation.IsolateHttpsSitesTotalProcessCountEstimate"] = 1; |
+ |
+ EXPECT_THAT(histogram_tester.GetTotalCountsForPrefix("SiteIsolation."), |
+ testing::ContainerEq(expected_metrics)); |
+} |