| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/json_reader.h" | 10 #include "base/json_reader.h" |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 // class of validation that we do to the directory structure of the extension. | 720 // class of validation that we do to the directory structure of the extension. |
| 721 // We did not used to handle this correctly for installation. | 721 // We did not used to handle this correctly for installation. |
| 722 path = extensions_path.AppendASCII("bad_underscore.crx"); | 722 path = extensions_path.AppendASCII("bad_underscore.crx"); |
| 723 InstallExtension(path, false); | 723 InstallExtension(path, false); |
| 724 ValidatePrefKeyCount(pref_count); | 724 ValidatePrefKeyCount(pref_count); |
| 725 | 725 |
| 726 // TODO(erikkay): add more tests for many of the failure cases. | 726 // TODO(erikkay): add more tests for many of the failure cases. |
| 727 // TODO(erikkay): add tests for upgrade cases. | 727 // TODO(erikkay): add tests for upgrade cases. |
| 728 } | 728 } |
| 729 | 729 |
| 730 #if defined(OS_WIN) // TODO(port) | |
| 731 // Test Packaging and installing an extension. | 730 // Test Packaging and installing an extension. |
| 732 // TODO(rafaelw): add more tests for failure cases. | 731 // TODO(rafaelw): add more tests for failure cases. |
| 733 TEST_F(ExtensionsServiceTest, PackExtension) { | 732 TEST_F(ExtensionsServiceTest, PackExtension) { |
| 734 InitializeEmptyExtensionsService(); | 733 InitializeEmptyExtensionsService(); |
| 735 FilePath extensions_path; | 734 FilePath extensions_path; |
| 736 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path)); | 735 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path)); |
| 737 extensions_path = extensions_path.AppendASCII("extensions"); | 736 extensions_path = extensions_path.AppendASCII("extensions"); |
| 738 FilePath input_directory = extensions_path | 737 FilePath input_directory = extensions_path |
| 739 .AppendASCII("good") | 738 .AppendASCII("good") |
| 740 .AppendASCII("Extensions") | 739 .AppendASCII("Extensions") |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 FilePath crx_path(output_directory.AppendASCII("ex1.crx")); | 783 FilePath crx_path(output_directory.AppendASCII("ex1.crx")); |
| 785 | 784 |
| 786 scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); | 785 scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); |
| 787 ASSERT_TRUE(creator->Run(input_directory, crx_path, privkey_path, | 786 ASSERT_TRUE(creator->Run(input_directory, crx_path, privkey_path, |
| 788 FilePath())); | 787 FilePath())); |
| 789 | 788 |
| 790 InstallExtension(crx_path, true); | 789 InstallExtension(crx_path, true); |
| 791 | 790 |
| 792 file_util::Delete(crx_path, false); | 791 file_util::Delete(crx_path, false); |
| 793 } | 792 } |
| 794 #endif // defined(OS_WIN) | |
| 795 | 793 |
| 796 TEST_F(ExtensionsServiceTest, InstallTheme) { | 794 TEST_F(ExtensionsServiceTest, InstallTheme) { |
| 797 InitializeEmptyExtensionsService(); | 795 InitializeEmptyExtensionsService(); |
| 798 FilePath extensions_path; | 796 FilePath extensions_path; |
| 799 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path)); | 797 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &extensions_path)); |
| 800 extensions_path = extensions_path.AppendASCII("extensions"); | 798 extensions_path = extensions_path.AppendASCII("extensions"); |
| 801 | 799 |
| 802 // A theme. | 800 // A theme. |
| 803 FilePath path = extensions_path.AppendASCII("theme.crx"); | 801 FilePath path = extensions_path.AppendASCII("theme.crx"); |
| 804 InstallExtension(path, true); | 802 InstallExtension(path, true); |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 | 1561 |
| 1564 recorder.set_ready(false); | 1562 recorder.set_ready(false); |
| 1565 command_line.reset(new CommandLine(L"")); | 1563 command_line.reset(new CommandLine(L"")); |
| 1566 service = new ExtensionsService(&profile, command_line.get(), | 1564 service = new ExtensionsService(&profile, command_line.get(), |
| 1567 profile.GetPrefs(), install_dir, &loop, &loop, false); | 1565 profile.GetPrefs(), install_dir, &loop, &loop, false); |
| 1568 EXPECT_FALSE(service->extensions_enabled()); | 1566 EXPECT_FALSE(service->extensions_enabled()); |
| 1569 service->Init(); | 1567 service->Init(); |
| 1570 loop.RunAllPending(); | 1568 loop.RunAllPending(); |
| 1571 EXPECT_TRUE(recorder.ready()); | 1569 EXPECT_TRUE(recorder.ready()); |
| 1572 } | 1570 } |
| OLD | NEW |