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())); | |
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 } | 287 } |
298 }; | 288 }; |
299 | 289 |
300 class ExtensionCrxInstallerTestWithExperimentalApis | 290 class ExtensionCrxInstallerTestWithExperimentalApis |
301 : public ExtensionCrxInstallerTest { | 291 : public ExtensionCrxInstallerTest { |
302 protected: | 292 protected: |
303 void SetUpCommandLine(base::CommandLine* command_line) override { | 293 void SetUpCommandLine(base::CommandLine* command_line) override { |
304 ExtensionCrxInstallerTest::SetUpCommandLine(command_line); | 294 ExtensionCrxInstallerTest::SetUpCommandLine(command_line); |
305 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 295 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
306 } | 296 } |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 EXPECT_TRUE(WaitForCrxInstallerDone()); | 711 EXPECT_TRUE(WaitForCrxInstallerDone()); |
722 const Extension* extension = installer->extension(); | 712 const Extension* extension = installer->extension(); |
723 ASSERT_TRUE(extension); | 713 ASSERT_TRUE(extension); |
724 ASSERT_EQ(extension_id, extension->id()); | 714 ASSERT_EQ(extension_id, extension->id()); |
725 EXPECT_TRUE(ExtensionPrefs::Get(profile())->AllowFileAccess(extension_id)); | 715 EXPECT_TRUE(ExtensionPrefs::Get(profile())->AllowFileAccess(extension_id)); |
726 EXPECT_TRUE(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS); | 716 EXPECT_TRUE(extension->creation_flags() & Extension::ALLOW_FILE_ACCESS); |
727 } | 717 } |
728 } | 718 } |
729 | 719 |
730 } // namespace extensions | 720 } // namespace extensions |
OLD | NEW |