OLD | NEW |
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 11 matching lines...) Expand all Loading... |
22 #include "content/public/browser/render_frame_host.h" | 22 #include "content/public/browser/render_frame_host.h" |
23 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
24 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/browser/site_instance.h" | 25 #include "content/public/browser/site_instance.h" |
26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
27 #include "content/public/test/browser_test_utils.h" | 27 #include "content/public/test/browser_test_utils.h" |
28 #include "content/public/test/test_navigation_observer.h" | 28 #include "content/public/test/test_navigation_observer.h" |
29 #include "extensions/browser/extension_host.h" | 29 #include "extensions/browser/extension_host.h" |
30 #include "extensions/browser/process_manager.h" | 30 #include "extensions/browser/process_manager.h" |
31 #include "extensions/browser/process_map.h" | 31 #include "extensions/browser/process_map.h" |
| 32 #include "extensions/common/extension_urls.h" |
32 #include "extensions/common/switches.h" | 33 #include "extensions/common/switches.h" |
33 #include "net/dns/mock_host_resolver.h" | 34 #include "net/dns/mock_host_resolver.h" |
34 #include "net/test/embedded_test_server/embedded_test_server.h" | 35 #include "net/test/embedded_test_server/embedded_test_server.h" |
35 | 36 |
36 using content::NavigationController; | 37 using content::NavigationController; |
37 using content::WebContents; | 38 using content::WebContents; |
38 | 39 |
39 namespace { | 40 namespace { |
40 | 41 |
41 class ProcessManagementTest : public ExtensionBrowserTest { | 42 class ProcessManagementTest : public ExtensionBrowserTest { |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 // the process is the same for all SiteInstances. This allows us to verify | 452 // the process is the same for all SiteInstances. This allows us to verify |
452 // that the site-to-process map for the extension hasn't been overwritten by | 453 // that the site-to-process map for the extension hasn't been overwritten by |
453 // the process of the |blocked_url|. | 454 // the process of the |blocked_url|. |
454 scoped_refptr<content::SiteInstance> new_site_instance = | 455 scoped_refptr<content::SiteInstance> new_site_instance = |
455 content::SiteInstance::CreateForURL(web_contents->GetBrowserContext(), | 456 content::SiteInstance::CreateForURL(web_contents->GetBrowserContext(), |
456 extension->GetResourceURL("")); | 457 extension->GetResourceURL("")); |
457 EXPECT_TRUE(new_site_instance->HasProcess()); | 458 EXPECT_TRUE(new_site_instance->HasProcess()); |
458 EXPECT_EQ(new_site_instance->GetProcess(), | 459 EXPECT_EQ(new_site_instance->GetProcess(), |
459 web_contents->GetSiteInstance()->GetProcess()); | 460 web_contents->GetSiteInstance()->GetProcess()); |
460 } | 461 } |
| 462 |
| 463 // This problem is similar to https://crbug.com/622385. It happens when an |
| 464 // iframe error page with the Chrome Web Store URL is displayed and the iframe |
| 465 // and its parent reside in the same process. In this case, the renderer |
| 466 // process is killed with the RFH_CAN_COMMIT_URL_BLOCKED error code. This test |
| 467 // asserts that the renderer is still alive after the navigation. |
| 468 IN_PROC_BROWSER_TEST_F(ChromeWebStoreProcessTest, |
| 469 ChromeWebStoreBlockedByFrameSrc) { |
| 470 GURL url = |
| 471 embedded_test_server()->GetURL("/extensions/iframe-child-src-none.html"); |
| 472 ui_test_utils::NavigateToURL(browser(), url); |
| 473 |
| 474 WebContents* web_contents = |
| 475 browser()->tab_strip_model()->GetActiveWebContents(); |
| 476 |
| 477 // Make the iframe navigate to the Chrome Web Store and wait for the 'load' |
| 478 // event. This is also a check that the renderer is still alive after the |
| 479 // navigation. |
| 480 std::string message; |
| 481 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 482 web_contents, |
| 483 "var iframe = document.getElementById('test');" |
| 484 "iframe.onload = function() {" |
| 485 " domAutomationController.send('iframe loaded');" |
| 486 "};" |
| 487 "iframe.src = '" + |
| 488 std::string(extension_urls::kChromeWebstoreBaseURL) + "';", |
| 489 &message)); |
| 490 EXPECT_EQ("iframe loaded", message); |
| 491 } |
OLD | NEW |