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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 bool CrashEnabledExtension(const std::string& extension_id) { | 32 bool CrashEnabledExtension(const std::string& extension_id) { |
33 content::WindowedNotificationObserver extension_crash_observer( | 33 content::WindowedNotificationObserver extension_crash_observer( |
34 chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, | 34 chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, |
35 content::NotificationService::AllSources()); | 35 content::NotificationService::AllSources()); |
36 ExtensionHost* background_host = | 36 ExtensionHost* background_host = |
37 ExtensionSystem::Get(browser()->profile())-> | 37 ExtensionSystem::Get(browser()->profile())-> |
38 process_manager()->GetBackgroundHostForExtension(extension_id); | 38 process_manager()->GetBackgroundHostForExtension(extension_id); |
39 if (!background_host) | 39 if (!background_host) |
40 return false; | 40 return false; |
41 background_host->host_contents()->GetController().LoadURL( | 41 background_host->host_contents()->GetController().LoadURL( |
42 GURL(chrome::kChromeUICrashURL), content::Referrer(), | 42 GURL(content::kChromeUICrashURL), content::Referrer(), |
43 content::PAGE_TRANSITION_LINK, std::string()); | 43 content::PAGE_TRANSITION_LINK, std::string()); |
44 extension_crash_observer.Wait(); | 44 extension_crash_observer.Wait(); |
45 return true; | 45 return true; |
46 } | 46 } |
47 }; | 47 }; |
48 | 48 |
49 // We test this here instead of in an ExtensionApiTest because normal extensions | 49 // We test this here instead of in an ExtensionApiTest because normal extensions |
50 // are not allowed to call the install function. | 50 // are not allowed to call the install function. |
51 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, InstallEvent) { | 51 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, InstallEvent) { |
52 ExtensionTestMessageListener listener1("ready", false); | 52 ExtensionTestMessageListener listener1("ready", false); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 // extension should be reloaded and enabled. | 263 // extension should be reloaded and enabled. |
264 ASSERT_TRUE(CrashEnabledExtension(kId)); | 264 ASSERT_TRUE(CrashEnabledExtension(kId)); |
265 SetEnabled(false, true, ""); | 265 SetEnabled(false, true, ""); |
266 SetEnabled(true, true, ""); | 266 SetEnabled(true, true, ""); |
267 const Extension* extension = ExtensionSystem::Get(browser()->profile())-> | 267 const Extension* extension = ExtensionSystem::Get(browser()->profile())-> |
268 extension_service()->GetExtensionById(kId, false); | 268 extension_service()->GetExtensionById(kId, false); |
269 EXPECT_TRUE(extension); | 269 EXPECT_TRUE(extension); |
270 } | 270 } |
271 | 271 |
272 } // namespace extensions | 272 } // namespace extensions |
OLD | NEW |