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 "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 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 // TODO(erikkay): add tests for upgrade cases. | 1693 // TODO(erikkay): add tests for upgrade cases. |
1694 } | 1694 } |
1695 | 1695 |
1696 struct MockInstallObserver : public extensions::InstallObserver { | 1696 struct MockInstallObserver : public extensions::InstallObserver { |
1697 MockInstallObserver() { | 1697 MockInstallObserver() { |
1698 } | 1698 } |
1699 | 1699 |
1700 virtual ~MockInstallObserver() { | 1700 virtual ~MockInstallObserver() { |
1701 } | 1701 } |
1702 | 1702 |
1703 virtual void OnBeginExtensionInstall( | |
1704 const ExtensionInstallParams& params) OVERRIDE { | |
1705 } | |
1706 | |
1707 virtual void OnDownloadProgress(const std::string& extension_id, | |
1708 int percent_downloaded) OVERRIDE { | |
1709 } | |
1710 | |
1711 virtual void OnExtensionInstalled(const Extension* extension) OVERRIDE { | 1703 virtual void OnExtensionInstalled(const Extension* extension) OVERRIDE { |
1712 last_extension_installed = extension->id(); | 1704 last_extension_installed = extension->id(); |
1713 } | 1705 } |
1714 | 1706 |
1715 virtual void OnInstallFailure(const std::string& extension_id) OVERRIDE { | |
1716 } | |
1717 | |
1718 virtual void OnExtensionLoaded(const Extension* extension) OVERRIDE { | |
1719 } | |
1720 | |
1721 virtual void OnExtensionUnloaded(const Extension* extension) OVERRIDE { | |
1722 } | |
1723 | |
1724 virtual void OnExtensionUninstalled(const Extension* extension) OVERRIDE { | 1707 virtual void OnExtensionUninstalled(const Extension* extension) OVERRIDE { |
1725 last_extension_uninstalled = extension->id(); | 1708 last_extension_uninstalled = extension->id(); |
1726 } | 1709 } |
1727 | 1710 |
1728 virtual void OnAppsReordered() OVERRIDE { | |
1729 } | |
1730 | |
1731 virtual void OnAppInstalledToAppList( | |
1732 const std::string& extension_id) OVERRIDE { | |
1733 } | |
1734 | |
1735 virtual void OnShutdown() OVERRIDE { | |
1736 } | |
1737 | |
1738 std::string last_extension_installed; | 1711 std::string last_extension_installed; |
1739 std::string last_extension_uninstalled; | 1712 std::string last_extension_uninstalled; |
1740 }; | 1713 }; |
1741 | 1714 |
1742 // Test that correct notifications are sent to InstallTracker observers on | 1715 // Test that correct notifications are sent to InstallTracker observers on |
1743 // extension install and uninstall. | 1716 // extension install and uninstall. |
1744 TEST_F(ExtensionServiceTest, InstallObserverNotified) { | 1717 TEST_F(ExtensionServiceTest, InstallObserverNotified) { |
1745 InitializeEmptyExtensionService(); | 1718 InitializeEmptyExtensionService(); |
1746 | 1719 |
1747 extensions::InstallTracker* tracker( | 1720 extensions::InstallTracker* tracker( |
(...skipping 5227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6975 // ReconcileKnownDisabled(). | 6948 // ReconcileKnownDisabled(). |
6976 service_->EnableExtension(good2); | 6949 service_->EnableExtension(good2); |
6977 service_->ReconcileKnownDisabled(); | 6950 service_->ReconcileKnownDisabled(); |
6978 expected_extensions.insert(good2); | 6951 expected_extensions.insert(good2); |
6979 expected_disabled_extensions.erase(good2); | 6952 expected_disabled_extensions.erase(good2); |
6980 | 6953 |
6981 EXPECT_EQ(expected_extensions, registry_->enabled_extensions().GetIDs()); | 6954 EXPECT_EQ(expected_extensions, registry_->enabled_extensions().GetIDs()); |
6982 EXPECT_EQ(expected_disabled_extensions, | 6955 EXPECT_EQ(expected_disabled_extensions, |
6983 registry_->disabled_extensions().GetIDs()); | 6956 registry_->disabled_extensions().GetIDs()); |
6984 } | 6957 } |
OLD | NEW |