Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: chrome/browser/extensions/api/management/management_api_browsertest.cc

Issue 10912105: Allow chrome.management.setEnabled() to re-enable crashed extensions. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // Expect an error that user cancelled the dialog. 215 // Expect an error that user cancelled the dialog.
216 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 216 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
217 switches::kAppsGalleryInstallAutoConfirmForTests, "cancel"); 217 switches::kAppsGalleryInstallAutoConfirmForTests, "cancel");
218 SetEnabled(true, true, keys::kUserDidNotReEnableError); 218 SetEnabled(true, true, keys::kUserDidNotReEnableError);
219 219
220 // This should succeed when user accepts dialog. 220 // This should succeed when user accepts dialog.
221 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 221 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
222 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); 222 switches::kAppsGalleryInstallAutoConfirmForTests, "accept");
223 SetEnabled(true, true, ""); 223 SetEnabled(true, true, "");
224 224
225 // Crash the extension and try to enable. The extension should be reloaded and 225 // Crash the extension. Mock a reload by disabling and then enabling. The
226 // enabled. 226 // extension should be reloaded and enabled.
227 ASSERT_TRUE(CrashEnabledExtension(kId));
228 SetEnabled(true, true, "");
229
230 // Crash the extension again and try to disable. This call should be a no-op
231 // and the extension should remain unloaded.
232 ASSERT_TRUE(CrashEnabledExtension(kId)); 227 ASSERT_TRUE(CrashEnabledExtension(kId));
233 SetEnabled(false, true, ""); 228 SetEnabled(false, true, "");
229 SetEnabled(true, true, "");
234 const extensions::Extension* extension = browser()->profile()-> 230 const extensions::Extension* extension = browser()->profile()->
235 GetExtensionService()->GetTerminatedExtension(kId); 231 GetExtensionService()->GetExtensionById(kId, false);
236 ASSERT_TRUE(extension); 232 EXPECT_TRUE(extension);
237 } 233 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/management/management_api.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698