| 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/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 "form.action = '" + cws_web_url.spec() + "';\n" | 354 "form.action = '" + cws_web_url.spec() + "';\n" |
| 355 "form.submit();\n" | 355 "form.submit();\n" |
| 356 "setTimeout(\n" | 356 "setTimeout(\n" |
| 357 " function() { window.domAutomationController.send(true); },\n" | 357 " function() { window.domAutomationController.send(true); },\n" |
| 358 " 0);\n"; | 358 " 0);\n"; |
| 359 | 359 |
| 360 // Trigger a renderer-initiated POST navigation (via the form) to a Chrome Web | 360 // Trigger a renderer-initiated POST navigation (via the form) to a Chrome Web |
| 361 // Store gallery URL (which will commit into a chrome-extension://cws-app-id). | 361 // Store gallery URL (which will commit into a chrome-extension://cws-app-id). |
| 362 bool ignored_script_result = false; | 362 bool ignored_script_result = false; |
| 363 content::TestNavigationObserver nav_observer(web_contents, 1); | 363 content::TestNavigationObserver nav_observer(web_contents, 1); |
| 364 content::RenderProcessHostWatcher crash_observer( |
| 365 web_contents->GetMainFrame()->GetProcess(), |
| 366 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); |
| 367 |
| 364 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 368 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 365 web_contents, navigation_starting_script, &ignored_script_result)); | 369 web_contents, navigation_starting_script, &ignored_script_result)); |
| 366 | 370 |
| 371 // When --isolate-extensions is enabled, the expectation is that the store |
| 372 // will be properly put in its own process, otherwise the renderer process |
| 373 // is going to be terminated. |
| 374 if (!extensions::IsIsolateExtensionsEnabled()) { |
| 375 crash_observer.Wait(); |
| 376 return; |
| 377 } |
| 378 |
| 367 // Verify that the navigation succeeded. | 379 // Verify that the navigation succeeded. |
| 368 nav_observer.Wait(); | 380 nav_observer.Wait(); |
| 369 EXPECT_EQ(cws_web_url, web_contents->GetLastCommittedURL()); | 381 EXPECT_EQ(cws_web_url, web_contents->GetLastCommittedURL()); |
| 370 | 382 |
| 371 // Verify that we really have the Chrome Web Store app loaded in the Web | 383 // Verify that we really have the Chrome Web Store app loaded in the Web |
| 372 // Contents. | 384 // Contents. |
| 373 content::RenderProcessHost* new_process_host = | 385 content::RenderProcessHost* new_process_host = |
| 374 web_contents->GetMainFrame()->GetProcess(); | 386 web_contents->GetMainFrame()->GetProcess(); |
| 375 EXPECT_TRUE(extensions::ProcessMap::Get(profile())->Contains( | 387 EXPECT_TRUE(extensions::ProcessMap::Get(profile())->Contains( |
| 376 extensions::kWebStoreAppId, new_process_host->GetID())); | 388 extensions::kWebStoreAppId, new_process_host->GetID())); |
| 377 | 389 |
| 378 // Verify that Chrome Web Store is isolated in a separate renderer process. | 390 // Verify that Chrome Web Store is isolated in a separate renderer process. |
| 379 if (extensions::IsIsolateExtensionsEnabled()) | 391 EXPECT_NE(old_process_host, new_process_host); |
| 380 EXPECT_NE(old_process_host, new_process_host); | |
| 381 } | 392 } |
| OLD | NEW |