| 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 <set> | 6 #include <set> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 #include "extensions/common/manifest_constants.h" | 100 #include "extensions/common/manifest_constants.h" |
| 101 #include "extensions/common/manifest_handlers/background_info.h" | 101 #include "extensions/common/manifest_handlers/background_info.h" |
| 102 #include "extensions/common/manifest_url_handlers.h" | 102 #include "extensions/common/manifest_url_handlers.h" |
| 103 #include "extensions/common/permissions/permission_set.h" | 103 #include "extensions/common/permissions/permission_set.h" |
| 104 #include "extensions/common/permissions/permissions_data.h" | 104 #include "extensions/common/permissions/permissions_data.h" |
| 105 #include "extensions/common/switches.h" | 105 #include "extensions/common/switches.h" |
| 106 #include "extensions/common/url_pattern.h" | 106 #include "extensions/common/url_pattern.h" |
| 107 #include "extensions/common/value_builder.h" | 107 #include "extensions/common/value_builder.h" |
| 108 #include "gpu/config/gpu_info.h" | 108 #include "gpu/config/gpu_info.h" |
| 109 #include "grit/browser_resources.h" | 109 #include "grit/browser_resources.h" |
| 110 #include "grit/generated_resources.h" |
| 110 #include "net/cookies/canonical_cookie.h" | 111 #include "net/cookies/canonical_cookie.h" |
| 111 #include "net/cookies/cookie_monster.h" | 112 #include "net/cookies/cookie_monster.h" |
| 112 #include "net/cookies/cookie_options.h" | 113 #include "net/cookies/cookie_options.h" |
| 113 #include "net/url_request/url_request_context.h" | 114 #include "net/url_request/url_request_context.h" |
| 114 #include "net/url_request/url_request_context_getter.h" | 115 #include "net/url_request/url_request_context_getter.h" |
| 115 #include "storage/browser/database/database_tracker.h" | 116 #include "storage/browser/database/database_tracker.h" |
| 116 #include "storage/browser/quota/quota_manager.h" | 117 #include "storage/browser/quota/quota_manager.h" |
| 117 #include "storage/common/database/database_identifier.h" | 118 #include "storage/common/database/database_identifier.h" |
| 118 #include "sync/api/fake_sync_change_processor.h" | 119 #include "sync/api/fake_sync_change_processor.h" |
| 119 #include "sync/api/string_ordinal.h" | 120 #include "sync/api/string_ordinal.h" |
| 120 #include "sync/api/sync_data.h" | 121 #include "sync/api/sync_data.h" |
| 121 #include "sync/api/sync_error_factory.h" | 122 #include "sync/api/sync_error_factory.h" |
| 122 #include "sync/api/sync_error_factory_mock.h" | 123 #include "sync/api/sync_error_factory_mock.h" |
| 123 #include "sync/api/syncable_service.h" | 124 #include "sync/api/syncable_service.h" |
| 124 #include "sync/protocol/app_specifics.pb.h" | 125 #include "sync/protocol/app_specifics.pb.h" |
| 125 #include "sync/protocol/extension_specifics.pb.h" | 126 #include "sync/protocol/extension_specifics.pb.h" |
| 126 #include "sync/protocol/sync.pb.h" | 127 #include "sync/protocol/sync.pb.h" |
| 127 #include "testing/gtest/include/gtest/gtest.h" | 128 #include "testing/gtest/include/gtest/gtest.h" |
| 128 #include "testing/platform_test.h" | 129 #include "testing/platform_test.h" |
| 130 #include "ui/base/l10n/l10n_util.h" |
| 129 #include "url/gurl.h" | 131 #include "url/gurl.h" |
| 130 | 132 |
| 131 #if defined(ENABLE_MANAGED_USERS) | 133 #if defined(ENABLE_MANAGED_USERS) |
| 132 #include "chrome/browser/supervised_user/supervised_user_service.h" | 134 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 133 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 135 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 134 #endif | 136 #endif |
| 135 | 137 |
| 136 #if defined(OS_CHROMEOS) | 138 #if defined(OS_CHROMEOS) |
| 137 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 139 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
| 138 #include "chrome/browser/chromeos/settings/cros_settings.h" | 140 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| (...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 source_install_dir.DirName().Append(chrome::kPreferencesFilename); | 1307 source_install_dir.DirName().Append(chrome::kPreferencesFilename); |
| 1306 | 1308 |
| 1307 InitializeInstalledExtensionService(pref_path, source_install_dir); | 1309 InitializeInstalledExtensionService(pref_path, source_install_dir); |
| 1308 | 1310 |
| 1309 service()->Init(); | 1311 service()->Init(); |
| 1310 | 1312 |
| 1311 ASSERT_EQ(4u, GetErrors().size()); | 1313 ASSERT_EQ(4u, GetErrors().size()); |
| 1312 ASSERT_EQ(0u, loaded_.size()); | 1314 ASSERT_EQ(0u, loaded_.size()); |
| 1313 | 1315 |
| 1314 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[0]), | 1316 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[0]), |
| 1315 std::string("Could not load extension from '*'. ") + | 1317 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " + |
| 1316 extensions::manifest_errors::kManifestUnreadable)) << | 1318 extensions::manifest_errors::kManifestUnreadable)) << |
| 1317 base::UTF16ToUTF8(GetErrors()[0]); | 1319 base::UTF16ToUTF8(GetErrors()[0]); |
| 1318 | 1320 |
| 1319 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[1]), | 1321 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[1]), |
| 1320 std::string("Could not load extension from '*'. ") + | 1322 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " + |
| 1321 extensions::manifest_errors::kManifestUnreadable)) << | 1323 extensions::manifest_errors::kManifestUnreadable)) << |
| 1322 base::UTF16ToUTF8(GetErrors()[1]); | 1324 base::UTF16ToUTF8(GetErrors()[1]); |
| 1323 | 1325 |
| 1324 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[2]), | 1326 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[2]), |
| 1325 std::string("Could not load extension from '*'. ") + | 1327 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " + |
| 1326 extensions::manifest_errors::kMissingFile)) << | 1328 extensions::manifest_errors::kMissingFile)) << |
| 1327 base::UTF16ToUTF8(GetErrors()[2]); | 1329 base::UTF16ToUTF8(GetErrors()[2]); |
| 1328 | 1330 |
| 1329 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[3]), | 1331 EXPECT_TRUE(MatchPattern(base::UTF16ToUTF8(GetErrors()[3]), |
| 1330 std::string("Could not load extension from '*'. ") + | 1332 l10n_util::GetStringUTF8(IDS_EXTENSIONS_LOAD_ERROR_MESSAGE) + " *. " + |
| 1331 extensions::manifest_errors::kManifestUnreadable)) << | 1333 extensions::manifest_errors::kManifestUnreadable)) << |
| 1332 base::UTF16ToUTF8(GetErrors()[3]); | 1334 base::UTF16ToUTF8(GetErrors()[3]); |
| 1333 }; | 1335 }; |
| 1334 | 1336 |
| 1335 // Test various cases for delayed install because of missing imports. | 1337 // Test various cases for delayed install because of missing imports. |
| 1336 TEST_F(ExtensionServiceTest, PendingImports) { | 1338 TEST_F(ExtensionServiceTest, PendingImports) { |
| 1337 InitPluginService(); | 1339 InitPluginService(); |
| 1338 | 1340 |
| 1339 base::FilePath source_install_dir = | 1341 base::FilePath source_install_dir = |
| 1340 data_dir().AppendASCII("pending_updates_with_imports").AppendASCII( | 1342 data_dir().AppendASCII("pending_updates_with_imports").AppendASCII( |
| (...skipping 5790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7131 | 7133 |
| 7132 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 7134 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
| 7133 content::Source<Profile>(profile()), | 7135 content::Source<Profile>(profile()), |
| 7134 content::NotificationService::NoDetails()); | 7136 content::NotificationService::NoDetails()); |
| 7135 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); | 7137 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); |
| 7136 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 7138 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
| 7137 EXPECT_EQ(0u, registry()->disabled_extensions().size()); | 7139 EXPECT_EQ(0u, registry()->disabled_extensions().size()); |
| 7138 EXPECT_EQ(0u, registry()->terminated_extensions().size()); | 7140 EXPECT_EQ(0u, registry()->terminated_extensions().size()); |
| 7139 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); | 7141 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); |
| 7140 } | 7142 } |
| OLD | NEW |