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 if OFF by default. | |
asargent_no_longer_on_chrome
2011/08/04 21:56:03
typo: "access if OFF" -> "access is OFF"
jstritar
2011/08/05 15:13:29
Done.
| |
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 | |
1759 TEST_F(ExtensionServiceTest, UpdateApps) { | 1771 TEST_F(ExtensionServiceTest, UpdateApps) { |
1760 InitializeEmptyExtensionService(); | 1772 InitializeEmptyExtensionService(); |
1761 FilePath extensions_path = data_dir_.AppendASCII("app_update"); | 1773 FilePath extensions_path = data_dir_.AppendASCII("app_update"); |
1762 | 1774 |
1763 // First install v1 of a hosted app. | 1775 // First install v1 of a hosted app. |
1764 InstallCrx(extensions_path.AppendASCII("v1.crx"), true); | 1776 InstallCrx(extensions_path.AppendASCII("v1.crx"), true); |
1765 ASSERT_EQ(1u, service_->extensions()->size()); | 1777 ASSERT_EQ(1u, service_->extensions()->size()); |
1766 std::string id = service_->extensions()->at(0)->id(); | 1778 std::string id = service_->extensions()->at(0)->id(); |
1767 ASSERT_EQ(std::string("1"), | 1779 ASSERT_EQ(std::string("1"), |
1768 service_->extensions()->at(0)->version()->GetString()); | 1780 service_->extensions()->at(0)->version()->GetString()); |
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3796 ASSERT_FALSE(AddPendingSyncInstall()); | 3808 ASSERT_FALSE(AddPendingSyncInstall()); |
3797 | 3809 |
3798 // Wait for the external source to install. | 3810 // Wait for the external source to install. |
3799 WaitForCrxInstall(crx_path_, true); | 3811 WaitForCrxInstall(crx_path_, true); |
3800 ASSERT_TRUE(IsCrxInstalled()); | 3812 ASSERT_TRUE(IsCrxInstalled()); |
3801 | 3813 |
3802 // Now that the extension is installed, sync request should fail | 3814 // Now that the extension is installed, sync request should fail |
3803 // because the extension is already installed. | 3815 // because the extension is already installed. |
3804 ASSERT_FALSE(AddPendingSyncInstall()); | 3816 ASSERT_FALSE(AddPendingSyncInstall()); |
3805 } | 3817 } |
OLD | NEW |