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

Side by Side Diff: chrome/browser/site_details_browsertest.cc

Issue 1693583003: Undo the parameterization of SiteDetailsBrowserTest. ManyIframes/2 times out on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@uma3
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 testing::Matcher<Bucket> matcherCast = matcher; 158 testing::Matcher<Bucket> matcherCast = matcher;
159 matcherCast.DescribeTo(os); 159 matcherCast.DescribeTo(os);
160 } 160 }
161 161
162 // Matches a container of histogram samples, for the common case where the 162 // Matches a container of histogram samples, for the common case where the
163 // histogram received just one sample. 163 // histogram received just one sample.
164 #define HasOneSample(x) ElementsAre(Sample(x, 1)) 164 #define HasOneSample(x) ElementsAre(Sample(x, 1))
165 165
166 } // namespace 166 } // namespace
167 167
168 class SiteDetailsBrowserTest : public ExtensionBrowserTest, 168 class SiteDetailsBrowserTest : public ExtensionBrowserTest {
169 public testing::WithParamInterface<const char*> {
170 public: 169 public:
171 SiteDetailsBrowserTest() {} 170 SiteDetailsBrowserTest() {}
172 ~SiteDetailsBrowserTest() override {} 171 ~SiteDetailsBrowserTest() override {}
173 172
174 void SetUpCommandLine(base::CommandLine* command_line) override {
175 ExtensionBrowserTest::SetUpCommandLine(command_line);
176 std::string switch_name = GetParam();
177 if (!switch_name.empty()) {
178 command_line->AppendSwitch(switch_name);
179 }
180 }
181
182 void SetUpOnMainThread() override { 173 void SetUpOnMainThread() override {
183 host_resolver()->AddRule("*", "127.0.0.1"); 174 host_resolver()->AddRule("*", "127.0.0.1");
184 175
185 // Add content/test/data so we can use cross_site_iframe_factory.html 176 // Add content/test/data so we can use cross_site_iframe_factory.html
186 base::FilePath test_data_dir; 177 base::FilePath test_data_dir;
187 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir)); 178 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir));
188 embedded_test_server()->ServeFilesFromDirectory( 179 embedded_test_server()->ServeFilesFromDirectory(
189 test_data_dir.AppendASCII("content/test/data/")); 180 test_data_dir.AppendASCII("content/test/data/"));
190 ASSERT_TRUE(embedded_test_server()->Start()); 181 ASSERT_TRUE(embedded_test_server()->Start());
191 } 182 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 308
318 private: 309 private:
319 ScopedVector<TestExtensionDir> temp_dirs_; 310 ScopedVector<TestExtensionDir> temp_dirs_;
320 DISALLOW_COPY_AND_ASSIGN(SiteDetailsBrowserTest); 311 DISALLOW_COPY_AND_ASSIGN(SiteDetailsBrowserTest);
321 }; 312 };
322 313
323 314
324 // Test the accuracy of SiteDetails process estimation, in the presence of 315 // Test the accuracy of SiteDetails process estimation, in the presence of
325 // multiple iframes, navigation, multiple BrowsingInstances, and multiple tabs 316 // multiple iframes, navigation, multiple BrowsingInstances, and multiple tabs
326 // in the same BrowsingInstance. 317 // in the same BrowsingInstance.
327 IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest, ManyIframes) { 318 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ManyIframes) {
328 // Page with 14 nested oopifs across 9 sites (a.com through i.com). 319 // Page with 14 nested oopifs across 9 sites (a.com through i.com).
329 // None of these are https. 320 // None of these are https.
330 GURL abcdefghi_url = embedded_test_server()->GetURL( 321 GURL abcdefghi_url = embedded_test_server()->GetURL(
331 "a.com", 322 "a.com",
332 "/cross_site_iframe_factory.html?a(b(a(b,c,d,e,f,g,h)),c,d,e,i(f))"); 323 "/cross_site_iframe_factory.html?a(b(a(b,c,d,e,f,g,h)),c,d,e,i(f))");
333 ui_test_utils::NavigateToURL(browser(), abcdefghi_url); 324 ui_test_utils::NavigateToURL(browser(), abcdefghi_url);
334 325
335 // Get the metrics. 326 // Get the metrics.
336 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); 327 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
337 details->StartFetchAndWait(); 328 details->StartFetchAndWait();
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 "SiteIsolation.ProxyCountPerBrowsingInstance"), 603 "SiteIsolation.ProxyCountPerBrowsingInstance"),
613 DependingOnPolicy( 604 DependingOnPolicy(
614 ElementsAre(Bucket(0, 3)), ElementsAre(Bucket(0, 3)), 605 ElementsAre(Bucket(0, 3)), ElementsAre(Bucket(0, 3)),
615 ElementsAre(Bucket(12, 1), Bucket(29, 1), Bucket(68, 1)))); 606 ElementsAre(Bucket(12, 1), Bucket(29, 1), Bucket(68, 1))));
616 607
617 // This test doesn't navigate to any extensions URLs, so it should not be 608 // This test doesn't navigate to any extensions URLs, so it should not be
618 // in any of the field trial groups. 609 // in any of the field trial groups.
619 EXPECT_FALSE(IsInTrial("SiteIsolationExtensionsActive")); 610 EXPECT_FALSE(IsInTrial("SiteIsolationExtensionsActive"));
620 } 611 }
621 612
622 IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest, IsolateExtensions) { 613 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensions) {
623 // We start on "about:blank", which should be credited with a process in this 614 // We start on "about:blank", which should be credited with a process in this
624 // case. 615 // case.
625 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); 616 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
626 details->StartFetchAndWait(); 617 details->StartFetchAndWait();
627 EXPECT_THAT(details->uma()->GetAllSamples( 618 EXPECT_THAT(details->uma()->GetAllSamples(
628 "SiteIsolation.CurrentRendererProcessCount"), 619 "SiteIsolation.CurrentRendererProcessCount"),
629 HasOneSample(GetRenderProcessCount())); 620 HasOneSample(GetRenderProcessCount()));
630 EXPECT_THAT(details->uma()->GetAllSamples( 621 EXPECT_THAT(details->uma()->GetAllSamples(
631 "SiteIsolation.IsolateNothingProcessCountEstimate"), 622 "SiteIsolation.IsolateNothingProcessCountEstimate"),
632 HasOneSample(1)); 623 HasOneSample(1));
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 HasOneSample(4)); 883 HasOneSample(4));
893 EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(2, 4, 4)); 884 EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(2, 4, 4));
894 EXPECT_THAT(details->GetOutOfProcessIframeCount(), 885 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
895 DependingOnPolicy(0, 2, 2)); 886 DependingOnPolicy(0, 2, 2));
896 887
897 EXPECT_TRUE(IsInTrial("SiteIsolationExtensionsActive")); 888 EXPECT_TRUE(IsInTrial("SiteIsolationExtensionsActive"));
898 } 889 }
899 890
900 // Exercises accounting in the case where an extension has two different-site 891 // Exercises accounting in the case where an extension has two different-site
901 // web iframes. 892 // web iframes.
902 IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) { 893 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) {
903 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); 894 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
904 details->StartFetchAndWait(); 895 details->StartFetchAndWait();
905 896
906 // Install one script-injecting extension with background page, and an 897 // Install one script-injecting extension with background page, and an
907 // extension with web accessible resources. 898 // extension with web accessible resources.
908 const Extension* extension = CreateExtension("Test Extension", false); 899 const Extension* extension = CreateExtension("Test Extension", false);
909 900
910 ui_test_utils::NavigateToURL( 901 ui_test_utils::NavigateToURL(
911 browser(), extension->GetResourceURL("/two_http_iframes.html")); 902 browser(), extension->GetResourceURL("/two_http_iframes.html"));
912 903
(...skipping 17 matching lines...) Expand all
930 // TODO(nick): https://crbug.com/512560 Make the number below agree with the 921 // TODO(nick): https://crbug.com/512560 Make the number below agree with the
931 // estimates above, which assume consolidation of subframe processes. 922 // estimates above, which assume consolidation of subframe processes.
932 EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 3, 3)); 923 EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 3, 3));
933 EXPECT_THAT(details->GetOutOfProcessIframeCount(), 924 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
934 DependingOnPolicy(0, 2, 2)); 925 DependingOnPolicy(0, 2, 2));
935 926
936 EXPECT_TRUE(IsInTrial("SiteIsolationExtensionsActive")); 927 EXPECT_TRUE(IsInTrial("SiteIsolationExtensionsActive"));
937 } 928 }
938 929
939 // Verifies that --isolate-extensions doesn't isolate hosted apps. 930 // Verifies that --isolate-extensions doesn't isolate hosted apps.
940 IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) { 931 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, IsolateExtensionsHostedApps) {
941 GURL app_with_web_iframe_url = embedded_test_server()->GetURL( 932 GURL app_with_web_iframe_url = embedded_test_server()->GetURL(
942 "app.org", "/cross_site_iframe_factory.html?app.org(b.com)"); 933 "app.org", "/cross_site_iframe_factory.html?app.org(b.com)");
943 GURL app_in_web_iframe_url = embedded_test_server()->GetURL( 934 GURL app_in_web_iframe_url = embedded_test_server()->GetURL(
944 "b.com", "/cross_site_iframe_factory.html?b.com(app.org)"); 935 "b.com", "/cross_site_iframe_factory.html?b.com(app.org)");
945 936
946 // No hosted app is installed: app.org just behaves like a normal domain. 937 // No hosted app is installed: app.org just behaves like a normal domain.
947 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url); 938 ui_test_utils::NavigateToURL(browser(), app_with_web_iframe_url);
948 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); 939 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
949 details->StartFetchAndWait(); 940 details->StartFetchAndWait();
950 EXPECT_THAT(details->uma()->GetAllSamples( 941 EXPECT_THAT(details->uma()->GetAllSamples(
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 2)); 1067 EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(1, 1, 2));
1077 EXPECT_THAT(details->GetOutOfProcessIframeCount(), 1068 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
1078 DependingOnPolicy(0, 0, 1)); 1069 DependingOnPolicy(0, 0, 1));
1079 1070
1080 // Since hosted apps are excluded from isolation, this test should not be 1071 // Since hosted apps are excluded from isolation, this test should not be
1081 // in any of the field trial groups. 1072 // in any of the field trial groups.
1082 EXPECT_FALSE(IsInTrial("SiteIsolationExtensionsActive")); 1073 EXPECT_FALSE(IsInTrial("SiteIsolationExtensionsActive"));
1083 } 1074 }
1084 1075
1085 // Verifies that the client is put in the appropriate field trial group. 1076 // Verifies that the client is put in the appropriate field trial group.
1086 IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest, VerifyFieldTrialGroup) { 1077 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, VerifyFieldTrialGroup) {
1087 const Extension* extension = CreateExtension("Extension", false); 1078 const Extension* extension = CreateExtension("Extension", false);
1088 GURL tab1_url = embedded_test_server()->GetURL( 1079 GURL tab1_url = embedded_test_server()->GetURL(
1089 "a.com", "/cross_site_iframe_factory.html?a(b,c)"); 1080 "a.com", "/cross_site_iframe_factory.html?a(b,c)");
1090 ui_test_utils::NavigateToURL(browser(), tab1_url); 1081 ui_test_utils::NavigateToURL(browser(), tab1_url);
1091 WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(0); 1082 WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(0);
1092 1083
1093 // Tab navigates its second iframe to a page of the extension. 1084 // Tab navigates its second iframe to a page of the extension.
1094 content::NavigateIframeToURL(tab, "child-1", 1085 content::NavigateIframeToURL(tab, "child-1",
1095 extension->GetResourceURL("/blank_iframe.html")); 1086 extension->GetResourceURL("/blank_iframe.html"));
1096 1087
(...skipping 10 matching lines...) Expand all
1107 } 1098 }
1108 } else { 1099 } else {
1109 group = "Default"; 1100 group = "Default";
1110 } 1101 }
1111 1102
1112 EXPECT_TRUE(IsInTrialGroup("SiteIsolationExtensionsActive", group)); 1103 EXPECT_TRUE(IsInTrialGroup("SiteIsolationExtensionsActive", group));
1113 } 1104 }
1114 1105
1115 // Verifies that the UMA counter for SiteInstances in a BrowsingInstance is 1106 // Verifies that the UMA counter for SiteInstances in a BrowsingInstance is
1116 // correct when using tabs with web pages. 1107 // correct when using tabs with web pages.
1117 IN_PROC_BROWSER_TEST_P(SiteDetailsBrowserTest, 1108 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest,
1118 VerifySiteInstanceCountInBrowsingInstance) { 1109 VerifySiteInstanceCountInBrowsingInstance) {
1119 // Page with 14 nested oopifs across 9 sites (a.com through i.com). 1110 // Page with 14 nested oopifs across 9 sites (a.com through i.com).
1120 GURL abcdefghi_url = embedded_test_server()->GetURL( 1111 GURL abcdefghi_url = embedded_test_server()->GetURL(
1121 "a.com", 1112 "a.com",
1122 "/cross_site_iframe_factory.html?a(b(a(b,c,d,e,f,g,h)),c,d,e,i(f))"); 1113 "/cross_site_iframe_factory.html?a(b(a(b,c,d,e,f,g,h)),c,d,e,i(f))");
1123 ui_test_utils::NavigateToURL(browser(), abcdefghi_url); 1114 ui_test_utils::NavigateToURL(browser(), abcdefghi_url);
1124 1115
1125 // Get the metrics. 1116 // Get the metrics.
1126 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); 1117 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
1127 details->StartFetchAndWait(); 1118 details->StartFetchAndWait();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 HasOneSample(DependingOnPolicy(0, 0, 160))); 1168 HasOneSample(DependingOnPolicy(0, 0, 160)));
1178 EXPECT_THAT( 1169 EXPECT_THAT(
1179 details->uma()->GetAllSamples( 1170 details->uma()->GetAllSamples(
1180 "SiteIsolation.ProxyCountPerBrowsingInstance"), 1171 "SiteIsolation.ProxyCountPerBrowsingInstance"),
1181 DependingOnPolicy(ElementsAre(Sample(0, 2)), ElementsAre(Sample(0, 2)), 1172 DependingOnPolicy(ElementsAre(Sample(0, 2)), ElementsAre(Sample(0, 2)),
1182 ElementsAre(Sample(12, 1), Sample(160, 1)))); 1173 ElementsAre(Sample(12, 1), Sample(160, 1))));
1183 } 1174 }
1184 1175
1185 // Verifies that the UMA counter for SiteInstances in a BrowsingInstance is 1176 // Verifies that the UMA counter for SiteInstances in a BrowsingInstance is
1186 // correct when extensions and web pages are mixed together. 1177 // correct when extensions and web pages are mixed together.
1187 IN_PROC_BROWSER_TEST_P( 1178 IN_PROC_BROWSER_TEST_F(
1188 SiteDetailsBrowserTest, 1179 SiteDetailsBrowserTest,
1189 VerifySiteInstanceCountInBrowsingInstanceWithExtensions) { 1180 VerifySiteInstanceCountInBrowsingInstanceWithExtensions) {
1190 // Open two a.com tabs (with cross site http iframes). IsolateExtensions mode 1181 // Open two a.com tabs (with cross site http iframes). IsolateExtensions mode
1191 // should have no effect so far, since there are no frames straddling the 1182 // should have no effect so far, since there are no frames straddling the
1192 // extension/web boundary. 1183 // extension/web boundary.
1193 GURL tab_url = embedded_test_server()->GetURL( 1184 GURL tab_url = embedded_test_server()->GetURL(
1194 "a.com", "/cross_site_iframe_factory.html?a(b,c,d(e))"); 1185 "a.com", "/cross_site_iframe_factory.html?a(b,c,d(e))");
1195 ui_test_utils::NavigateToURL(browser(), tab_url); 1186 ui_test_utils::NavigateToURL(browser(), tab_url);
1196 WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(0); 1187 WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(0);
1197 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); 1188 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 content::NavigateIframeToURL( 1225 content::NavigateIframeToURL(
1235 tab, "child-1", extension2->GetResourceURL("/blank_iframe.html")); 1226 tab, "child-1", extension2->GetResourceURL("/blank_iframe.html"));
1236 details = new TestMemoryDetails(); 1227 details = new TestMemoryDetails();
1237 details->StartFetchAndWait(); 1228 details->StartFetchAndWait();
1238 EXPECT_THAT(details->uma()->GetAllSamples( 1229 EXPECT_THAT(details->uma()->GetAllSamples(
1239 "SiteIsolation.SiteInstancesPerBrowsingInstance"), 1230 "SiteIsolation.SiteInstancesPerBrowsingInstance"),
1240 DependingOnPolicy(ElementsAre(Bucket(1, 2)), 1231 DependingOnPolicy(ElementsAre(Bucket(1, 2)),
1241 ElementsAre(Bucket(1, 1), Bucket(3, 1)), 1232 ElementsAre(Bucket(1, 1), Bucket(3, 1)),
1242 ElementsAre(Bucket(1, 1), Bucket(5, 1)))); 1233 ElementsAre(Bucket(1, 1), Bucket(5, 1))));
1243 } 1234 }
1244
1245 INSTANTIATE_TEST_CASE_P(
1246 ,
1247 SiteDetailsBrowserTest,
1248 testing::Values("",
1249 extensions::switches::kIsolateExtensions,
1250 switches::kSitePerProcess));
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698