| 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/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/extensions/api/management/management_api.h" | 9 #include "chrome/browser/extensions/api/management/management_api.h" |
| 10 #include "chrome/browser/extensions/api/management/management_api_constants.h" | 10 #include "chrome/browser/extensions/api/management/management_api_constants.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 namespace keys = extension_management_api_constants; | 27 namespace keys = extension_management_api_constants; |
| 28 namespace util = extension_function_test_utils; | 28 namespace util = extension_function_test_utils; |
| 29 | 29 |
| 30 namespace extensions { | 30 namespace extensions { |
| 31 | 31 |
| 32 class ExtensionManagementApiBrowserTest : public ExtensionBrowserTest { | 32 class ExtensionManagementApiBrowserTest : public ExtensionBrowserTest { |
| 33 protected: | 33 protected: |
| 34 bool CrashEnabledExtension(const std::string& extension_id) { | 34 bool CrashEnabledExtension(const std::string& extension_id) { |
| 35 ExtensionHost* background_host = | 35 ExtensionHost* background_host = |
| 36 ExtensionSystem::Get(browser()->profile())-> | 36 ProcessManager::Get(browser()->profile()) |
| 37 process_manager()->GetBackgroundHostForExtension(extension_id); | 37 ->GetBackgroundHostForExtension(extension_id); |
| 38 if (!background_host) | 38 if (!background_host) |
| 39 return false; | 39 return false; |
| 40 content::CrashTab(background_host->host_contents()); | 40 content::CrashTab(background_host->host_contents()); |
| 41 return true; | 41 return true; |
| 42 } | 42 } |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // We test this here instead of in an ExtensionApiTest because normal extensions | 45 // We test this here instead of in an ExtensionApiTest because normal extensions |
| 46 // are not allowed to call the install function. | 46 // are not allowed to call the install function. |
| 47 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, InstallEvent) { | 47 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, InstallEvent) { |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // extension should be reloaded and enabled. | 316 // extension should be reloaded and enabled. |
| 317 ASSERT_TRUE(CrashEnabledExtension(kId)); | 317 ASSERT_TRUE(CrashEnabledExtension(kId)); |
| 318 SetEnabled(false, true, std::string()); | 318 SetEnabled(false, true, std::string()); |
| 319 SetEnabled(true, true, std::string()); | 319 SetEnabled(true, true, std::string()); |
| 320 const Extension* extension = ExtensionSystem::Get(browser()->profile()) | 320 const Extension* extension = ExtensionSystem::Get(browser()->profile()) |
| 321 ->extension_service()->GetExtensionById(kId, false); | 321 ->extension_service()->GetExtensionById(kId, false); |
| 322 EXPECT_TRUE(extension); | 322 EXPECT_TRUE(extension); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace extensions | 325 } // namespace extensions |
| OLD | NEW |