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

Unified Diff: chrome/browser/metrics/metrics_memory_details_browsertest.cc

Issue 1252943009: First stab at a test for site isolation metrics_memory_details (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@histogram_tester3
Patch Set: Created 5 years, 5 months 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 side-by-side diff with in-line comments
Download patch
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));
+}
« no previous file with comments | « chrome/browser/chrome_site_per_process_browsertest.cc ('k') | chrome/test/data/cross_site_iframe_factory.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698