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

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

Issue 10824030: Move ExtensionHost into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 years, 4 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
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()->extensions()->GetByID(extension_id);
77 ASSERT_TRUE(extension); 77 ASSERT_TRUE(extension);
78 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 content::RenderProcessHost* extension_rph =
83 extension_host->render_view_host()->GetProcess(); 83 extension_host->render_view_host()->GetProcess();
84 base::KillProcess(extension_rph->GetHandle(), content::RESULT_CODE_KILLED, 84 base::KillProcess(extension_rph->GetHandle(), content::RESULT_CODE_KILLED,
85 false); 85 false);
86 ASSERT_TRUE(WaitForExtensionCrash(extension_id)); 86 ASSERT_TRUE(WaitForExtensionCrash(extension_id));
87 ASSERT_FALSE(GetExtensionProcessManager()-> 87 ASSERT_FALSE(GetExtensionProcessManager()->
88 GetBackgroundHostForExtension(extension_id)); 88 GetBackgroundHostForExtension(extension_id));
89 } 89 }
90 90
91 void CheckExtensionConsistency(std::string extension_id) { 91 void CheckExtensionConsistency(std::string extension_id) {
92 const Extension* extension = 92 const Extension* extension =
93 GetExtensionService()->extensions()->GetByID(extension_id); 93 GetExtensionService()->extensions()->GetByID(extension_id);
94 ASSERT_TRUE(extension); 94 ASSERT_TRUE(extension);
95 ExtensionHost* extension_host = GetExtensionProcessManager()-> 95 extensions::ExtensionHost* extension_host = GetExtensionProcessManager()->
96 GetBackgroundHostForExtension(extension_id); 96 GetBackgroundHostForExtension(extension_id);
97 ASSERT_TRUE(extension_host); 97 ASSERT_TRUE(extension_host);
98 ExtensionProcessManager::ViewSet all_views = 98 ExtensionProcessManager::ViewSet all_views =
99 GetExtensionProcessManager()->GetAllViews(); 99 GetExtensionProcessManager()->GetAllViews();
100 ExtensionProcessManager::ViewSet::const_iterator it = 100 ExtensionProcessManager::ViewSet::const_iterator it =
101 all_views.find(extension_host->host_contents()->GetRenderViewHost()); 101 all_views.find(extension_host->host_contents()->GetRenderViewHost());
102 ASSERT_FALSE(it == all_views.end()); 102 ASSERT_FALSE(it == all_views.end());
103 ASSERT_TRUE(extension_host->IsRenderViewLive()); 103 ASSERT_TRUE(extension_host->IsRenderViewLive());
104 extensions::ProcessMap* process_map = 104 extensions::ProcessMap* process_map =
105 browser()->profile()->GetExtensionService()->process_map(); 105 browser()->profile()->GetExtensionService()->process_map();
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 &chrome::GetActiveWebContents(browser())->GetController())); 489 &chrome::GetActiveWebContents(browser())->GetController()));
490 chrome::Reload(browser(), CURRENT_TAB); 490 chrome::Reload(browser(), CURRENT_TAB);
491 observer.Wait(); 491 observer.Wait();
492 } 492 }
493 // Extension should now be loaded. 493 // Extension should now be loaded.
494 SCOPED_TRACE("after reloading the tab"); 494 SCOPED_TRACE("after reloading the tab");
495 CheckExtensionConsistency(first_extension_id_); 495 CheckExtensionConsistency(first_extension_id_);
496 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size()); 496 ASSERT_EQ(size_before + 1, GetExtensionService()->extensions()->size());
497 ASSERT_EQ(0U, CountBalloons()); 497 ASSERT_EQ(0U, CountBalloons());
498 } 498 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_browsertest.cc ('k') | chrome/browser/extensions/extension_devtools_browsertests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698