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

Unified Diff: chrome/browser/extensions/api/management/management_api_browsertest.cc

Issue 57433010: Prevent creating a swapped out RVH in the same SiteInstance as the current one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/management/management_api_browsertest.cc
diff --git a/chrome/browser/extensions/api/management/management_api_browsertest.cc b/chrome/browser/extensions/api/management/management_api_browsertest.cc
index 51663c98415db6101b3ea3d65db2aeb34f51bb78..8b98a4f92a603c02a97f083945eca658947bd83e 100644
--- a/chrome/browser/extensions/api/management/management_api_browsertest.cc
+++ b/chrome/browser/extensions/api/management/management_api_browsertest.cc
@@ -21,6 +21,7 @@
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/notification_service.h"
#include "content/public/common/url_constants.h"
+#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
namespace keys = extension_management_api_constants;
@@ -31,18 +32,12 @@ namespace extensions {
class ExtensionManagementApiBrowserTest : public ExtensionBrowserTest {
protected:
bool CrashEnabledExtension(const std::string& extension_id) {
- content::WindowedNotificationObserver extension_crash_observer(
- chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
- content::NotificationService::AllSources());
ExtensionHost* background_host =
ExtensionSystem::Get(browser()->profile())->
process_manager()->GetBackgroundHostForExtension(extension_id);
if (!background_host)
return false;
- background_host->host_contents()->GetController().LoadURL(
- GURL(content::kChromeUICrashURL), content::Referrer(),
- content::PAGE_TRANSITION_LINK, std::string());
- extension_crash_observer.Wait();
+ content::CrashTab(background_host->host_contents());
return true;
}
};
@@ -265,10 +260,17 @@ IN_PROC_BROWSER_TEST_F(ExtensionManagementApiEscalationTest,
switches::kAppsGalleryInstallAutoConfirmForTests, "cancel");
SetEnabled(true, true, keys::kUserDidNotReEnableError);
- // This should succeed when user accepts dialog.
+ // This should succeed when user accepts dialog. We must wait for the process
+ // to connect *and* for the channel to finish initializing before trying to
+ // crash it. (NOTIFICATION_RENDERER_PROCESS_CREATED does not wait for the
+ // latter and can cause KillProcess to fail on Windows.)
+ content::WindowedNotificationObserver observer(
+ chrome::NOTIFICATION_EXTENSION_HOST_CREATED,
+ content::NotificationService::AllSources());
CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kAppsGalleryInstallAutoConfirmForTests, "accept");
SetEnabled(true, true, std::string());
+ observer.Wait();
// Crash the extension. Mock a reload by disabling and then enabling. The
// extension should be reloaded and enabled.
« no previous file with comments | « chrome/browser/apps/app_window_browsertest.cc ('k') | content/browser/frame_host/render_view_host_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698