| 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/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 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 // Reload the extensions. | 1871 // Reload the extensions. |
| 1872 service_->ReloadExtensions(); | 1872 service_->ReloadExtensions(); |
| 1873 const Extension* extension = service_->GetExtensionById(unpacked, false); | 1873 const Extension* extension = service_->GetExtensionById(unpacked, false); |
| 1874 EXPECT_EQ(unpacked, extension->id()); | 1874 EXPECT_EQ(unpacked, extension->id()); |
| 1875 ASSERT_EQ(1u, loaded_.size()); | 1875 ASSERT_EQ(1u, loaded_.size()); |
| 1876 | 1876 |
| 1877 // TODO(jstritar): Right now this just makes sure we don't crash and burn, but | 1877 // TODO(jstritar): Right now this just makes sure we don't crash and burn, but |
| 1878 // we should also test that preferences are preserved. | 1878 // we should also test that preferences are preserved. |
| 1879 } | 1879 } |
| 1880 | 1880 |
| 1881 #if defined(OS_POSIX) |
| 1882 TEST_F(ExtensionServiceTest, UnpackedExtensionMayContainSymlinkedFiles) { |
| 1883 FilePath source_data_dir = data_dir_. |
| 1884 AppendASCII("unpacked"). |
| 1885 AppendASCII("symlinks_allowed"); |
| 1886 |
| 1887 // Paths to test data files. |
| 1888 FilePath source_manifest = source_data_dir.AppendASCII("manifest.json"); |
| 1889 ASSERT_TRUE(file_util::PathExists(source_manifest)); |
| 1890 FilePath source_icon = source_data_dir.AppendASCII("icon.png"); |
| 1891 ASSERT_TRUE(file_util::PathExists(source_icon)); |
| 1892 |
| 1893 // Set up the temporary extension directory. |
| 1894 ScopedTempDir temp; |
| 1895 ASSERT_TRUE(temp.CreateUniqueTempDir()); |
| 1896 FilePath extension_path = temp.path(); |
| 1897 FilePath manifest = extension_path.Append(Extension::kManifestFilename); |
| 1898 FilePath icon_symlink = extension_path.AppendASCII("icon.png"); |
| 1899 file_util::CopyFile(source_manifest, manifest); |
| 1900 file_util::CreateSymbolicLink(source_icon, icon_symlink); |
| 1901 |
| 1902 // Load extension. |
| 1903 InitializeEmptyExtensionService(); |
| 1904 extensions::UnpackedInstaller::Create(service_)->Load(extension_path); |
| 1905 loop_.RunAllPending(); |
| 1906 |
| 1907 EXPECT_TRUE(GetErrors().empty()); |
| 1908 ASSERT_EQ(1u, loaded_.size()); |
| 1909 EXPECT_EQ(1u, service_->extensions()->size()); |
| 1910 } |
| 1911 #endif |
| 1912 |
| 1881 TEST_F(ExtensionServiceTest, InstallLocalizedTheme) { | 1913 TEST_F(ExtensionServiceTest, InstallLocalizedTheme) { |
| 1882 InitializeEmptyExtensionService(); | 1914 InitializeEmptyExtensionService(); |
| 1883 FilePath theme_path = data_dir_ | 1915 FilePath theme_path = data_dir_ |
| 1884 .AppendASCII("theme_i18n"); | 1916 .AppendASCII("theme_i18n"); |
| 1885 | 1917 |
| 1886 const Extension* theme = PackAndInstallCRX(theme_path, INSTALL_NEW); | 1918 const Extension* theme = PackAndInstallCRX(theme_path, INSTALL_NEW); |
| 1887 | 1919 |
| 1888 EXPECT_EQ(0u, GetErrors().size()); | 1920 EXPECT_EQ(0u, GetErrors().size()); |
| 1889 EXPECT_EQ(1u, service_->extensions()->size()); | 1921 EXPECT_EQ(1u, service_->extensions()->size()); |
| 1890 EXPECT_EQ("name", theme->name()); | 1922 EXPECT_EQ("name", theme->name()); |
| (...skipping 3074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4965 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0", | 4997 provider->UpdateOrAddExtension(hosted_app, "1.0.0.0", |
| 4966 data_dir_.AppendASCII("hosted_app.crx")); | 4998 data_dir_.AppendASCII("hosted_app.crx")); |
| 4967 | 4999 |
| 4968 service_->CheckForExternalUpdates(); | 5000 service_->CheckForExternalUpdates(); |
| 4969 loop_.RunAllPending(); | 5001 loop_.RunAllPending(); |
| 4970 | 5002 |
| 4971 ASSERT_TRUE(service_->PopulateExtensionGlobalError( | 5003 ASSERT_TRUE(service_->PopulateExtensionGlobalError( |
| 4972 extension_global_error.get())); | 5004 extension_global_error.get())); |
| 4973 ASSERT_EQ(1u, extension_global_error->get_external_extension_ids()->size()); | 5005 ASSERT_EQ(1u, extension_global_error->get_external_extension_ids()->size()); |
| 4974 } | 5006 } |
| OLD | NEW |