OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extensions_service_unittest.h" | 5 #include "chrome/browser/extensions/extensions_service_unittest.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 ASSERT_EQ(1u, loaded_.size()); | 1600 ASSERT_EQ(1u, loaded_.size()); |
1601 ValidatePrefKeyCount(1); | 1601 ValidatePrefKeyCount(1); |
1602 ValidateIntegerPref(good_crx, L"state", Extension::ENABLED); | 1602 ValidateIntegerPref(good_crx, L"state", Extension::ENABLED); |
1603 ValidateIntegerPref(good_crx, L"location", location); | 1603 ValidateIntegerPref(good_crx, L"location", location); |
1604 | 1604 |
1605 // Now test an externally triggered uninstall (deleting the registry key or | 1605 // Now test an externally triggered uninstall (deleting the registry key or |
1606 // the pref entry). | 1606 // the pref entry). |
1607 provider->RemoveExtension(good_crx); | 1607 provider->RemoveExtension(good_crx); |
1608 | 1608 |
1609 loaded_.clear(); | 1609 loaded_.clear(); |
| 1610 service_->UnloadAllExtensions(); |
1610 service_->LoadAllExtensions(); | 1611 service_->LoadAllExtensions(); |
1611 loop_.RunAllPending(); | 1612 loop_.RunAllPending(); |
1612 ASSERT_EQ(0u, loaded_.size()); | 1613 ASSERT_EQ(0u, loaded_.size()); |
1613 ValidatePrefKeyCount(0); | 1614 ValidatePrefKeyCount(0); |
1614 | 1615 |
1615 // The extension should also be gone from the install directory. | 1616 // The extension should also be gone from the install directory. |
1616 ASSERT_FALSE(file_util::PathExists(install_path)); | 1617 ASSERT_FALSE(file_util::PathExists(install_path)); |
1617 | 1618 |
1618 // Now test the case where user uninstalls and then the extension is removed | 1619 // Now test the case where user uninstalls and then the extension is removed |
1619 // from the external provider. | 1620 // from the external provider. |
1620 | 1621 |
1621 provider->UpdateOrAddExtension(good_crx, "1.0", source_path); | 1622 provider->UpdateOrAddExtension(good_crx, "1.0", source_path); |
1622 service_->CheckForExternalUpdates(); | 1623 service_->CheckForExternalUpdates(); |
1623 loop_.RunAllPending(); | 1624 loop_.RunAllPending(); |
1624 | 1625 |
1625 ASSERT_EQ(1u, loaded_.size()); | 1626 ASSERT_EQ(1u, loaded_.size()); |
1626 ASSERT_EQ(1u, GetErrors().size()); | 1627 ASSERT_EQ(0u, GetErrors().size()); |
1627 | 1628 |
1628 // User uninstalls. | 1629 // User uninstalls. |
1629 loaded_.clear(); | 1630 loaded_.clear(); |
1630 service_->UninstallExtension(id, false); | 1631 service_->UninstallExtension(id, false); |
1631 loop_.RunAllPending(); | 1632 loop_.RunAllPending(); |
1632 ASSERT_EQ(0u, loaded_.size()); | 1633 ASSERT_EQ(0u, loaded_.size()); |
1633 | 1634 |
1634 // Then remove the extension from the extension provider. | 1635 // Then remove the extension from the extension provider. |
1635 provider->RemoveExtension(good_crx); | 1636 provider->RemoveExtension(good_crx); |
1636 | 1637 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1905 // Component extensions shouldn't get recourded in the prefs. | 1906 // Component extensions shouldn't get recourded in the prefs. |
1906 ValidatePrefKeyCount(0); | 1907 ValidatePrefKeyCount(0); |
1907 | 1908 |
1908 // Reload all extensions, and make sure it comes back. | 1909 // Reload all extensions, and make sure it comes back. |
1909 std::string extension_id = service_->extensions()->at(0)->id(); | 1910 std::string extension_id = service_->extensions()->at(0)->id(); |
1910 loaded_.clear(); | 1911 loaded_.clear(); |
1911 service_->ReloadExtensions(); | 1912 service_->ReloadExtensions(); |
1912 ASSERT_EQ(1u, service_->extensions()->size()); | 1913 ASSERT_EQ(1u, service_->extensions()->size()); |
1913 EXPECT_EQ(extension_id, service_->extensions()->at(0)->id()); | 1914 EXPECT_EQ(extension_id, service_->extensions()->at(0)->id()); |
1914 } | 1915 } |
OLD | NEW |