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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 void RemoveExtension(const std::string& id) { | 270 void RemoveExtension(const std::string& id) { |
271 extension_map_.erase(id); | 271 extension_map_.erase(id); |
272 } | 272 } |
273 | 273 |
274 // ExternalProvider implementation: | 274 // ExternalProvider implementation: |
275 void VisitRegisteredExtension() override { | 275 void VisitRegisteredExtension() override { |
276 visit_count_++; | 276 visit_count_++; |
277 for (DataMap::const_iterator i = extension_map_.begin(); | 277 for (DataMap::const_iterator i = extension_map_.begin(); |
278 i != extension_map_.end(); ++i) { | 278 i != extension_map_.end(); ++i) { |
279 base::Version version(i->second.first); | 279 Version version(i->second.first); |
280 | 280 |
281 visitor_->OnExternalExtensionFileFound( | 281 visitor_->OnExternalExtensionFileFound( |
282 i->first, &version, i->second.second, location_, | 282 i->first, &version, i->second.second, location_, |
283 Extension::NO_FLAGS, false, false); | 283 Extension::NO_FLAGS, false, false); |
284 } | 284 } |
285 visitor_->OnExternalProviderReady(this); | 285 visitor_->OnExternalProviderReady(this); |
286 } | 286 } |
287 | 287 |
288 bool HasExtension(const std::string& id) const override { | 288 bool HasExtension(const std::string& id) const override { |
289 return extension_map_.find(id) != extension_map_.end(); | 289 return extension_map_.find(id) != extension_map_.end(); |
290 } | 290 } |
291 | 291 |
292 bool GetExtensionDetails(const std::string& id, | 292 bool GetExtensionDetails(const std::string& id, |
293 Manifest::Location* location, | 293 Manifest::Location* location, |
294 scoped_ptr<base::Version>* version) const override { | 294 scoped_ptr<Version>* version) const override { |
295 DataMap::const_iterator it = extension_map_.find(id); | 295 DataMap::const_iterator it = extension_map_.find(id); |
296 if (it == extension_map_.end()) | 296 if (it == extension_map_.end()) |
297 return false; | 297 return false; |
298 | 298 |
299 if (version) | 299 if (version) |
300 version->reset(new base::Version(it->second.first)); | 300 version->reset(new Version(it->second.first)); |
301 | 301 |
302 if (location) | 302 if (location) |
303 *location = location_; | 303 *location = location_; |
304 | 304 |
305 return true; | 305 return true; |
306 } | 306 } |
307 | 307 |
308 bool IsReady() const override { return true; } | 308 bool IsReady() const override { return true; } |
309 | 309 |
310 void ServiceShutdown() override {} | 310 void ServiceShutdown() override {} |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 // Reset our counter. | 378 // Reset our counter. |
379 ids_found_ = 0; | 379 ids_found_ = 0; |
380 // Ask the provider to look up all extensions and return them. | 380 // Ask the provider to look up all extensions and return them. |
381 provider_->VisitRegisteredExtension(); | 381 provider_->VisitRegisteredExtension(); |
382 | 382 |
383 return ids_found_; | 383 return ids_found_; |
384 } | 384 } |
385 | 385 |
386 bool OnExternalExtensionFileFound(const std::string& id, | 386 bool OnExternalExtensionFileFound(const std::string& id, |
387 const base::Version* version, | 387 const Version* version, |
388 const base::FilePath& path, | 388 const base::FilePath& path, |
389 Manifest::Location unused, | 389 Manifest::Location unused, |
390 int creation_flags, | 390 int creation_flags, |
391 bool mark_acknowledged, | 391 bool mark_acknowledged, |
392 bool install_immediately) override { | 392 bool install_immediately) override { |
393 EXPECT_EQ(expected_creation_flags_, creation_flags); | 393 EXPECT_EQ(expected_creation_flags_, creation_flags); |
394 | 394 |
395 ++ids_found_; | 395 ++ids_found_; |
396 base::DictionaryValue* pref; | 396 base::DictionaryValue* pref; |
397 // This tests is to make sure that the provider only notifies us of the | 397 // This tests is to make sure that the provider only notifies us of the |
398 // values we gave it. So if the id we doesn't exist in our internal | 398 // values we gave it. So if the id we doesn't exist in our internal |
399 // dictionary then something is wrong. | 399 // dictionary then something is wrong. |
400 EXPECT_TRUE(prefs_->GetDictionary(id, &pref)) | 400 EXPECT_TRUE(prefs_->GetDictionary(id, &pref)) |
401 << "Got back ID (" << id.c_str() << ") we weren't expecting"; | 401 << "Got back ID (" << id.c_str() << ") we weren't expecting"; |
402 | 402 |
403 EXPECT_TRUE(path.IsAbsolute()); | 403 EXPECT_TRUE(path.IsAbsolute()); |
404 if (!fake_base_path_.empty()) | 404 if (!fake_base_path_.empty()) |
405 EXPECT_TRUE(fake_base_path_.IsParent(path)); | 405 EXPECT_TRUE(fake_base_path_.IsParent(path)); |
406 | 406 |
407 if (pref) { | 407 if (pref) { |
408 EXPECT_TRUE(provider_->HasExtension(id)); | 408 EXPECT_TRUE(provider_->HasExtension(id)); |
409 | 409 |
410 // Ask provider if the extension we got back is registered. | 410 // Ask provider if the extension we got back is registered. |
411 Manifest::Location location = Manifest::INVALID_LOCATION; | 411 Manifest::Location location = Manifest::INVALID_LOCATION; |
412 scoped_ptr<base::Version> v1; | 412 scoped_ptr<Version> v1; |
413 base::FilePath crx_path; | 413 base::FilePath crx_path; |
414 | 414 |
415 EXPECT_TRUE(provider_->GetExtensionDetails(id, NULL, &v1)); | 415 EXPECT_TRUE(provider_->GetExtensionDetails(id, NULL, &v1)); |
416 EXPECT_STREQ(version->GetString().c_str(), v1->GetString().c_str()); | 416 EXPECT_STREQ(version->GetString().c_str(), v1->GetString().c_str()); |
417 | 417 |
418 scoped_ptr<base::Version> v2; | 418 scoped_ptr<Version> v2; |
419 EXPECT_TRUE(provider_->GetExtensionDetails(id, &location, &v2)); | 419 EXPECT_TRUE(provider_->GetExtensionDetails(id, &location, &v2)); |
420 EXPECT_STREQ(version->GetString().c_str(), v1->GetString().c_str()); | 420 EXPECT_STREQ(version->GetString().c_str(), v1->GetString().c_str()); |
421 EXPECT_STREQ(version->GetString().c_str(), v2->GetString().c_str()); | 421 EXPECT_STREQ(version->GetString().c_str(), v2->GetString().c_str()); |
422 EXPECT_EQ(Manifest::EXTERNAL_PREF, location); | 422 EXPECT_EQ(Manifest::EXTERNAL_PREF, location); |
423 | 423 |
424 // Remove it so we won't count it ever again. | 424 // Remove it so we won't count it ever again. |
425 prefs_->Remove(id, NULL); | 425 prefs_->Remove(id, NULL); |
426 } | 426 } |
427 return true; | 427 return true; |
428 } | 428 } |
(...skipping 10 matching lines...) Expand all Loading... |
439 // values we gave it. So if the id we doesn't exist in our internal | 439 // values we gave it. So if the id we doesn't exist in our internal |
440 // dictionary then something is wrong. | 440 // dictionary then something is wrong. |
441 EXPECT_TRUE(prefs_->GetDictionary(id, &pref)) | 441 EXPECT_TRUE(prefs_->GetDictionary(id, &pref)) |
442 << L"Got back ID (" << id.c_str() << ") we weren't expecting"; | 442 << L"Got back ID (" << id.c_str() << ") we weren't expecting"; |
443 EXPECT_EQ(Manifest::EXTERNAL_PREF_DOWNLOAD, location); | 443 EXPECT_EQ(Manifest::EXTERNAL_PREF_DOWNLOAD, location); |
444 | 444 |
445 if (pref) { | 445 if (pref) { |
446 EXPECT_TRUE(provider_->HasExtension(id)); | 446 EXPECT_TRUE(provider_->HasExtension(id)); |
447 | 447 |
448 // External extensions with update URLs do not have versions. | 448 // External extensions with update URLs do not have versions. |
449 scoped_ptr<base::Version> v1; | 449 scoped_ptr<Version> v1; |
450 Manifest::Location location1 = Manifest::INVALID_LOCATION; | 450 Manifest::Location location1 = Manifest::INVALID_LOCATION; |
451 EXPECT_TRUE(provider_->GetExtensionDetails(id, &location1, &v1)); | 451 EXPECT_TRUE(provider_->GetExtensionDetails(id, &location1, &v1)); |
452 EXPECT_FALSE(v1.get()); | 452 EXPECT_FALSE(v1.get()); |
453 EXPECT_EQ(Manifest::EXTERNAL_PREF_DOWNLOAD, location1); | 453 EXPECT_EQ(Manifest::EXTERNAL_PREF_DOWNLOAD, location1); |
454 | 454 |
455 std::string parsed_install_parameter; | 455 std::string parsed_install_parameter; |
456 pref->GetString("install_parameter", &parsed_install_parameter); | 456 pref->GetString("install_parameter", &parsed_install_parameter); |
457 EXPECT_EQ(parsed_install_parameter, install_parameter); | 457 EXPECT_EQ(parsed_install_parameter, install_parameter); |
458 | 458 |
459 // Remove it so we won't count it again. | 459 // Remove it so we won't count it again. |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 // extension object. | 1566 // extension object. |
1567 TEST_F(ExtensionServiceTest, InstallingExternalExtensionWithFlags) { | 1567 TEST_F(ExtensionServiceTest, InstallingExternalExtensionWithFlags) { |
1568 const char kPrefFromBookmark[] = "from_bookmark"; | 1568 const char kPrefFromBookmark[] = "from_bookmark"; |
1569 | 1569 |
1570 InitializeEmptyExtensionService(); | 1570 InitializeEmptyExtensionService(); |
1571 | 1571 |
1572 base::FilePath path = data_dir().AppendASCII("good.crx"); | 1572 base::FilePath path = data_dir().AppendASCII("good.crx"); |
1573 service()->set_extensions_enabled(true); | 1573 service()->set_extensions_enabled(true); |
1574 | 1574 |
1575 // Register and install an external extension. | 1575 // Register and install an external extension. |
1576 base::Version version("1.0.0.0"); | 1576 Version version("1.0.0.0"); |
1577 content::WindowedNotificationObserver observer( | 1577 content::WindowedNotificationObserver observer( |
1578 extensions::NOTIFICATION_CRX_INSTALLER_DONE, | 1578 extensions::NOTIFICATION_CRX_INSTALLER_DONE, |
1579 content::NotificationService::AllSources()); | 1579 content::NotificationService::AllSources()); |
1580 if (service()->OnExternalExtensionFileFound( | 1580 if (service()->OnExternalExtensionFileFound( |
1581 good_crx, | 1581 good_crx, |
1582 &version, | 1582 &version, |
1583 path, | 1583 path, |
1584 Manifest::EXTERNAL_PREF, | 1584 Manifest::EXTERNAL_PREF, |
1585 Extension::FROM_BOOKMARK, | 1585 Extension::FROM_BOOKMARK, |
1586 false /* mark_acknowledged */, | 1586 false /* mark_acknowledged */, |
(...skipping 16 matching lines...) Expand all Loading... |
1603 } | 1603 } |
1604 | 1604 |
1605 // Test the handling of Extension::EXTERNAL_EXTENSION_UNINSTALLED | 1605 // Test the handling of Extension::EXTERNAL_EXTENSION_UNINSTALLED |
1606 TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) { | 1606 TEST_F(ExtensionServiceTest, UninstallingExternalExtensions) { |
1607 InitializeEmptyExtensionService(); | 1607 InitializeEmptyExtensionService(); |
1608 | 1608 |
1609 base::FilePath path = data_dir().AppendASCII("good.crx"); | 1609 base::FilePath path = data_dir().AppendASCII("good.crx"); |
1610 service()->set_extensions_enabled(true); | 1610 service()->set_extensions_enabled(true); |
1611 | 1611 |
1612 // Install an external extension. | 1612 // Install an external extension. |
1613 base::Version version("1.0.0.0"); | 1613 Version version("1.0.0.0"); |
1614 content::WindowedNotificationObserver observer( | 1614 content::WindowedNotificationObserver observer( |
1615 extensions::NOTIFICATION_CRX_INSTALLER_DONE, | 1615 extensions::NOTIFICATION_CRX_INSTALLER_DONE, |
1616 content::NotificationService::AllSources()); | 1616 content::NotificationService::AllSources()); |
1617 if (service()->OnExternalExtensionFileFound(good_crx, | 1617 if (service()->OnExternalExtensionFileFound(good_crx, |
1618 &version, | 1618 &version, |
1619 path, | 1619 path, |
1620 Manifest::EXTERNAL_PREF, | 1620 Manifest::EXTERNAL_PREF, |
1621 Extension::NO_FLAGS, | 1621 Extension::NO_FLAGS, |
1622 false, | 1622 false, |
1623 false)) { | 1623 false)) { |
(...skipping 13 matching lines...) Expand all Loading... |
1637 path, | 1637 path, |
1638 Manifest::EXTERNAL_PREF, | 1638 Manifest::EXTERNAL_PREF, |
1639 Extension::NO_FLAGS, | 1639 Extension::NO_FLAGS, |
1640 false, | 1640 false, |
1641 false); | 1641 false); |
1642 base::RunLoop().RunUntilIdle(); | 1642 base::RunLoop().RunUntilIdle(); |
1643 ASSERT_TRUE(NULL == service()->GetExtensionById(good_crx, false)); | 1643 ASSERT_TRUE(NULL == service()->GetExtensionById(good_crx, false)); |
1644 ValidateIntegerPref(good_crx, "state", | 1644 ValidateIntegerPref(good_crx, "state", |
1645 Extension::EXTERNAL_EXTENSION_UNINSTALLED); | 1645 Extension::EXTERNAL_EXTENSION_UNINSTALLED); |
1646 | 1646 |
1647 version = base::Version("1.0.0.1"); | 1647 version = Version("1.0.0.1"); |
1648 // Repeat the same thing with a newer version of the extension. | 1648 // Repeat the same thing with a newer version of the extension. |
1649 path = data_dir().AppendASCII("good2.crx"); | 1649 path = data_dir().AppendASCII("good2.crx"); |
1650 service()->OnExternalExtensionFileFound(good_crx, | 1650 service()->OnExternalExtensionFileFound(good_crx, |
1651 &version, | 1651 &version, |
1652 path, | 1652 path, |
1653 Manifest::EXTERNAL_PREF, | 1653 Manifest::EXTERNAL_PREF, |
1654 Extension::NO_FLAGS, | 1654 Extension::NO_FLAGS, |
1655 false, | 1655 false, |
1656 false); | 1656 false); |
1657 base::RunLoop().RunUntilIdle(); | 1657 base::RunLoop().RunUntilIdle(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 MockExtensionProvider provider(NULL, Manifest::EXTERNAL_REGISTRY); | 1697 MockExtensionProvider provider(NULL, Manifest::EXTERNAL_REGISTRY); |
1698 service()->OnExternalProviderReady(&provider); | 1698 service()->OnExternalProviderReady(&provider); |
1699 } | 1699 } |
1700 | 1700 |
1701 // Test that external extensions with incorrect IDs are not installed. | 1701 // Test that external extensions with incorrect IDs are not installed. |
1702 TEST_F(ExtensionServiceTest, FailOnWrongId) { | 1702 TEST_F(ExtensionServiceTest, FailOnWrongId) { |
1703 InitializeEmptyExtensionService(); | 1703 InitializeEmptyExtensionService(); |
1704 base::FilePath path = data_dir().AppendASCII("good.crx"); | 1704 base::FilePath path = data_dir().AppendASCII("good.crx"); |
1705 service()->set_extensions_enabled(true); | 1705 service()->set_extensions_enabled(true); |
1706 | 1706 |
1707 base::Version version("1.0.0.0"); | 1707 Version version("1.0.0.0"); |
1708 | 1708 |
1709 const std::string wrong_id = all_zero; | 1709 const std::string wrong_id = all_zero; |
1710 const std::string correct_id = good_crx; | 1710 const std::string correct_id = good_crx; |
1711 ASSERT_NE(correct_id, wrong_id); | 1711 ASSERT_NE(correct_id, wrong_id); |
1712 | 1712 |
1713 // Install an external extension with an ID from the external | 1713 // Install an external extension with an ID from the external |
1714 // source that is not equal to the ID in the extension manifest. | 1714 // source that is not equal to the ID in the extension manifest. |
1715 content::WindowedNotificationObserver observer( | 1715 content::WindowedNotificationObserver observer( |
1716 extensions::NOTIFICATION_CRX_INSTALLER_DONE, | 1716 extensions::NOTIFICATION_CRX_INSTALLER_DONE, |
1717 content::NotificationService::AllSources()); | 1717 content::NotificationService::AllSources()); |
(...skipping 25 matching lines...) Expand all Loading... |
1743 } | 1743 } |
1744 | 1744 |
1745 // Test that external extensions with incorrect versions are not installed. | 1745 // Test that external extensions with incorrect versions are not installed. |
1746 TEST_F(ExtensionServiceTest, FailOnWrongVersion) { | 1746 TEST_F(ExtensionServiceTest, FailOnWrongVersion) { |
1747 InitializeEmptyExtensionService(); | 1747 InitializeEmptyExtensionService(); |
1748 base::FilePath path = data_dir().AppendASCII("good.crx"); | 1748 base::FilePath path = data_dir().AppendASCII("good.crx"); |
1749 service()->set_extensions_enabled(true); | 1749 service()->set_extensions_enabled(true); |
1750 | 1750 |
1751 // Install an external extension with a version from the external | 1751 // Install an external extension with a version from the external |
1752 // source that is not equal to the version in the extension manifest. | 1752 // source that is not equal to the version in the extension manifest. |
1753 base::Version wrong_version("1.2.3.4"); | 1753 Version wrong_version("1.2.3.4"); |
1754 content::WindowedNotificationObserver observer( | 1754 content::WindowedNotificationObserver observer( |
1755 extensions::NOTIFICATION_CRX_INSTALLER_DONE, | 1755 extensions::NOTIFICATION_CRX_INSTALLER_DONE, |
1756 content::NotificationService::AllSources()); | 1756 content::NotificationService::AllSources()); |
1757 service()->OnExternalExtensionFileFound(good_crx, | 1757 service()->OnExternalExtensionFileFound(good_crx, |
1758 &wrong_version, | 1758 &wrong_version, |
1759 path, | 1759 path, |
1760 Manifest::EXTERNAL_PREF, | 1760 Manifest::EXTERNAL_PREF, |
1761 Extension::NO_FLAGS, | 1761 Extension::NO_FLAGS, |
1762 false, | 1762 false, |
1763 false); | 1763 false); |
1764 | 1764 |
1765 observer.Wait(); | 1765 observer.Wait(); |
1766 ASSERT_FALSE(service()->GetExtensionById(good_crx, false)); | 1766 ASSERT_FALSE(service()->GetExtensionById(good_crx, false)); |
1767 | 1767 |
1768 // Try again with the right version. Expect success. | 1768 // Try again with the right version. Expect success. |
1769 service()->pending_extension_manager()->Remove(good_crx); | 1769 service()->pending_extension_manager()->Remove(good_crx); |
1770 base::Version correct_version("1.0.0.0"); | 1770 Version correct_version("1.0.0.0"); |
1771 content::WindowedNotificationObserver observer2( | 1771 content::WindowedNotificationObserver observer2( |
1772 extensions::NOTIFICATION_CRX_INSTALLER_DONE, | 1772 extensions::NOTIFICATION_CRX_INSTALLER_DONE, |
1773 content::NotificationService::AllSources()); | 1773 content::NotificationService::AllSources()); |
1774 if (service()->OnExternalExtensionFileFound(good_crx, | 1774 if (service()->OnExternalExtensionFileFound(good_crx, |
1775 &correct_version, | 1775 &correct_version, |
1776 path, | 1776 path, |
1777 Manifest::EXTERNAL_PREF, | 1777 Manifest::EXTERNAL_PREF, |
1778 Extension::NO_FLAGS, | 1778 Extension::NO_FLAGS, |
1779 false, | 1779 false, |
1780 false)) { | 1780 false)) { |
(...skipping 1402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3183 const Extension* good = InstallCRX(path, INSTALL_NEW); | 3183 const Extension* good = InstallCRX(path, INSTALL_NEW); |
3184 ASSERT_EQ(1u, registry()->enabled_extensions().size()); | 3184 ASSERT_EQ(1u, registry()->enabled_extensions().size()); |
3185 | 3185 |
3186 EXPECT_FALSE(good->is_theme()); | 3186 EXPECT_FALSE(good->is_theme()); |
3187 | 3187 |
3188 // Use AddExtensionImpl() as AddFrom*() would balk. | 3188 // Use AddExtensionImpl() as AddFrom*() would balk. |
3189 service()->pending_extension_manager()->AddExtensionImpl( | 3189 service()->pending_extension_manager()->AddExtensionImpl( |
3190 good->id(), | 3190 good->id(), |
3191 std::string(), | 3191 std::string(), |
3192 extensions::ManifestURL::GetUpdateURL(good), | 3192 extensions::ManifestURL::GetUpdateURL(good), |
3193 base::Version(), | 3193 Version(), |
3194 &IsExtension, | 3194 &IsExtension, |
3195 kGoodIsFromSync, | 3195 kGoodIsFromSync, |
3196 Manifest::INTERNAL, | 3196 Manifest::INTERNAL, |
3197 Extension::NO_FLAGS, | 3197 Extension::NO_FLAGS, |
3198 false, | 3198 false, |
3199 kGoodRemoteInstall); | 3199 kGoodRemoteInstall); |
3200 UpdateExtension(good->id(), path, ENABLED); | 3200 UpdateExtension(good->id(), path, ENABLED); |
3201 | 3201 |
3202 EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(kGoodId)); | 3202 EXPECT_FALSE(service()->pending_extension_manager()->IsIdPending(kGoodId)); |
3203 } | 3203 } |
(...skipping 4043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7247 std::string(), | 7247 std::string(), |
7248 GURL(kGoodUpdateURL), | 7248 GURL(kGoodUpdateURL), |
7249 Manifest::INTERNAL, | 7249 Manifest::INTERNAL, |
7250 Extension::NO_FLAGS, | 7250 Extension::NO_FLAGS, |
7251 false)); | 7251 false)); |
7252 | 7252 |
7253 EXPECT_FALSE(pending->IsIdPending(kGoodId)); | 7253 EXPECT_FALSE(pending->IsIdPending(kGoodId)); |
7254 } | 7254 } |
7255 | 7255 |
7256 TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { | 7256 TEST_F(ExtensionServiceTest, InstallPriorityExternalLocalFile) { |
7257 base::Version older_version("0.1.0.0"); | 7257 Version older_version("0.1.0.0"); |
7258 base::Version newer_version("2.0.0.0"); | 7258 Version newer_version("2.0.0.0"); |
7259 | 7259 |
7260 // We don't want the extension to be installed. A path that doesn't | 7260 // We don't want the extension to be installed. A path that doesn't |
7261 // point to a valid CRX ensures this. | 7261 // point to a valid CRX ensures this. |
7262 const base::FilePath kInvalidPathToCrx(FILE_PATH_LITERAL("invalid_path")); | 7262 const base::FilePath kInvalidPathToCrx(FILE_PATH_LITERAL("invalid_path")); |
7263 | 7263 |
7264 const int kCreationFlags = 0; | 7264 const int kCreationFlags = 0; |
7265 const bool kDontMarkAcknowledged = false; | 7265 const bool kDontMarkAcknowledged = false; |
7266 const bool kDontInstallImmediately = false; | 7266 const bool kDontInstallImmediately = false; |
7267 | 7267 |
7268 InitializeEmptyExtensionService(); | 7268 InitializeEmptyExtensionService(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7480 &newer_version, | 7480 &newer_version, |
7481 kInvalidPathToCrx, | 7481 kInvalidPathToCrx, |
7482 Manifest::EXTERNAL_PREF, | 7482 Manifest::EXTERNAL_PREF, |
7483 kCreationFlags, | 7483 kCreationFlags, |
7484 kDontMarkAcknowledged, | 7484 kDontMarkAcknowledged, |
7485 kDontInstallImmediately)); | 7485 kDontInstallImmediately)); |
7486 EXPECT_TRUE(pending->IsIdPending(kGoodId)); | 7486 EXPECT_TRUE(pending->IsIdPending(kGoodId)); |
7487 } | 7487 } |
7488 | 7488 |
7489 TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) { | 7489 TEST_F(ExtensionServiceTest, ConcurrentExternalLocalFile) { |
7490 base::Version kVersion123("1.2.3"); | 7490 Version kVersion123("1.2.3"); |
7491 base::Version kVersion124("1.2.4"); | 7491 Version kVersion124("1.2.4"); |
7492 base::Version kVersion125("1.2.5"); | 7492 Version kVersion125("1.2.5"); |
7493 const base::FilePath kInvalidPathToCrx(FILE_PATH_LITERAL("invalid_path")); | 7493 const base::FilePath kInvalidPathToCrx(FILE_PATH_LITERAL("invalid_path")); |
7494 const int kCreationFlags = 0; | 7494 const int kCreationFlags = 0; |
7495 const bool kDontMarkAcknowledged = false; | 7495 const bool kDontMarkAcknowledged = false; |
7496 const bool kDontInstallImmediately = false; | 7496 const bool kDontInstallImmediately = false; |
7497 | 7497 |
7498 InitializeEmptyExtensionService(); | 7498 InitializeEmptyExtensionService(); |
7499 | 7499 |
7500 extensions::PendingExtensionManager* pending = | 7500 extensions::PendingExtensionManager* pending = |
7501 service()->pending_extension_manager(); | 7501 service()->pending_extension_manager(); |
7502 EXPECT_FALSE(pending->IsIdPending(kGoodId)); | 7502 EXPECT_FALSE(pending->IsIdPending(kGoodId)); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7609 crx_id_, | 7609 crx_id_, |
7610 std::string(), | 7610 std::string(), |
7611 GURL(), | 7611 GURL(), |
7612 Manifest::EXTERNAL_PREF_DOWNLOAD, | 7612 Manifest::EXTERNAL_PREF_DOWNLOAD, |
7613 Extension::NO_FLAGS, | 7613 Extension::NO_FLAGS, |
7614 false); | 7614 false); |
7615 } | 7615 } |
7616 | 7616 |
7617 // Fake an external file from external_extensions.json. | 7617 // Fake an external file from external_extensions.json. |
7618 bool AddPendingExternalPrefFileInstall() { | 7618 bool AddPendingExternalPrefFileInstall() { |
7619 base::Version version("1.0.0.0"); | 7619 Version version("1.0.0.0"); |
7620 | 7620 |
7621 return service()->OnExternalExtensionFileFound(crx_id_, | 7621 return service()->OnExternalExtensionFileFound(crx_id_, |
7622 &version, | 7622 &version, |
7623 crx_path_, | 7623 crx_path_, |
7624 Manifest::EXTERNAL_PREF, | 7624 Manifest::EXTERNAL_PREF, |
7625 Extension::NO_FLAGS, | 7625 Extension::NO_FLAGS, |
7626 false, | 7626 false, |
7627 false); | 7627 false); |
7628 } | 7628 } |
7629 | 7629 |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8108 | 8108 |
8109 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, | 8109 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, |
8110 content::Source<Profile>(profile()), | 8110 content::Source<Profile>(profile()), |
8111 content::NotificationService::NoDetails()); | 8111 content::NotificationService::NoDetails()); |
8112 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); | 8112 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); |
8113 EXPECT_EQ(0u, registry()->enabled_extensions().size()); | 8113 EXPECT_EQ(0u, registry()->enabled_extensions().size()); |
8114 EXPECT_EQ(0u, registry()->disabled_extensions().size()); | 8114 EXPECT_EQ(0u, registry()->disabled_extensions().size()); |
8115 EXPECT_EQ(0u, registry()->terminated_extensions().size()); | 8115 EXPECT_EQ(0u, registry()->terminated_extensions().size()); |
8116 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); | 8116 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); |
8117 } | 8117 } |
OLD | NEW |