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

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

Issue 2850793005: Remove command line/field trial support and configs for Isolate Extensions. (Closed)
Patch Set: Rebase. Created 3 years, 7 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 content::TestNavigationObserver nav_observer(web_contents, 1); 319 content::TestNavigationObserver nav_observer(web_contents, 1);
320 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 320 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
321 web_contents, navigation_starting_script, &ignored_script_result)); 321 web_contents, navigation_starting_script, &ignored_script_result));
322 322
323 // Verify that the navigation succeeded. 323 // Verify that the navigation succeeded.
324 nav_observer.Wait(); 324 nav_observer.Wait();
325 EXPECT_EQ(web_url, web_contents->GetLastCommittedURL()); 325 EXPECT_EQ(web_url, web_contents->GetLastCommittedURL());
326 326
327 // Verify that the navigation transferred the contents to another renderer 327 // Verify that the navigation transferred the contents to another renderer
328 // process. 328 // process.
329 if (extensions::IsIsolateExtensionsEnabled()) { 329 content::RenderProcessHost* new_process_host =
330 content::RenderProcessHost* new_process_host = 330 web_contents->GetMainFrame()->GetProcess();
331 web_contents->GetMainFrame()->GetProcess(); 331 EXPECT_NE(old_process_host, new_process_host);
332 EXPECT_NE(old_process_host, new_process_host);
333 }
334 } 332 }
335 333
336 IN_PROC_BROWSER_TEST_F(ChromeWebStoreProcessTest, 334 IN_PROC_BROWSER_TEST_F(ChromeWebStoreProcessTest,
337 NavigateWebTabToChromeWebStoreViaPost) { 335 NavigateWebTabToChromeWebStoreViaPost) {
338 // Navigate a tab to a web page with a form. 336 // Navigate a tab to a web page with a form.
339 GURL web_url = embedded_test_server()->GetURL("foo.com", "/form.html"); 337 GURL web_url = embedded_test_server()->GetURL("foo.com", "/form.html");
340 ui_test_utils::NavigateToURL(browser(), web_url); 338 ui_test_utils::NavigateToURL(browser(), web_url);
341 WebContents* web_contents = 339 WebContents* web_contents =
342 browser()->tab_strip_model()->GetActiveWebContents(); 340 browser()->tab_strip_model()->GetActiveWebContents();
343 EXPECT_EQ(web_url, web_contents->GetLastCommittedURL()); 341 EXPECT_EQ(web_url, web_contents->GetLastCommittedURL());
(...skipping 15 matching lines...) Expand all
359 "form.action = '" + cws_web_url.spec() + "';\n" 357 "form.action = '" + cws_web_url.spec() + "';\n"
360 "form.submit();\n" 358 "form.submit();\n"
361 "setTimeout(\n" 359 "setTimeout(\n"
362 " function() { window.domAutomationController.send(true); },\n" 360 " function() { window.domAutomationController.send(true); },\n"
363 " 0);\n"; 361 " 0);\n";
364 362
365 // Trigger a renderer-initiated POST navigation (via the form) to a Chrome Web 363 // Trigger a renderer-initiated POST navigation (via the form) to a Chrome Web
366 // Store gallery URL (which will commit into a chrome-extension://cws-app-id). 364 // Store gallery URL (which will commit into a chrome-extension://cws-app-id).
367 bool ignored_script_result = false; 365 bool ignored_script_result = false;
368 content::TestNavigationObserver nav_observer(web_contents, 1); 366 content::TestNavigationObserver nav_observer(web_contents, 1);
369 content::RenderProcessHostWatcher crash_observer(
370 web_contents->GetMainFrame()->GetProcess(),
371 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
372 367
373 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( 368 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
374 web_contents, navigation_starting_script, &ignored_script_result)); 369 web_contents, navigation_starting_script, &ignored_script_result));
375 370
376 // When --isolate-extensions is enabled, the expectation is that the store 371 // The expectation is that the store will be properly put in its own process,
377 // will be properly put in its own process, otherwise the renderer process 372 // otherwise the renderer process is going to be terminated.
378 // is going to be terminated.
379 if (!extensions::IsIsolateExtensionsEnabled()) {
380 crash_observer.Wait();
381 return;
382 }
383
384 // Verify that the navigation succeeded. 373 // Verify that the navigation succeeded.
385 nav_observer.Wait(); 374 nav_observer.Wait();
386 EXPECT_EQ(cws_web_url, web_contents->GetLastCommittedURL()); 375 EXPECT_EQ(cws_web_url, web_contents->GetLastCommittedURL());
387 376
388 // Verify that we really have the Chrome Web Store app loaded in the Web 377 // Verify that we really have the Chrome Web Store app loaded in the Web
389 // Contents. 378 // Contents.
390 content::RenderProcessHost* new_process_host = 379 content::RenderProcessHost* new_process_host =
391 web_contents->GetMainFrame()->GetProcess(); 380 web_contents->GetMainFrame()->GetProcess();
392 EXPECT_TRUE(extensions::ProcessMap::Get(profile())->Contains( 381 EXPECT_TRUE(extensions::ProcessMap::Get(profile())->Contains(
393 extensions::kWebStoreAppId, new_process_host->GetID())); 382 extensions::kWebStoreAppId, new_process_host->GetID()));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // the process is the same for all SiteInstances. This allows us to verify 441 // the process is the same for all SiteInstances. This allows us to verify
453 // that the site-to-process map for the extension hasn't been overwritten by 442 // that the site-to-process map for the extension hasn't been overwritten by
454 // the process of the |blocked_url|. 443 // the process of the |blocked_url|.
455 scoped_refptr<content::SiteInstance> new_site_instance = 444 scoped_refptr<content::SiteInstance> new_site_instance =
456 content::SiteInstance::CreateForURL(web_contents->GetBrowserContext(), 445 content::SiteInstance::CreateForURL(web_contents->GetBrowserContext(),
457 extension->GetResourceURL("")); 446 extension->GetResourceURL(""));
458 EXPECT_TRUE(new_site_instance->HasProcess()); 447 EXPECT_TRUE(new_site_instance->HasProcess());
459 EXPECT_EQ(new_site_instance->GetProcess(), 448 EXPECT_EQ(new_site_instance->GetProcess(),
460 web_contents->GetSiteInstance()->GetProcess()); 449 web_contents->GetSiteInstance()->GetProcess());
461 } 450 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/lazy_background_page_apitest.cc ('k') | chrome/browser/extensions/process_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698