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

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

Issue 2769813004: Revert of Simplify ExtensionInstallChecker into a single-use class (Closed)
Patch Set: Created 3 years, 9 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 "chrome/browser/extensions/crx_installer.h" 5 #include "chrome/browser/extensions/crx_installer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 ExtensionService* service = 277 ExtensionService* service =
278 extensions::ExtensionSystem::Get(browser()->profile()) 278 extensions::ExtensionSystem::Get(browser()->profile())
279 ->extension_service(); 279 ->extension_service();
280 scoped_refptr<CrxInstaller> crx_installer( 280 scoped_refptr<CrxInstaller> crx_installer(
281 CrxInstaller::CreateSilent(service)); 281 CrxInstaller::CreateSilent(service));
282 crx_installer->set_error_on_unsupported_requirements(true); 282 crx_installer->set_error_on_unsupported_requirements(true);
283 crx_installer->InstallWebApp( 283 crx_installer->InstallWebApp(
284 CreateWebAppInfo(kAppTitle, kAppDescription, kAppUrl, 64)); 284 CreateWebAppInfo(kAppTitle, kAppDescription, kAppUrl, 64));
285 EXPECT_TRUE(WaitForCrxInstallerDone()); 285 EXPECT_TRUE(WaitForCrxInstallerDone());
286 ASSERT_TRUE(crx_installer->extension()); 286 ASSERT_TRUE(crx_installer->extension());
287 ASSERT_FALSE(HasRequirementErrors(crx_installer.get()));
288 ASSERT_FALSE(HasPolicyErrors(crx_installer.get()));
289 }
290
291 bool HasRequirementErrors(CrxInstaller* crx_installer) {
292 return !crx_installer->install_checker_.requirement_errors().empty();
293 }
294
295 bool HasPolicyErrors(CrxInstaller* crx_installer) {
296 return !crx_installer->install_checker_.policy_error().empty();
287 } 297 }
288 }; 298 };
289 299
290 class ExtensionCrxInstallerTestWithExperimentalApis 300 class ExtensionCrxInstallerTestWithExperimentalApis
291 : public ExtensionCrxInstallerTest { 301 : public ExtensionCrxInstallerTest {
292 protected: 302 protected:
293 void SetUpCommandLine(base::CommandLine* command_line) override { 303 void SetUpCommandLine(base::CommandLine* command_line) override {
294 ExtensionCrxInstallerTest::SetUpCommandLine(command_line); 304 ExtensionCrxInstallerTest::SetUpCommandLine(command_line);
295 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); 305 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
296 } 306 }
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 EXPECT_TRUE(WaitForCrxInstallerDone()); 721 EXPECT_TRUE(WaitForCrxInstallerDone());
712 const Extension* extension = installer->extension(); 722 const Extension* extension = installer->extension();
713 ASSERT_TRUE(extension); 723 ASSERT_TRUE(extension);
714 ASSERT_EQ(extension_id, extension->id()); 724 ASSERT_EQ(extension_id, extension->id());
715 EXPECT_TRUE(ExtensionPrefs::Get(profile())->AllowFileAccess(extension_id)); 725 EXPECT_TRUE(ExtensionPrefs::Get(profile())->AllowFileAccess(extension_id));
716 EXPECT_TRUE(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS); 726 EXPECT_TRUE(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS);
717 } 727 }
718 } 728 }
719 729
720 } // namespace extensions 730 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/crx_installer.cc ('k') | chrome/browser/extensions/extension_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698