OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_service_unittest.h" | 5 #include "chrome/browser/extensions/extension_service_unittest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1749 | 1749 |
1750 // Another app with non-overlapping extent. Should succeed. | 1750 // Another app with non-overlapping extent. Should succeed. |
1751 PackAndInstallCrx(data_dir_.AppendASCII("app2"), true); | 1751 PackAndInstallCrx(data_dir_.AppendASCII("app2"), true); |
1752 ValidatePrefKeyCount(++pref_count); | 1752 ValidatePrefKeyCount(++pref_count); |
1753 | 1753 |
1754 // A third app whose extent overlaps the first. Should fail. | 1754 // A third app whose extent overlaps the first. Should fail. |
1755 PackAndInstallCrx(data_dir_.AppendASCII("app3"), false); | 1755 PackAndInstallCrx(data_dir_.AppendASCII("app3"), false); |
1756 ValidatePrefKeyCount(pref_count); | 1756 ValidatePrefKeyCount(pref_count); |
1757 } | 1757 } |
1758 | 1758 |
1759 // Tests that file access is OFF by default. | |
1760 TEST_F(ExtensionServiceTest, DefaultFileAccess) { | |
1761 InitializeEmptyExtensionService(); | |
1762 PackAndInstallCrx(data_dir_.AppendASCII("permissions").AppendASCII("files"), | |
1763 true); | |
1764 | |
1765 EXPECT_EQ(0u, GetErrors().size()); | |
1766 EXPECT_EQ(1u, service_->extensions()->size()); | |
1767 std::string id = service_->extensions()->at(0)->id(); | |
1768 EXPECT_FALSE(service_->extension_prefs()->AllowFileAccess(id)); | |
1769 } | |
1770 | |
1771 TEST_F(ExtensionServiceTest, UpdateApps) { | 1759 TEST_F(ExtensionServiceTest, UpdateApps) { |
1772 InitializeEmptyExtensionService(); | 1760 InitializeEmptyExtensionService(); |
1773 FilePath extensions_path = data_dir_.AppendASCII("app_update"); | 1761 FilePath extensions_path = data_dir_.AppendASCII("app_update"); |
1774 | 1762 |
1775 // First install v1 of a hosted app. | 1763 // First install v1 of a hosted app. |
1776 InstallCrx(extensions_path.AppendASCII("v1.crx"), true); | 1764 InstallCrx(extensions_path.AppendASCII("v1.crx"), true); |
1777 ASSERT_EQ(1u, service_->extensions()->size()); | 1765 ASSERT_EQ(1u, service_->extensions()->size()); |
1778 std::string id = service_->extensions()->at(0)->id(); | 1766 std::string id = service_->extensions()->at(0)->id(); |
1779 ASSERT_EQ(std::string("1"), | 1767 ASSERT_EQ(std::string("1"), |
1780 service_->extensions()->at(0)->version()->GetString()); | 1768 service_->extensions()->at(0)->version()->GetString()); |
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3808 ASSERT_FALSE(AddPendingSyncInstall()); | 3796 ASSERT_FALSE(AddPendingSyncInstall()); |
3809 | 3797 |
3810 // Wait for the external source to install. | 3798 // Wait for the external source to install. |
3811 WaitForCrxInstall(crx_path_, true); | 3799 WaitForCrxInstall(crx_path_, true); |
3812 ASSERT_TRUE(IsCrxInstalled()); | 3800 ASSERT_TRUE(IsCrxInstalled()); |
3813 | 3801 |
3814 // Now that the extension is installed, sync request should fail | 3802 // Now that the extension is installed, sync request should fail |
3815 // because the extension is already installed. | 3803 // because the extension is already installed. |
3816 ASSERT_FALSE(AddPendingSyncInstall()); | 3804 ASSERT_FALSE(AddPendingSyncInstall()); |
3817 } | 3805 } |
OLD | NEW |