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

Side by Side Diff: chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc

Issue 137793011: Require user confirmation for chrome.management.uninstall except when uninstalling self. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ExtensionManagementApiBrowserTest.LaunchApp Created 6 years, 11 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 | Annotate | Revision Log
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 <vector> 5 #include <vector>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/extensions/api/management/management_api.h"
12 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h" 13 #include "chrome/browser/extensions/api/webstore_private/webstore_private_api.h"
13 #include "chrome/browser/extensions/extension_apitest.h" 14 #include "chrome/browser/extensions/extension_apitest.h"
14 #include "chrome/browser/extensions/extension_function_test_utils.h" 15 #include "chrome/browser/extensions/extension_function_test_utils.h"
15 #include "chrome/browser/extensions/extension_install_prompt.h" 16 #include "chrome/browser/extensions/extension_install_prompt.h"
16 #include "chrome/browser/extensions/extension_install_ui.h" 17 #include "chrome/browser/extensions/extension_install_ui.h"
17 #include "chrome/browser/extensions/extension_service.h" 18 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/extensions/webstore_installer.h" 19 #include "chrome/browser/extensions/webstore_installer.h"
19 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" 22 #include "chrome/browser/ui/tabs/tab_strip_model.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 GURL::Replacements replace_host; 120 GURL::Replacements replace_host;
120 std::string host_str("www.example.com"); 121 std::string host_str("www.example.com");
121 replace_host.SetHostStr(host_str); 122 replace_host.SetHostStr(host_str);
122 123
123 return url.ReplaceComponents(replace_host); 124 return url.ReplaceComponents(replace_host);
124 } 125 }
125 126
126 // Navigates to |page| and runs the Extension API test there. Any downloads 127 // Navigates to |page| and runs the Extension API test there. Any downloads
127 // of extensions will return the contents of |crx_file|. 128 // of extensions will return the contents of |crx_file|.
128 bool RunInstallTest(const std::string& page, const std::string& crx_file) { 129 bool RunInstallTest(const std::string& page, const std::string& crx_file) {
130 // Auto-confirm the uninstallation dialog.
131 ManagementUninstallFunction::SetAutoConfirmForTest(true);
129 #if defined(OS_WIN) && !defined(NDEBUG) 132 #if defined(OS_WIN) && !defined(NDEBUG)
130 // See http://crbug.com/177163 for details. 133 // See http://crbug.com/177163 for details.
131 return true; 134 return true;
132 #else 135 #else
133 GURL crx_url = GetTestServerURL(crx_file); 136 GURL crx_url = GetTestServerURL(crx_file);
134 CommandLine::ForCurrentProcess()->AppendSwitchASCII( 137 CommandLine::ForCurrentProcess()->AppendSwitchASCII(
135 switches::kAppsGalleryUpdateURL, crx_url.spec()); 138 switches::kAppsGalleryUpdateURL, crx_url.spec());
136 139
137 GURL page_url = GetTestServerURL(page); 140 GURL page_url = GetTestServerURL(page);
138 return RunPageTest(page_url.spec()); 141 return RunPageTest(page_url.spec());
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 content::GpuDataManager::GetInstance()->InitializeForTesting( 361 content::GpuDataManager::GetInstance()->InitializeForTesting(
359 json_blacklist, gpu_info); 362 json_blacklist, gpu_info);
360 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted( 363 EXPECT_TRUE(content::GpuDataManager::GetInstance()->IsFeatureBlacklisted(
361 gpu::GPU_FEATURE_TYPE_WEBGL)); 364 gpu::GPU_FEATURE_TYPE_WEBGL));
362 365
363 bool webgl_allowed = false; 366 bool webgl_allowed = false;
364 RunTest(webgl_allowed); 367 RunTest(webgl_allowed);
365 } 368 }
366 369
367 } // namespace extensions 370 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698