| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <map> | 6 #include <map> |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 UpdateExtension(id, | 1856 UpdateExtension(id, |
| 1857 extensions_path.AppendASCII("v2.crx"), | 1857 extensions_path.AppendASCII("v2.crx"), |
| 1858 ENABLED); | 1858 ENABLED); |
| 1859 ASSERT_EQ(std::string("2"), | 1859 ASSERT_EQ(std::string("2"), |
| 1860 service()->GetExtensionById(id, false)->version()->GetString()); | 1860 service()->GetExtensionById(id, false)->version()->GetString()); |
| 1861 } | 1861 } |
| 1862 | 1862 |
| 1863 // Verifies that the NTP page and launch ordinals are kept when updating apps. | 1863 // Verifies that the NTP page and launch ordinals are kept when updating apps. |
| 1864 TEST_F(ExtensionServiceTest, UpdateAppsRetainOrdinals) { | 1864 TEST_F(ExtensionServiceTest, UpdateAppsRetainOrdinals) { |
| 1865 InitializeEmptyExtensionService(); | 1865 InitializeEmptyExtensionService(); |
| 1866 AppSorting* sorting = ExtensionPrefs::Get(profile())->app_sorting(); | 1866 AppSorting* sorting = ExtensionSystem::Get(profile())->app_sorting(); |
| 1867 base::FilePath extensions_path = data_dir().AppendASCII("app_update"); | 1867 base::FilePath extensions_path = data_dir().AppendASCII("app_update"); |
| 1868 | 1868 |
| 1869 // First install v1 of a hosted app. | 1869 // First install v1 of a hosted app. |
| 1870 const Extension* extension = | 1870 const Extension* extension = |
| 1871 InstallCRX(extensions_path.AppendASCII("v1.crx"), INSTALL_NEW); | 1871 InstallCRX(extensions_path.AppendASCII("v1.crx"), INSTALL_NEW); |
| 1872 ASSERT_EQ(1u, registry()->enabled_extensions().size()); | 1872 ASSERT_EQ(1u, registry()->enabled_extensions().size()); |
| 1873 std::string id = extension->id(); | 1873 std::string id = extension->id(); |
| 1874 ASSERT_EQ(std::string("1"), extension->version()->GetString()); | 1874 ASSERT_EQ(std::string("1"), extension->version()->GetString()); |
| 1875 | 1875 |
| 1876 // Modify the ordinals so we can distinguish them from the defaults. | 1876 // Modify the ordinals so we can distinguish them from the defaults. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1892 ASSERT_TRUE(new_launch_ordinal.Equals(sorting->GetAppLaunchOrdinal(id))); | 1892 ASSERT_TRUE(new_launch_ordinal.Equals(sorting->GetAppLaunchOrdinal(id))); |
| 1893 } | 1893 } |
| 1894 | 1894 |
| 1895 // Ensures that the CWS has properly initialized ordinals. | 1895 // Ensures that the CWS has properly initialized ordinals. |
| 1896 TEST_F(ExtensionServiceTest, EnsureCWSOrdinalsInitialized) { | 1896 TEST_F(ExtensionServiceTest, EnsureCWSOrdinalsInitialized) { |
| 1897 InitializeEmptyExtensionService(); | 1897 InitializeEmptyExtensionService(); |
| 1898 service()->component_loader()->Add( | 1898 service()->component_loader()->Add( |
| 1899 IDR_WEBSTORE_MANIFEST, base::FilePath(FILE_PATH_LITERAL("web_store"))); | 1899 IDR_WEBSTORE_MANIFEST, base::FilePath(FILE_PATH_LITERAL("web_store"))); |
| 1900 service()->Init(); | 1900 service()->Init(); |
| 1901 | 1901 |
| 1902 AppSorting* sorting = ExtensionPrefs::Get(profile())->app_sorting(); | 1902 AppSorting* sorting = ExtensionSystem::Get(profile())->app_sorting(); |
| 1903 EXPECT_TRUE( | 1903 EXPECT_TRUE( |
| 1904 sorting->GetPageOrdinal(extensions::kWebStoreAppId).IsValid()); | 1904 sorting->GetPageOrdinal(extensions::kWebStoreAppId).IsValid()); |
| 1905 EXPECT_TRUE( | 1905 EXPECT_TRUE( |
| 1906 sorting->GetAppLaunchOrdinal(extensions::kWebStoreAppId).IsValid()); | 1906 sorting->GetAppLaunchOrdinal(extensions::kWebStoreAppId).IsValid()); |
| 1907 } | 1907 } |
| 1908 | 1908 |
| 1909 TEST_F(ExtensionServiceTest, InstallAppsWithUnlimitedStorage) { | 1909 TEST_F(ExtensionServiceTest, InstallAppsWithUnlimitedStorage) { |
| 1910 InitializeEmptyExtensionService(); | 1910 InitializeEmptyExtensionService(); |
| 1911 EXPECT_TRUE(registry()->enabled_extensions().is_empty()); | 1911 EXPECT_TRUE(registry()->enabled_extensions().is_empty()); |
| 1912 | 1912 |
| (...skipping 4248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6161 | 6161 |
| 6162 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 6162 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
| 6163 content::Source<Profile>(profile()), | 6163 content::Source<Profile>(profile()), |
| 6164 content::NotificationService::NoDetails()); | 6164 content::NotificationService::NoDetails()); |
| 6165 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); | 6165 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); |
| 6166 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 6166 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
| 6167 EXPECT_EQ(0u, registry()->disabled_extensions().size()); | 6167 EXPECT_EQ(0u, registry()->disabled_extensions().size()); |
| 6168 EXPECT_EQ(0u, registry()->terminated_extensions().size()); | 6168 EXPECT_EQ(0u, registry()->terminated_extensions().size()); |
| 6169 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); | 6169 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); |
| 6170 } | 6170 } |
| OLD | NEW |