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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 const std::string id = extension->id(); | 106 const std::string id = extension->id(); |
107 | 107 |
108 // Uninstall, then cancel via the confirm dialog. | 108 // Uninstall, then cancel via the confirm dialog. |
109 scoped_refptr<ManagementUninstallFunction> uninstall_function( | 109 scoped_refptr<ManagementUninstallFunction> uninstall_function( |
110 new ManagementUninstallFunction()); | 110 new ManagementUninstallFunction()); |
111 ManagementUninstallFunction::SetAutoConfirmForTest(false); | 111 ManagementUninstallFunction::SetAutoConfirmForTest(false); |
112 | 112 |
113 EXPECT_TRUE(MatchPattern( | 113 EXPECT_TRUE(MatchPattern( |
114 util::RunFunctionAndReturnError( | 114 util::RunFunctionAndReturnError( |
115 uninstall_function, | 115 uninstall_function.get(), |
116 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]", | 116 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]", |
117 id.c_str()), | 117 id.c_str()), |
118 browser()), | 118 browser()), |
119 keys::kUninstallCanceledError)); | 119 keys::kUninstallCanceledError)); |
120 | 120 |
121 // Make sure the extension wasn't uninstalled. | 121 // Make sure the extension wasn't uninstalled. |
122 EXPECT_TRUE(service->GetExtensionById(id, false) != NULL); | 122 EXPECT_TRUE(service->GetExtensionById(id, false) != NULL); |
123 | 123 |
124 // Uninstall, then accept via the confirm dialog. | 124 // Uninstall, then accept via the confirm dialog. |
125 uninstall_function = new ManagementUninstallFunction(); | 125 uninstall_function = new ManagementUninstallFunction(); |
126 ManagementUninstallFunction::SetAutoConfirmForTest(true); | 126 ManagementUninstallFunction::SetAutoConfirmForTest(true); |
127 | 127 |
128 util::RunFunctionAndReturnSingleResult( | 128 util::RunFunctionAndReturnSingleResult( |
129 uninstall_function, | 129 uninstall_function.get(), |
130 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]", id.c_str()), | 130 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]", id.c_str()), |
131 browser()); | 131 browser()); |
132 | 132 |
133 // Make sure the extension was uninstalled. | 133 // Make sure the extension was uninstalled. |
134 EXPECT_TRUE(service->GetExtensionById(id, false) == NULL); | 134 EXPECT_TRUE(service->GetExtensionById(id, false) == NULL); |
135 } | 135 } |
136 | 136 |
137 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, | 137 IN_PROC_BROWSER_TEST_F(ExtensionManagementApiBrowserTest, |
138 GetAllIncludesTerminated) { | 138 GetAllIncludesTerminated) { |
139 // Load an extension with a background page, so that we know it has a process | 139 // Load an extension with a background page, so that we know it has a process |
(...skipping 123 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, std::string()); | 265 SetEnabled(false, true, std::string()); |
266 SetEnabled(true, true, std::string()); | 266 SetEnabled(true, true, std::string()); |
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 |