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/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" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 ASSERT_TRUE(extension); | 85 ASSERT_TRUE(extension); |
86 | 86 |
87 const std::string id = extension->id(); | 87 const std::string id = extension->id(); |
88 | 88 |
89 // Uninstall, then cancel via the confirm dialog. | 89 // Uninstall, then cancel via the confirm dialog. |
90 scoped_refptr<UninstallFunction> uninstall_function(new UninstallFunction()); | 90 scoped_refptr<UninstallFunction> uninstall_function(new UninstallFunction()); |
91 UninstallFunction::SetAutoConfirmForTest(false); | 91 UninstallFunction::SetAutoConfirmForTest(false); |
92 | 92 |
93 EXPECT_TRUE(MatchPattern( | 93 EXPECT_TRUE(MatchPattern( |
94 util::RunFunctionAndReturnError( | 94 util::RunFunctionAndReturnError( |
95 uninstall_function, | 95 uninstall_function.get(), |
96 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]", | 96 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]", |
97 id.c_str()), | 97 id.c_str()), |
98 browser()), | 98 browser()), |
99 keys::kUninstallCanceledError)); | 99 keys::kUninstallCanceledError)); |
100 | 100 |
101 // Make sure the extension wasn't uninstalled. | 101 // Make sure the extension wasn't uninstalled. |
102 EXPECT_TRUE(service->GetExtensionById(id, false) != NULL); | 102 EXPECT_TRUE(service->GetExtensionById(id, false) != NULL); |
103 | 103 |
104 // Uninstall, then accept via the confirm dialog. | 104 // Uninstall, then accept via the confirm dialog. |
105 uninstall_function = new UninstallFunction(); | 105 uninstall_function = new UninstallFunction(); |
106 UninstallFunction::SetAutoConfirmForTest(true); | 106 UninstallFunction::SetAutoConfirmForTest(true); |
107 | 107 |
108 util::RunFunctionAndReturnSingleResult( | 108 util::RunFunctionAndReturnSingleResult( |
109 uninstall_function, | 109 uninstall_function.get(), |
110 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]", id.c_str()), | 110 base::StringPrintf("[\"%s\", {\"showConfirmDialog\": true}]", id.c_str()), |
111 browser()); | 111 browser()); |
112 | 112 |
113 // Make sure the extension was uninstalled. | 113 // Make sure the extension was uninstalled. |
114 EXPECT_TRUE(service->GetExtensionById(id, false) == NULL); | 114 EXPECT_TRUE(service->GetExtensionById(id, false) == NULL); |
115 } | 115 } |
116 | 116 |
117 class ExtensionManagementApiEscalationTest : public ExtensionBrowserTest { | 117 class ExtensionManagementApiEscalationTest : public ExtensionBrowserTest { |
118 protected: | 118 protected: |
119 // The id of the permissions escalation test extension we use. | 119 // The id of the permissions escalation test extension we use. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 224 |
225 // 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 |
226 // extension should be reloaded and enabled. | 226 // extension should be reloaded and enabled. |
227 ASSERT_TRUE(CrashEnabledExtension(kId)); | 227 ASSERT_TRUE(CrashEnabledExtension(kId)); |
228 SetEnabled(false, true, ""); | 228 SetEnabled(false, true, ""); |
229 SetEnabled(true, true, ""); | 229 SetEnabled(true, true, ""); |
230 const extensions::Extension* extension = browser()->profile()-> | 230 const extensions::Extension* extension = browser()->profile()-> |
231 GetExtensionService()->GetExtensionById(kId, false); | 231 GetExtensionService()->GetExtensionById(kId, false); |
232 EXPECT_TRUE(extension); | 232 EXPECT_TRUE(extension); |
233 } | 233 } |
OLD | NEW |