Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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())); | 287 ASSERT_EQ(nullptr, crx_installer->install_checker_.get()); |
|
Devlin
2017/03/16 19:29:40
This is testing an implementation detail of the Cr
michaelpg
2017/03/17 04:25:22
This turns out to be the only user of WaitForCrxIn
| |
| 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(); | |
| 297 } | 288 } |
| 298 }; | 289 }; |
| 299 | 290 |
| 300 class ExtensionCrxInstallerTestWithExperimentalApis | 291 class ExtensionCrxInstallerTestWithExperimentalApis |
| 301 : public ExtensionCrxInstallerTest { | 292 : public ExtensionCrxInstallerTest { |
| 302 protected: | 293 protected: |
| 303 void SetUpCommandLine(base::CommandLine* command_line) override { | 294 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 304 ExtensionCrxInstallerTest::SetUpCommandLine(command_line); | 295 ExtensionCrxInstallerTest::SetUpCommandLine(command_line); |
| 305 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 296 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 306 } | 297 } |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 721 EXPECT_TRUE(WaitForCrxInstallerDone()); | 712 EXPECT_TRUE(WaitForCrxInstallerDone()); |
| 722 const Extension* extension = installer->extension(); | 713 const Extension* extension = installer->extension(); |
| 723 ASSERT_TRUE(extension); | 714 ASSERT_TRUE(extension); |
| 724 ASSERT_EQ(extension_id, extension->id()); | 715 ASSERT_EQ(extension_id, extension->id()); |
| 725 EXPECT_TRUE(ExtensionPrefs::Get(profile())->AllowFileAccess(extension_id)); | 716 EXPECT_TRUE(ExtensionPrefs::Get(profile())->AllowFileAccess(extension_id)); |
| 726 EXPECT_TRUE(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS); | 717 EXPECT_TRUE(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS); |
| 727 } | 718 } |
| 728 } | 719 } |
| 729 | 720 |
| 730 } // namespace extensions | 721 } // namespace extensions |
| OLD | NEW |