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

Unified Diff: chrome/browser/site_details_browsertest.cc

Issue 1406133002: Several Site Details / Memory metrics fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_isolate_apps4
Patch Set: thestig's fixes. Created 5 years, 2 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
« no previous file with comments | « chrome/browser/site_details.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/site_details_browsertest.cc
diff --git a/chrome/browser/site_details_browsertest.cc b/chrome/browser/site_details_browsertest.cc
index ae60dc3baacdf9501e2095a0bc819fdfad1b9092..a11d9b2cf32174b2ef0f244b92dbe91e45556dab 100644
--- a/chrome/browser/site_details_browsertest.cc
+++ b/chrome/browser/site_details_browsertest.cc
@@ -56,6 +56,16 @@ class TestMemoryDetails : public MetricsMemoryDetails {
// StartFetchAndWait().
base::HistogramTester* uma() { return uma_.get(); }
+ size_t CountPageTitles() {
+ size_t count = 0;
+ for (const ProcessMemoryInformation& process : ChromeBrowser()->processes) {
+ if (process.process_type == content::PROCESS_TYPE_RENDERER) {
+ count += process.titles.size();
+ }
+ }
+ return count;
+ }
+
private:
~TestMemoryDetails() override {}
@@ -207,11 +217,15 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
details->StartFetchAndWait();
+ EXPECT_EQ(1U, details->CountPageTitles());
EXPECT_THAT(
details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"),
ElementsAre(Bucket(1, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(1, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateAllSitesProcessCountEstimate"),
@@ -252,11 +266,15 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
details = new TestMemoryDetails();
details->StartFetchAndWait();
+ EXPECT_EQ(1U, details->CountPageTitles());
EXPECT_THAT(
details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"),
ElementsAre(Bucket(1, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(1, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateAllSitesProcessCountEstimate"),
@@ -296,11 +314,15 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
details = new TestMemoryDetails();
details->StartFetchAndWait();
+ EXPECT_EQ(2U, details->CountPageTitles());
EXPECT_THAT(
details->uma()->GetAllSamples("SiteIsolation.BrowsingInstanceCount"),
ElementsAre(Bucket(2, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(2, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateAllSitesProcessCountEstimate"),
@@ -343,6 +365,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
ElementsAre(Bucket(3, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(3, 1)));
// Could be 11 if subframe processes were reused across BrowsingInstances.
EXPECT_THAT(details->uma()->GetAllSamples(
@@ -399,6 +424,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
ElementsAre(Bucket(3, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(3, 1)));
// Could be 11 if subframe processes were reused across BrowsingInstances.
EXPECT_THAT(details->uma()->GetAllSamples(
@@ -439,6 +467,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(1, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -472,6 +503,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(3, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -496,6 +530,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(3, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -517,6 +554,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(3, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -537,6 +577,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(3, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -557,6 +600,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(3, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -582,6 +628,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(3, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -603,6 +652,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(3, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -625,6 +677,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(2, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -646,6 +701,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(2, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -676,6 +734,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(1, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -704,6 +765,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(1, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -731,6 +795,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(1, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -763,6 +830,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(1, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
@@ -790,6 +860,9 @@ IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) {
details->StartFetchAndWait();
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.CurrentRendererProcessCount"),
+ ElementsAre(Bucket(GetRenderProcessCount(), 1)));
+ EXPECT_THAT(details->uma()->GetAllSamples(
+ "SiteIsolation.IsolateNothingProcessCountEstimate"),
ElementsAre(Bucket(1, 1)));
EXPECT_THAT(details->uma()->GetAllSamples(
"SiteIsolation.IsolateExtensionsProcessCountEstimate"),
« no previous file with comments | « chrome/browser/site_details.cc ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698