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

Side by Side Diff: chrome/browser/extensions/crx_installer_browsertest.cc

Issue 10542048: Add a group policy controlling which sites can install extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 6 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 "chrome/browser/download/download_crx_util.h" 5 #include "chrome/browser/download/download_crx_util.h"
6 #include "chrome/browser/download/download_service.h" 6 #include "chrome/browser/download/download_service.h"
7 #include "chrome/browser/download/download_service_factory.h" 7 #include "chrome/browser/download/download_service_factory.h"
8 #include "chrome/browser/download/download_test_observer.h" 8 #include "chrome/browser/download/download_test_observer.h"
9 #include "chrome/browser/extensions/crx_installer.h" 9 #include "chrome/browser/extensions/crx_installer.h"
10 #include "chrome/browser/extensions/extension_browsertest.h" 10 #include "chrome/browser/extensions/extension_browsertest.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 ExtensionService* service = browser()->profile()->GetExtensionService(); 192 ExtensionService* service = browser()->profile()->GetExtensionService();
193 const bool kTestData[] = {false, true}; 193 const bool kTestData[] = {false, true};
194 194
195 for (size_t i = 0; i < arraysize(kTestData); ++i) { 195 for (size_t i = 0; i < arraysize(kTestData); ++i) {
196 MockInstallPrompt* mock_prompt = 196 MockInstallPrompt* mock_prompt =
197 new MockInstallPrompt(browser()->profile()); 197 new MockInstallPrompt(browser()->profile());
198 scoped_refptr<CrxInstaller> crx_installer( 198 scoped_refptr<CrxInstaller> crx_installer(
199 CrxInstaller::Create(service, mock_prompt)); 199 CrxInstaller::Create(service, mock_prompt));
200 crx_installer->set_install_cause( 200 crx_installer->set_install_cause(
201 extension_misc::INSTALL_CAUSE_USER_DOWNLOAD); 201 extension_misc::INSTALL_CAUSE_USER_DOWNLOAD);
202 crx_installer->set_allow_off_store_install(kTestData[i]); 202
203 if (kTestData[i]) {
204 crx_installer->set_off_store_install_allow_reason(
205 CrxInstaller::OffStoreInstallAllowedInTest);
206 }
203 207
204 crx_installer->InstallCrx(test_data_dir_.AppendASCII("good.crx")); 208 crx_installer->InstallCrx(test_data_dir_.AppendASCII("good.crx"));
205 EXPECT_EQ(kTestData[i], WaitForExtensionInstall()) << kTestData[i]; 209 EXPECT_EQ(kTestData[i], WaitForExtensionInstall()) << kTestData[i];
206 EXPECT_EQ(kTestData[i], mock_prompt->did_succeed()); 210 EXPECT_EQ(kTestData[i], mock_prompt->did_succeed());
207 EXPECT_EQ(kTestData[i], mock_prompt->confirmation_requested()) << 211 EXPECT_EQ(kTestData[i], mock_prompt->confirmation_requested()) <<
208 kTestData[i]; 212 kTestData[i];
209 if (kTestData[i]) { 213 if (kTestData[i]) {
210 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i]; 214 EXPECT_EQ(string16(), mock_prompt->error()) << kTestData[i];
211 } else { 215 } else {
212 EXPECT_EQ(l10n_util::GetStringUTF16( 216 EXPECT_EQ(l10n_util::GetStringUTF16(
213 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), 217 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE),
214 mock_prompt->error()) << kTestData[i]; 218 mock_prompt->error()) << kTestData[i];
215 } 219 }
216 } 220 }
217 } 221 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer.cc ('k') | chrome/browser/extensions/extension_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698