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

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

Issue 2314363002: extensions: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Comment addressed Created 4 years, 3 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
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 name.c_str(), iframe_url.c_str())); 228 name.c_str(), iframe_url.c_str()));
229 dir->WriteFile(FILE_PATH_LITERAL("two_http_iframes.html"), 229 dir->WriteFile(FILE_PATH_LITERAL("two_http_iframes.html"),
230 base::StringPrintf( 230 base::StringPrintf(
231 "<html><body>%s, two http:// iframes:" 231 "<html><body>%s, two http:// iframes:"
232 " <iframe width=80 height=80 src='%s'></iframe>" 232 " <iframe width=80 height=80 src='%s'></iframe>"
233 " <iframe width=80 height=80 src='%s'></iframe>" 233 " <iframe width=80 height=80 src='%s'></iframe>"
234 "</body></html>", 234 "</body></html>",
235 name.c_str(), iframe_url.c_str(), iframe_url2.c_str())); 235 name.c_str(), iframe_url.c_str(), iframe_url2.c_str()));
236 dir->WriteManifest(manifest.ToJSON()); 236 dir->WriteManifest(manifest.ToJSON());
237 237
238 const Extension* extension = LoadExtension(dir->unpacked_path()); 238 const Extension* extension = LoadExtension(dir->UnpackedPath());
239 EXPECT_TRUE(extension); 239 EXPECT_TRUE(extension);
240 temp_dirs_.push_back(dir.release()); 240 temp_dirs_.push_back(dir.release());
241 return extension; 241 return extension;
242 } 242 }
243 243
244 // Creates a V2 platform app that loads a web iframe in the app's sandbox 244 // Creates a V2 platform app that loads a web iframe in the app's sandbox
245 // page. 245 // page.
246 // TODO(lazyboy): Deprecate this behavior in https://crbug.com/615585. 246 // TODO(lazyboy): Deprecate this behavior in https://crbug.com/615585.
247 void CreateAppWithSandboxPage(const std::string& name) { 247 void CreateAppWithSandboxPage(const std::string& name) {
248 std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir); 248 std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir);
(...skipping 23 matching lines...) Expand all
272 std::string iframe_url = 272 std::string iframe_url =
273 embedded_test_server()->GetURL("/title1.html").spec(); 273 embedded_test_server()->GetURL("/title1.html").spec();
274 dir->WriteFile( 274 dir->WriteFile(
275 FILE_PATH_LITERAL("sandbox.html"), 275 FILE_PATH_LITERAL("sandbox.html"),
276 base::StringPrintf("<html><body>%s, web iframe:" 276 base::StringPrintf("<html><body>%s, web iframe:"
277 " <iframe width=80 height=80 src=%s></iframe>" 277 " <iframe width=80 height=80 src=%s></iframe>"
278 "</body></html>", 278 "</body></html>",
279 name.c_str(), iframe_url.c_str())); 279 name.c_str(), iframe_url.c_str()));
280 dir->WriteManifest(manifest.ToJSON()); 280 dir->WriteManifest(manifest.ToJSON());
281 281
282 const Extension* extension = LoadExtension(dir->unpacked_path()); 282 const Extension* extension = LoadExtension(dir->UnpackedPath());
283 EXPECT_TRUE(extension); 283 EXPECT_TRUE(extension);
284 temp_dirs_.push_back(dir.release()); 284 temp_dirs_.push_back(dir.release());
285 } 285 }
286 286
287 const Extension* CreateHostedApp(const std::string& name, 287 const Extension* CreateHostedApp(const std::string& name,
288 const GURL& app_url) { 288 const GURL& app_url) {
289 std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir); 289 std::unique_ptr<TestExtensionDir> dir(new TestExtensionDir);
290 290
291 DictionaryBuilder manifest; 291 DictionaryBuilder manifest;
292 manifest.Set("name", name) 292 manifest.Set("name", name)
293 .Set("version", "1.0") 293 .Set("version", "1.0")
294 .Set("manifest_version", 2) 294 .Set("manifest_version", 2)
295 .Set( 295 .Set(
296 "app", 296 "app",
297 DictionaryBuilder() 297 DictionaryBuilder()
298 .Set("urls", ListBuilder().Append(app_url.spec()).Build()) 298 .Set("urls", ListBuilder().Append(app_url.spec()).Build())
299 .Set("launch", 299 .Set("launch",
300 DictionaryBuilder().Set("web_url", app_url.spec()).Build()) 300 DictionaryBuilder().Set("web_url", app_url.spec()).Build())
301 .Build()); 301 .Build());
302 dir->WriteManifest(manifest.ToJSON()); 302 dir->WriteManifest(manifest.ToJSON());
303 303
304 const Extension* extension = LoadExtension(dir->unpacked_path()); 304 const Extension* extension = LoadExtension(dir->UnpackedPath());
305 EXPECT_TRUE(extension); 305 EXPECT_TRUE(extension);
306 temp_dirs_.push_back(dir.release()); 306 temp_dirs_.push_back(dir.release());
307 return extension; 307 return extension;
308 } 308 }
309 309
310 int GetRenderProcessCount() { 310 int GetRenderProcessCount() {
311 int count = 0; 311 int count = 0;
312 for (content::RenderProcessHost::iterator it( 312 for (content::RenderProcessHost::iterator it(
313 content::RenderProcessHost::AllHostsIterator()); 313 content::RenderProcessHost::AllHostsIterator());
314 !it.IsAtEnd(); it.Advance()) { 314 !it.IsAtEnd(); it.Advance()) {
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 content::NavigateIframeToURL( 1286 content::NavigateIframeToURL(
1287 tab, "child-1", extension2->GetResourceURL("/blank_iframe.html")); 1287 tab, "child-1", extension2->GetResourceURL("/blank_iframe.html"));
1288 details = new TestMemoryDetails(); 1288 details = new TestMemoryDetails();
1289 details->StartFetchAndWait(); 1289 details->StartFetchAndWait();
1290 EXPECT_THAT(details->uma()->GetAllSamples( 1290 EXPECT_THAT(details->uma()->GetAllSamples(
1291 "SiteIsolation.SiteInstancesPerBrowsingInstance"), 1291 "SiteIsolation.SiteInstancesPerBrowsingInstance"),
1292 DependingOnPolicy(ElementsAre(Bucket(1, 2)), 1292 DependingOnPolicy(ElementsAre(Bucket(1, 2)),
1293 ElementsAre(Bucket(1, 1), Bucket(3, 1)), 1293 ElementsAre(Bucket(1, 1), Bucket(3, 1)),
1294 ElementsAre(Bucket(1, 1), Bucket(5, 1)))); 1294 ElementsAre(Bucket(1, 1), Bucket(5, 1))));
1295 } 1295 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698