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

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: yozments 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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, MAYBE_AllowOffStore) { 190 IN_PROC_BROWSER_TEST_F(ExtensionCrxInstallerTest, MAYBE_AllowOffStore) {
191 ExtensionService* service = browser()->profile()->GetExtensionService(); 191 ExtensionService* service = browser()->profile()->GetExtensionService();
192 const bool kTestData[] = {false, true}; 192 const bool kTestData[] = {false, true};
193 193
194 for (size_t i = 0; i < arraysize(kTestData); ++i) { 194 for (size_t i = 0; i < arraysize(kTestData); ++i) {
195 MockInstallUI* mock_ui = new MockInstallUI(browser()->profile()); 195 MockInstallUI* mock_ui = new MockInstallUI(browser()->profile());
196 scoped_refptr<CrxInstaller> crx_installer( 196 scoped_refptr<CrxInstaller> crx_installer(
197 CrxInstaller::Create(service, mock_ui)); 197 CrxInstaller::Create(service, mock_ui));
198 crx_installer->set_install_cause( 198 crx_installer->set_install_cause(
199 extension_misc::INSTALL_CAUSE_USER_DOWNLOAD); 199 extension_misc::INSTALL_CAUSE_USER_DOWNLOAD);
200 crx_installer->set_allow_off_store_install(kTestData[i]); 200
201 if (kTestData[i]) {
202 crx_installer->set_off_store_install_allow_reason(
203 CrxInstaller::OffStoreInstallAllowedInTest);
204 }
201 205
202 crx_installer->InstallCrx(test_data_dir_.AppendASCII("good.crx")); 206 crx_installer->InstallCrx(test_data_dir_.AppendASCII("good.crx"));
203 EXPECT_EQ(kTestData[i], WaitForExtensionInstall()) << kTestData[i]; 207 EXPECT_EQ(kTestData[i], WaitForExtensionInstall()) << kTestData[i];
204 EXPECT_EQ(kTestData[i], mock_ui->did_succeed()); 208 EXPECT_EQ(kTestData[i], mock_ui->did_succeed());
205 EXPECT_EQ(kTestData[i], mock_ui->confirmation_requested()) << kTestData[i]; 209 EXPECT_EQ(kTestData[i], mock_ui->confirmation_requested()) << kTestData[i];
206 if (kTestData[i]) { 210 if (kTestData[i]) {
207 EXPECT_EQ(string16(), mock_ui->error()) << kTestData[i]; 211 EXPECT_EQ(string16(), mock_ui->error()) << kTestData[i];
208 } else { 212 } else {
209 EXPECT_EQ(l10n_util::GetStringUTF16( 213 EXPECT_EQ(l10n_util::GetStringUTF16(
210 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), 214 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE),
211 mock_ui->error()) << kTestData[i]; 215 mock_ui->error()) << kTestData[i];
212 } 216 }
213 } 217 }
214 } 218 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698