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

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

Issue 1378123003: Adding SSL ETS Tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ets
Patch Set: Rebase. Created 5 years, 1 month 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #endif 47 #endif
48 48
49 // Ensure that an isolated app never shares a process with WebUIs, non-isolated 49 // Ensure that an isolated app never shares a process with WebUIs, non-isolated
50 // extensions, and normal webpages. None of these should ever comingle 50 // extensions, and normal webpages. None of these should ever comingle
51 // RenderProcessHosts even if we hit the process limit. 51 // RenderProcessHosts even if we hit the process limit.
52 IN_PROC_BROWSER_TEST_F(ProcessManagementTest, MAYBE_ProcessOverflow) { 52 IN_PROC_BROWSER_TEST_F(ProcessManagementTest, MAYBE_ProcessOverflow) {
53 // Set max renderers to 1 to force running out of processes. 53 // Set max renderers to 1 to force running out of processes.
54 content::RenderProcessHost::SetMaxRendererProcessCount(1); 54 content::RenderProcessHost::SetMaxRendererProcessCount(1);
55 55
56 host_resolver()->AddRule("*", "127.0.0.1"); 56 host_resolver()->AddRule("*", "127.0.0.1");
57 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 57 ASSERT_TRUE(embedded_test_server()->Start());
58 58
59 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1"))); 59 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("isolated_apps/app1")));
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(
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 #define MAYBE_ExtensionProcessBalancing ExtensionProcessBalancing 185 #define MAYBE_ExtensionProcessBalancing ExtensionProcessBalancing
186 #endif 186 #endif
187 // Test to verify that the policy of maximum share of extension processes is 187 // Test to verify that the policy of maximum share of extension processes is
188 // properly enforced. 188 // properly enforced.
189 IN_PROC_BROWSER_TEST_F(ProcessManagementTest, MAYBE_ExtensionProcessBalancing) { 189 IN_PROC_BROWSER_TEST_F(ProcessManagementTest, MAYBE_ExtensionProcessBalancing) {
190 // Set max renderers to 6 so we can expect 2 extension processes to be 190 // Set max renderers to 6 so we can expect 2 extension processes to be
191 // allocated. 191 // allocated.
192 content::RenderProcessHost::SetMaxRendererProcessCount(6); 192 content::RenderProcessHost::SetMaxRendererProcessCount(6);
193 193
194 host_resolver()->AddRule("*", "127.0.0.1"); 194 host_resolver()->AddRule("*", "127.0.0.1");
195 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 195 ASSERT_TRUE(embedded_test_server()->Start());
196 196
197 // The app under test acts on URLs whose host is "localhost", 197 // The app under test acts on URLs whose host is "localhost",
198 // so the URLs we navigate to must have host "localhost". 198 // so the URLs we navigate to must have host "localhost".
199 GURL base_url = embedded_test_server()->GetURL( 199 GURL base_url = embedded_test_server()->GetURL(
200 "/extensions/"); 200 "/extensions/");
201 GURL::Replacements replace_host; 201 GURL::Replacements replace_host;
202 replace_host.SetHostStr("localhost"); 202 replace_host.SetHostStr("localhost");
203 base_url = base_url.ReplaceComponents(replace_host); 203 base_url = base_url.ReplaceComponents(replace_host);
204 204
205 ASSERT_TRUE(LoadExtension( 205 ASSERT_TRUE(LoadExtension(
(...skipping 24 matching lines...) Expand all
230 process_ids.insert(host->render_process_host()->GetID()); 230 process_ids.insert(host->render_process_host()->GetID());
231 231
232 // We've loaded 5 extensions with background pages, 1 extension without 232 // We've loaded 5 extensions with background pages, 1 extension without
233 // background page, and one isolated app. We expect only 2 unique processes 233 // background page, and one isolated app. We expect only 2 unique processes
234 // hosting those extensions. 234 // hosting those extensions.
235 extensions::ProcessMap* process_map = extensions::ProcessMap::Get(profile); 235 extensions::ProcessMap* process_map = extensions::ProcessMap::Get(profile);
236 236
237 EXPECT_GE((size_t) 6, process_map->size()); 237 EXPECT_GE((size_t) 6, process_map->size());
238 EXPECT_EQ((size_t) 2, process_ids.size()); 238 EXPECT_EQ((size_t) 2, process_ids.size());
239 } 239 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/page_action_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