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

Side by Side Diff: chrome/browser/extensions/process_management_browsertest.cc

Issue 889463003: GURL::Replacements methods accept a StringPiece instead of std::string&. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (fixed some merge conflicts). Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/profiles/profile_manager.h" 9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2"))); 60 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app2")));
61 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("hosted_app"))); 61 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("hosted_app")));
62 ASSERT_TRUE( 62 ASSERT_TRUE(
63 LoadExtension(test_data_dir_.AppendASCII("api_test/app_process"))); 63 LoadExtension(test_data_dir_.AppendASCII("api_test/app_process")));
64 64
65 // The app under test acts on URLs whose host is "localhost", 65 // The app under test acts on URLs whose host is "localhost",
66 // so the URLs we navigate to must have host "localhost". 66 // so the URLs we navigate to must have host "localhost".
67 GURL base_url = embedded_test_server()->GetURL( 67 GURL base_url = embedded_test_server()->GetURL(
68 "/extensions/"); 68 "/extensions/");
69 GURL::Replacements replace_host; 69 GURL::Replacements replace_host;
70 std::string host_str("localhost"); // Must stay in scope with replace_host. 70 replace_host.SetHostStr("localhost");
71 replace_host.SetHostStr(host_str);
72 base_url = base_url.ReplaceComponents(replace_host); 71 base_url = base_url.ReplaceComponents(replace_host);
73 72
74 // Load an extension before adding tabs. 73 // Load an extension before adding tabs.
75 const extensions::Extension* extension1 = LoadExtension( 74 const extensions::Extension* extension1 = LoadExtension(
76 test_data_dir_.AppendASCII("api_test/browser_action/basics")); 75 test_data_dir_.AppendASCII("api_test/browser_action/basics"));
77 ASSERT_TRUE(extension1); 76 ASSERT_TRUE(extension1);
78 GURL extension1_url = extension1->url(); 77 GURL extension1_url = extension1->url();
79 78
80 // Create multiple tabs for each type of renderer that might exist. 79 // Create multiple tabs for each type of renderer that might exist.
81 ui_test_utils::NavigateToURL( 80 ui_test_utils::NavigateToURL(
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 content::RenderProcessHost::SetMaxRendererProcessCount(6); 192 content::RenderProcessHost::SetMaxRendererProcessCount(6);
194 193
195 host_resolver()->AddRule("*", "127.0.0.1"); 194 host_resolver()->AddRule("*", "127.0.0.1");
196 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 195 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
197 196
198 // The app under test acts on URLs whose host is "localhost", 197 // The app under test acts on URLs whose host is "localhost",
199 // so the URLs we navigate to must have host "localhost". 198 // so the URLs we navigate to must have host "localhost".
200 GURL base_url = embedded_test_server()->GetURL( 199 GURL base_url = embedded_test_server()->GetURL(
201 "/extensions/"); 200 "/extensions/");
202 GURL::Replacements replace_host; 201 GURL::Replacements replace_host;
203 std::string host_str("localhost"); // Must stay in scope with replace_host. 202 replace_host.SetHostStr("localhost");
204 replace_host.SetHostStr(host_str);
205 base_url = base_url.ReplaceComponents(replace_host); 203 base_url = base_url.ReplaceComponents(replace_host);
206 204
207 ASSERT_TRUE(LoadExtension( 205 ASSERT_TRUE(LoadExtension(
208 test_data_dir_.AppendASCII("api_test/browser_action/none"))); 206 test_data_dir_.AppendASCII("api_test/browser_action/none")));
209 ASSERT_TRUE(LoadExtension( 207 ASSERT_TRUE(LoadExtension(
210 test_data_dir_.AppendASCII("api_test/browser_action/basics"))); 208 test_data_dir_.AppendASCII("api_test/browser_action/basics")));
211 ASSERT_TRUE(LoadExtension( 209 ASSERT_TRUE(LoadExtension(
212 test_data_dir_.AppendASCII("api_test/browser_action/remove_popup"))); 210 test_data_dir_.AppendASCII("api_test/browser_action/remove_popup")));
213 ASSERT_TRUE(LoadExtension( 211 ASSERT_TRUE(LoadExtension(
214 test_data_dir_.AppendASCII("api_test/browser_action/add_popup"))); 212 test_data_dir_.AppendASCII("api_test/browser_action/add_popup")));
(...skipping 20 matching lines...) Expand all
235 } 233 }
236 234
237 // We've loaded 5 extensions with background pages, 1 extension without 235 // We've loaded 5 extensions with background pages, 1 extension without
238 // background page, and one isolated app. We expect only 2 unique processes 236 // background page, and one isolated app. We expect only 2 unique processes
239 // hosting those extensions. 237 // hosting those extensions.
240 extensions::ProcessMap* process_map = extensions::ProcessMap::Get(profile); 238 extensions::ProcessMap* process_map = extensions::ProcessMap::Get(profile);
241 239
242 EXPECT_GE((size_t) 6, process_map->size()); 240 EXPECT_GE((size_t) 6, process_map->size());
243 EXPECT_EQ((size_t) 2, process_ids.size()); 241 EXPECT_EQ((size_t) 2, process_ids.size());
244 } 242 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/isolated_app_browsertest.cc ('k') | chrome/browser/extensions/process_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698