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

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

Issue 1164603003: Remove ExtensionPrefs::SetDidExtensionEscalatePermissions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sync_permission_approval
Patch Set: review Created 5 years, 6 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 | « chrome/browser/extensions/extension_service.cc ('k') | extensions/browser/extension_prefs.h » ('j') | 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 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after
2753 base::FilePath path = data_dir().AppendASCII("good.crx"); 2753 base::FilePath path = data_dir().AppendASCII("good.crx");
2754 2754
2755 const Extension* good = InstallCRX(path, INSTALL_NEW); 2755 const Extension* good = InstallCRX(path, INSTALL_NEW);
2756 ASSERT_EQ("1.0.0.0", good->VersionString()); 2756 ASSERT_EQ("1.0.0.0", good->VersionString());
2757 ASSERT_EQ(good_crx, good->id()); 2757 ASSERT_EQ(good_crx, good->id());
2758 2758
2759 // Disable it and allow it to run in incognito. These settings should carry 2759 // Disable it and allow it to run in incognito. These settings should carry
2760 // over to the updated version. 2760 // over to the updated version.
2761 service()->DisableExtension(good->id(), Extension::DISABLE_USER_ACTION); 2761 service()->DisableExtension(good->id(), Extension::DISABLE_USER_ACTION);
2762 extensions::util::SetIsIncognitoEnabled(good->id(), profile(), true); 2762 extensions::util::SetIsIncognitoEnabled(good->id(), profile(), true);
2763 ExtensionPrefs::Get(profile())
2764 ->SetDidExtensionEscalatePermissions(good, true);
2765 2763
2766 path = data_dir().AppendASCII("good2.crx"); 2764 path = data_dir().AppendASCII("good2.crx");
2767 UpdateExtension(good_crx, path, INSTALLED); 2765 UpdateExtension(good_crx, path, INSTALLED);
2768 ASSERT_EQ(1u, registry()->disabled_extensions().size()); 2766 ASSERT_EQ(1u, registry()->disabled_extensions().size());
2769 const Extension* good2 = service()->GetExtensionById(good_crx, true); 2767 const Extension* good2 = service()->GetExtensionById(good_crx, true);
2770 ASSERT_EQ("1.0.0.1", good2->version()->GetString()); 2768 ASSERT_EQ("1.0.0.1", good2->version()->GetString());
2771 EXPECT_TRUE(extensions::util::IsIncognitoEnabled(good2->id(), profile())); 2769 EXPECT_TRUE(extensions::util::IsIncognitoEnabled(good2->id(), profile()));
2772 EXPECT_TRUE(ExtensionPrefs::Get(profile()) 2770 EXPECT_EQ(Extension::DISABLE_USER_ACTION,
2773 ->DidExtensionEscalatePermissions(good2->id())); 2771 ExtensionPrefs::Get(profile())->GetDisableReasons(good2->id()));
2774 } 2772 }
2775 2773
2776 // Tests that updating preserves extension location. 2774 // Tests that updating preserves extension location.
2777 TEST_F(ExtensionServiceTest, UpdateExtensionPreservesLocation) { 2775 TEST_F(ExtensionServiceTest, UpdateExtensionPreservesLocation) {
2778 InitializeEmptyExtensionService(); 2776 InitializeEmptyExtensionService();
2779 2777
2780 base::FilePath path = data_dir().AppendASCII("good.crx"); 2778 base::FilePath path = data_dir().AppendASCII("good.crx");
2781 2779
2782 const Extension* good = 2780 const Extension* good =
2783 InstallCRXWithLocation(path, Manifest::EXTERNAL_PREF, INSTALL_NEW); 2781 InstallCRXWithLocation(path, Manifest::EXTERNAL_PREF, INSTALL_NEW);
(...skipping 5282 matching lines...) Expand 10 before | Expand all | Expand 10 after
8066 8064
8067 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED, 8065 service()->Observe(chrome::NOTIFICATION_PROFILE_DESTRUCTION_STARTED,
8068 content::Source<Profile>(profile()), 8066 content::Source<Profile>(profile()),
8069 content::NotificationService::NoDetails()); 8067 content::NotificationService::NoDetails());
8070 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_); 8068 EXPECT_EQ(UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN, unloaded_reason_);
8071 EXPECT_EQ(0u, registry()->enabled_extensions().size()); 8069 EXPECT_EQ(0u, registry()->enabled_extensions().size());
8072 EXPECT_EQ(0u, registry()->disabled_extensions().size()); 8070 EXPECT_EQ(0u, registry()->disabled_extensions().size());
8073 EXPECT_EQ(0u, registry()->terminated_extensions().size()); 8071 EXPECT_EQ(0u, registry()->terminated_extensions().size());
8074 EXPECT_EQ(0u, registry()->blacklisted_extensions().size()); 8072 EXPECT_EQ(0u, registry()->blacklisted_extensions().size());
8075 } 8073 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | extensions/browser/extension_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698