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

Side by Side Diff: chrome/browser/extensions/api/management/management_api_browsertest.cc

Issue 11246003: Remove Profile->GetExtensionProcessManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix extension_crash_recovery_browsertest Created 8 years, 2 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 | Annotate | Revision Log
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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "chrome/browser/extensions/api/management/management_api.h" 10 #include "chrome/browser/extensions/api/management/management_api.h"
11 #include "chrome/browser/extensions/api/management/management_api_constants.h" 11 #include "chrome/browser/extensions/api/management/management_api_constants.h"
12 #include "chrome/browser/extensions/extension_browsertest.h" 12 #include "chrome/browser/extensions/extension_browsertest.h"
13 #include "chrome/browser/extensions/extension_function_test_utils.h" 13 #include "chrome/browser/extensions/extension_function_test_utils.h"
14 #include "chrome/browser/extensions/extension_host.h" 14 #include "chrome/browser/extensions/extension_host.h"
15 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/extensions/extension_system.h"
16 #include "chrome/browser/extensions/extension_test_message_listener.h" 17 #include "chrome/browser/extensions/extension_test_message_listener.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
20 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
21 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
22 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
23 #include "content/public/test/test_utils.h" 24 #include "content/public/test/test_utils.h"
24 25
25 namespace keys = extension_management_api_constants; 26 namespace keys = extension_management_api_constants;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 EXPECT_TRUE(response == false); 165 EXPECT_TRUE(response == false);
165 EXPECT_EQ(expected_error, function->GetError()); 166 EXPECT_EQ(expected_error, function->GetError());
166 } 167 }
167 } 168 }
168 169
169 bool CrashEnabledExtension(const std::string& extension_id) { 170 bool CrashEnabledExtension(const std::string& extension_id) {
170 content::WindowedNotificationObserver extension_crash_observer( 171 content::WindowedNotificationObserver extension_crash_observer(
171 chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, 172 chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
172 content::NotificationService::AllSources()); 173 content::NotificationService::AllSources());
173 extensions::ExtensionHost* background_host = 174 extensions::ExtensionHost* background_host =
174 browser()->profile()->GetExtensionProcessManager()-> 175 extensions::ExtensionSystem::Get(browser()->profile())->
175 GetBackgroundHostForExtension(extension_id); 176 process_manager()->GetBackgroundHostForExtension(extension_id);
176 if (!background_host) 177 if (!background_host)
177 return false; 178 return false;
178 background_host->host_contents()->GetController().LoadURL( 179 background_host->host_contents()->GetController().LoadURL(
179 GURL(chrome::kChromeUICrashURL), content::Referrer(), 180 GURL(chrome::kChromeUICrashURL), content::Referrer(),
180 content::PAGE_TRANSITION_LINK, std::string()); 181 content::PAGE_TRANSITION_LINK, std::string());
181 extension_crash_observer.Wait(); 182 extension_crash_observer.Wait();
182 return true; 183 return true;
183 } 184 }
184 185
185 private: 186 private:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 224
224 // Crash the extension. Mock a reload by disabling and then enabling. The 225 // Crash the extension. Mock a reload by disabling and then enabling. The
225 // extension should be reloaded and enabled. 226 // extension should be reloaded and enabled.
226 ASSERT_TRUE(CrashEnabledExtension(kId)); 227 ASSERT_TRUE(CrashEnabledExtension(kId));
227 SetEnabled(false, true, ""); 228 SetEnabled(false, true, "");
228 SetEnabled(true, true, ""); 229 SetEnabled(true, true, "");
229 const extensions::Extension* extension = browser()->profile()-> 230 const extensions::Extension* extension = browser()->profile()->
230 GetExtensionService()->GetExtensionById(kId, false); 231 GetExtensionService()->GetExtensionById(kId, false);
231 EXPECT_TRUE(extension); 232 EXPECT_TRUE(extension);
232 } 233 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698