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

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

Issue 2715933002: TEST: Removing PlatformAppsNotIsolated
Patch Set: Modifying the test instead of deleting it. Created 3 years, 9 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 "</body></html>", 235 "</body></html>",
236 name.c_str(), iframe_url.c_str(), iframe_url2.c_str())); 236 name.c_str(), iframe_url.c_str(), iframe_url2.c_str()));
237 dir->WriteManifest(manifest.ToJSON()); 237 dir->WriteManifest(manifest.ToJSON());
238 238
239 const Extension* extension = LoadExtension(dir->UnpackedPath()); 239 const Extension* extension = LoadExtension(dir->UnpackedPath());
240 EXPECT_TRUE(extension); 240 EXPECT_TRUE(extension);
241 temp_dirs_.push_back(dir.release()); 241 temp_dirs_.push_back(dir.release());
242 return extension; 242 return extension;
243 } 243 }
244 244
245 // Creates a V2 platform app that loads a web iframe in the app's sandbox 245 // Creates a V2 platform app that tries to loads a web iframe in the app's
246 // page. 246 // sandbox page. Starting in version 57, Chrome will no longer allow external
247 // TODO(lazyboy): Deprecate this behavior in https://crbug.com/615585. 247 // web content inside sandboxed pages. So the iframe is expected to be
248 // blocked.
248 void CreateAppWithSandboxPage(const std::string& name) { 249 void CreateAppWithSandboxPage(const std::string& name) {
249 std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir); 250 std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir);
250 251
251 DictionaryBuilder manifest; 252 DictionaryBuilder manifest;
252 manifest.Set("name", name) 253 manifest.Set("name", name)
253 .Set("version", "1.0") 254 .Set("version", "1.0")
254 .Set("manifest_version", 2) 255 .Set("manifest_version", 2)
255 .Set("sandbox", 256 .Set("sandbox",
256 DictionaryBuilder() 257 DictionaryBuilder()
257 .Set("pages", ListBuilder().Append("sandbox.html").Build()) 258 .Set("pages", ListBuilder().Append("sandbox.html").Build())
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 EXPECT_THAT(details->uma()->GetAllSamples( 934 EXPECT_THAT(details->uma()->GetAllSamples(
934 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"), 935 "SiteIsolation.IsolateExtensionsProcessCountNoLimit"),
935 HasOneSample(4)); 936 HasOneSample(4));
936 EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(2, 4, 4)); 937 EXPECT_THAT(GetRenderProcessCount(), DependingOnPolicy(2, 4, 4));
937 EXPECT_THAT(details->GetOutOfProcessIframeCount(), 938 EXPECT_THAT(details->GetOutOfProcessIframeCount(),
938 DependingOnPolicy(0, 2, 2)); 939 DependingOnPolicy(0, 2, 2));
939 940
940 EXPECT_TRUE(IsInTrial("SiteIsolationExtensionsActive")); 941 EXPECT_TRUE(IsInTrial("SiteIsolationExtensionsActive"));
941 } 942 }
942 943
943 // Due to http://crbug.com/612711, we are not isolating iframes from platform 944 // Creates a V2 platform app that tries to loads a web iframe in the app's
944 // apps with --isolate-extenions. 945 // sandbox page. Starting in version 57, Chrome will no longer allow external
945 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, PlatformAppsNotIsolated) { 946 // web content inside sandboxed pages. So the iframe is expected to be
946 // --site-per-process will still isolate iframes from platform apps, so skip 947 // blocked. If an error page is displayed, it shouldn't be loaded inside a
947 // the test in that case. 948 // different process.
948 if (content::AreAllSitesIsolatedForTesting()) 949 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest,
949 return; 950 PlatformAppsErrorPagesArentOOPIF) {
950 CreateAppWithSandboxPage("Extension One"); 951 CreateAppWithSandboxPage("Extension One");
951 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); 952 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
952 details->StartFetchAndWait(); 953 details->StartFetchAndWait();
953 EXPECT_EQ(0, details->GetOutOfProcessIframeCount()); 954 EXPECT_EQ(0, details->GetOutOfProcessIframeCount());
954 } 955 }
955 956
956 // Exercises accounting in the case where an extension has two different-site 957 // Exercises accounting in the case where an extension has two different-site
957 // web iframes. 958 // web iframes.
958 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) { 959 IN_PROC_BROWSER_TEST_F(SiteDetailsBrowserTest, ExtensionWithTwoWebIframes) {
959 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails(); 960 scoped_refptr<TestMemoryDetails> details = new TestMemoryDetails();
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 content::NavigateIframeToURL( 1294 content::NavigateIframeToURL(
1294 tab, "child-1", extension2->GetResourceURL("/blank_iframe.html")); 1295 tab, "child-1", extension2->GetResourceURL("/blank_iframe.html"));
1295 details = new TestMemoryDetails(); 1296 details = new TestMemoryDetails();
1296 details->StartFetchAndWait(); 1297 details->StartFetchAndWait();
1297 EXPECT_THAT(details->uma()->GetAllSamples( 1298 EXPECT_THAT(details->uma()->GetAllSamples(
1298 "SiteIsolation.SiteInstancesPerBrowsingInstance"), 1299 "SiteIsolation.SiteInstancesPerBrowsingInstance"),
1299 DependingOnPolicy(ElementsAre(Bucket(1, 2)), 1300 DependingOnPolicy(ElementsAre(Bucket(1, 2)),
1300 ElementsAre(Bucket(1, 1), Bucket(3, 1)), 1301 ElementsAre(Bucket(1, 1), Bucket(3, 1)),
1301 ElementsAre(Bucket(1, 1), Bucket(5, 1)))); 1302 ElementsAre(Bucket(1, 1), Bucket(5, 1))));
1302 } 1303 }
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