OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <memory> | 5 #include <memory> |
| 6 #include <utility> |
6 | 7 |
7 #include "base/macros.h" | 8 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
9 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/extension_service_test_base.h" | 12 #include "chrome/browser/extensions/extension_service_test_base.h" |
12 #include "chrome/browser/extensions/extension_service_test_with_install.h" | 13 #include "chrome/browser/extensions/extension_service_test_with_install.h" |
13 #include "chrome/browser/extensions/test_extension_system.h" | 14 #include "chrome/browser/extensions/test_extension_system.h" |
14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/test/base/test_browser_window.h" | 16 #include "chrome/test/base/test_browser_window.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 EXPECT_FALSE(RunFunction(function, uninstall_args)); | 191 EXPECT_FALSE(RunFunction(function, uninstall_args)); |
191 // The uninstall should have failed. | 192 // The uninstall should have failed. |
192 EXPECT_TRUE(registry()->enabled_extensions().Contains(extension_id)); | 193 EXPECT_TRUE(registry()->enabled_extensions().Contains(extension_id)); |
193 EXPECT_EQ(ErrorUtils::FormatErrorMessage(constants::kUninstallCanceledError, | 194 EXPECT_EQ(ErrorUtils::FormatErrorMessage(constants::kUninstallCanceledError, |
194 extension_id), | 195 extension_id), |
195 function->GetError()); | 196 function->GetError()); |
196 | 197 |
197 // Try again, using showConfirmDialog: false. | 198 // Try again, using showConfirmDialog: false. |
198 std::unique_ptr<base::DictionaryValue> options(new base::DictionaryValue()); | 199 std::unique_ptr<base::DictionaryValue> options(new base::DictionaryValue()); |
199 options->SetBoolean("showConfirmDialog", false); | 200 options->SetBoolean("showConfirmDialog", false); |
200 uninstall_args.Append(options.release()); | 201 uninstall_args.Append(std::move(options)); |
201 function = new ManagementUninstallFunction(); | 202 function = new ManagementUninstallFunction(); |
202 EXPECT_TRUE(registry()->enabled_extensions().Contains(extension_id)); | 203 EXPECT_TRUE(registry()->enabled_extensions().Contains(extension_id)); |
203 EXPECT_FALSE(RunFunction(function, uninstall_args)); | 204 EXPECT_FALSE(RunFunction(function, uninstall_args)); |
204 // This should still fail, since extensions can only suppress the dialog for | 205 // This should still fail, since extensions can only suppress the dialog for |
205 // uninstalling themselves. | 206 // uninstalling themselves. |
206 EXPECT_TRUE(registry()->enabled_extensions().Contains(extension_id)); | 207 EXPECT_TRUE(registry()->enabled_extensions().Contains(extension_id)); |
207 EXPECT_EQ(ErrorUtils::FormatErrorMessage(constants::kUninstallCanceledError, | 208 EXPECT_EQ(ErrorUtils::FormatErrorMessage(constants::kUninstallCanceledError, |
208 extension_id), | 209 extension_id), |
209 function->GetError()); | 210 function->GetError()); |
210 | 211 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 EXPECT_FALSE(prefs->DidExtensionEscalatePermissions(extension_id)); | 375 EXPECT_FALSE(prefs->DidExtensionEscalatePermissions(extension_id)); |
375 } | 376 } |
376 | 377 |
377 // Some permissions for v2 extension should be granted by now. | 378 // Some permissions for v2 extension should be granted by now. |
378 known_perms = prefs->GetGrantedPermissions(extension_id); | 379 known_perms = prefs->GetGrantedPermissions(extension_id); |
379 ASSERT_TRUE(known_perms); | 380 ASSERT_TRUE(known_perms); |
380 EXPECT_FALSE(known_perms->IsEmpty()); | 381 EXPECT_FALSE(known_perms->IsEmpty()); |
381 } | 382 } |
382 | 383 |
383 } // namespace extensions | 384 } // namespace extensions |
OLD | NEW |