Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: chrome/browser/extensions/extension_service_unittest.cc

Issue 534993003: Fix bug with invalid "location" field instead of "state" field in some (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 } 887 }
888 --expected_extensions_count_; 888 --expected_extensions_count_;
889 889
890 // We should get an unload notification. 890 // We should get an unload notification.
891 EXPECT_FALSE(unloaded_id_.empty()); 891 EXPECT_FALSE(unloaded_id_.empty());
892 EXPECT_EQ(id, unloaded_id_); 892 EXPECT_EQ(id, unloaded_id_);
893 893
894 // Verify uninstalled state. 894 // Verify uninstalled state.
895 size_t new_pref_key_count = GetPrefKeyCount(); 895 size_t new_pref_key_count = GetPrefKeyCount();
896 if (new_pref_key_count == pref_key_count) { 896 if (new_pref_key_count == pref_key_count) {
897 ValidateIntegerPref(id, "location", 897 ValidateIntegerPref(id, "state",
898 Extension::EXTERNAL_EXTENSION_UNINSTALLED); 898 Extension::EXTERNAL_EXTENSION_UNINSTALLED);
899 } else { 899 } else {
900 EXPECT_EQ(new_pref_key_count, pref_key_count - 1); 900 EXPECT_EQ(new_pref_key_count, pref_key_count - 1);
901 } 901 }
902 902
903 // The extension should not be in the service anymore. 903 // The extension should not be in the service anymore.
904 EXPECT_FALSE(service()->GetInstalledExtension(id)); 904 EXPECT_FALSE(service()->GetInstalledExtension(id));
905 base::RunLoop().RunUntilIdle(); 905 base::RunLoop().RunUntilIdle();
906 906
907 // The directory should be gone. 907 // The directory should be gone.
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 Manifest::EXTERNAL_PREF, 1548 Manifest::EXTERNAL_PREF,
1549 Extension::NO_FLAGS, 1549 Extension::NO_FLAGS,
1550 false)) { 1550 false)) {
1551 observer.Wait(); 1551 observer.Wait();
1552 } 1552 }
1553 1553
1554 ASSERT_TRUE(service()->GetExtensionById(good_crx, false)); 1554 ASSERT_TRUE(service()->GetExtensionById(good_crx, false));
1555 1555
1556 // Uninstall it and check that its killbit gets set. 1556 // Uninstall it and check that its killbit gets set.
1557 UninstallExtension(good_crx, false); 1557 UninstallExtension(good_crx, false);
1558 ValidateIntegerPref(good_crx, "location", 1558 ValidateIntegerPref(good_crx, "state",
1559 Extension::EXTERNAL_EXTENSION_UNINSTALLED); 1559 Extension::EXTERNAL_EXTENSION_UNINSTALLED);
1560 1560
1561 // Try to re-install it externally. This should fail because of the killbit. 1561 // Try to re-install it externally. This should fail because of the killbit.
1562 service()->OnExternalExtensionFileFound(good_crx, 1562 service()->OnExternalExtensionFileFound(good_crx,
1563 &version, 1563 &version,
1564 path, 1564 path,
1565 Manifest::EXTERNAL_PREF, 1565 Manifest::EXTERNAL_PREF,
1566 Extension::NO_FLAGS, 1566 Extension::NO_FLAGS,
1567 false); 1567 false);
1568 base::RunLoop().RunUntilIdle(); 1568 base::RunLoop().RunUntilIdle();
1569 ASSERT_TRUE(NULL == service()->GetExtensionById(good_crx, false)); 1569 ASSERT_TRUE(NULL == service()->GetExtensionById(good_crx, false));
1570 ValidateIntegerPref(good_crx, "location", 1570 ValidateIntegerPref(good_crx, "state",
1571 Extension::EXTERNAL_EXTENSION_UNINSTALLED); 1571 Extension::EXTERNAL_EXTENSION_UNINSTALLED);
1572 1572
1573 version = Version("1.0.0.1"); 1573 version = Version("1.0.0.1");
1574 // Repeat the same thing with a newer version of the extension. 1574 // Repeat the same thing with a newer version of the extension.
1575 path = data_dir().AppendASCII("good2.crx"); 1575 path = data_dir().AppendASCII("good2.crx");
1576 service()->OnExternalExtensionFileFound(good_crx, 1576 service()->OnExternalExtensionFileFound(good_crx,
1577 &version, 1577 &version,
1578 path, 1578 path,
1579 Manifest::EXTERNAL_PREF, 1579 Manifest::EXTERNAL_PREF,
1580 Extension::NO_FLAGS, 1580 Extension::NO_FLAGS,
1581 false); 1581 false);
1582 base::RunLoop().RunUntilIdle(); 1582 base::RunLoop().RunUntilIdle();
1583 ASSERT_TRUE(NULL == service()->GetExtensionById(good_crx, false)); 1583 ASSERT_TRUE(NULL == service()->GetExtensionById(good_crx, false));
1584 ValidateIntegerPref(good_crx, "location", 1584 ValidateIntegerPref(good_crx, "state",
1585 Extension::EXTERNAL_EXTENSION_UNINSTALLED); 1585 Extension::EXTERNAL_EXTENSION_UNINSTALLED);
1586 1586
1587 // Try adding the same extension from an external update URL. 1587 // Try adding the same extension from an external update URL.
1588 ASSERT_FALSE(service()->pending_extension_manager()->AddFromExternalUpdateUrl( 1588 ASSERT_FALSE(service()->pending_extension_manager()->AddFromExternalUpdateUrl(
1589 good_crx, 1589 good_crx,
1590 std::string(), 1590 std::string(),
1591 GURL("http:://fake.update/url"), 1591 GURL("http:://fake.update/url"),
1592 Manifest::EXTERNAL_PREF_DOWNLOAD, 1592 Manifest::EXTERNAL_PREF_DOWNLOAD,
1593 Extension::NO_FLAGS, 1593 Extension::NO_FLAGS,
1594 false)); 1594 false));
(...skipping 5558 matching lines...) Expand 10 before | Expand all | Expand 10 after
7153 7153
7154 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 7154 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
7155 content::Source<Profile>(profile()), 7155 content::Source<Profile>(profile()),
7156 content::NotificationService::NoDetails()); 7156 content::NotificationService::NoDetails());
7157 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); 7157 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_);
7158 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 7158 EXPECT_EQ(0u, registry()->enabled_extensions().size());
7159 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 7159 EXPECT_EQ(0u, registry()->disabled_extensions().size());
7160 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 7160 EXPECT_EQ(0u, registry()->terminated_extensions().size());
7161 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 7161 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
7162 } 7162 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698