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

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

Issue 10832237: Allow chrome.management.setEnabled() to re-enable crashed extensions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Navigate to about:crash instead of using base::KillProcess Created 8 years, 3 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 "base/process_util.h" 5 #include "base/process_util.h"
6 #include "chrome/browser/browser_process.h" 6 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/extensions/extension_browsertest.h" 7 #include "chrome/browser/extensions/extension_browsertest.h"
8 #include "chrome/browser/extensions/extension_host.h" 8 #include "chrome/browser/extensions/extension_host.h"
9 #include "chrome/browser/extensions/extension_process_manager.h" 9 #include "chrome/browser/extensions/extension_process_manager.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 size_t CountBalloons() { 66 size_t CountBalloons() {
67 NotificationUIManager* manager = 67 NotificationUIManager* manager =
68 g_browser_process->notification_ui_manager(); 68 g_browser_process->notification_ui_manager();
69 BalloonCollection::Balloons balloons = 69 BalloonCollection::Balloons balloons =
70 manager->balloon_collection()->GetActiveBalloons(); 70 manager->balloon_collection()->GetActiveBalloons();
71 return balloons.size(); 71 return balloons.size();
72 } 72 }
73 73
74 void CrashExtension(std::string extension_id) { 74 void CrashExtension(std::string extension_id) {
75 const Extension* extension = 75 const Extension* extension =
76 GetExtensionService()->extensions()->GetByID(extension_id); 76 GetExtensionService()->GetExtensionById(extension_id, false);
77 ASSERT_TRUE(extension); 77 ASSERT_TRUE(extension);
78 extensions::ExtensionHost* extension_host = GetExtensionProcessManager()-> 78 extensions::ExtensionHost* extension_host = GetExtensionProcessManager()->
79 GetBackgroundHostForExtension(extension_id); 79 GetBackgroundHostForExtension(extension_id);
80 ASSERT_TRUE(extension_host); 80 ASSERT_TRUE(extension_host);
81 81
82 content::RenderProcessHost* extension_rph = 82 base::KillProcess(extension_host->render_process_host()->GetHandle(),
83 extension_host->render_view_host()->GetProcess(); 83 content::RESULT_CODE_KILLED, false);
84 base::KillProcess(extension_rph->GetHandle(), content::RESULT_CODE_KILLED,
85 false);
86 ASSERT_TRUE(WaitForExtensionCrash(extension_id)); 84 ASSERT_TRUE(WaitForExtensionCrash(extension_id));
87 ASSERT_FALSE(GetExtensionProcessManager()-> 85 ASSERT_FALSE(GetExtensionProcessManager()->
88 GetBackgroundHostForExtension(extension_id)); 86 GetBackgroundHostForExtension(extension_id));
89 } 87 }
90 88
91 void CheckExtensionConsistency(std::string extension_id) { 89 void CheckExtensionConsistency(std::string extension_id) {
92 const Extension* extension = 90 const Extension* extension =
93 GetExtensionService()->extensions()->GetByID(extension_id); 91 GetExtensionService()->extensions()->GetByID(extension_id);
94 ASSERT_TRUE(extension); 92 ASSERT_TRUE(extension);
95 extensions::ExtensionHost* extension_host = GetExtensionProcessManager()-> 93 extensions::ExtensionHost* extension_host = GetExtensionProcessManager()->
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 &chrome::GetActiveWebContents(browser())->GetController())); 487 &chrome::GetActiveWebContents(browser())->GetController()));
490 chrome::Reload(browser(), CURRENT_TAB); 488 chrome::Reload(browser(), CURRENT_TAB);
491 observer.Wait(); 489 observer.Wait();
492 } 490 }
493 // Extension should now be loaded. 491 // Extension should now be loaded.
494 SCOPED_TRACE("after reloading the tab"); 492 SCOPED_TRACE("after reloading the tab");
495 CheckExtensionConsistency(first_extension_id_); 493 CheckExtensionConsistency(first_extension_id_);
496 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); 494 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size());
497 ASSERT_EQ(0U, CountBalloons()); 495 ASSERT_EQ(0U, CountBalloons());
498 } 496 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698