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

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

Issue 98463005: Enable/disable extensions upon changes in blacklist. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_prefs_unittest.h" 5 #include "chrome/browser/extensions/./extension_prefs_unittest.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/prefs/mock_pref_change_callback.h" 10 #include "base/prefs/mock_pref_change_callback.h"
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 } 845 }
846 846
847 private: 847 private:
848 scoped_refptr<const Extension> extension_a_; 848 scoped_refptr<const Extension> extension_a_;
849 scoped_refptr<const Extension> extension_b_; 849 scoped_refptr<const Extension> extension_b_;
850 scoped_refptr<const Extension> extension_c_; 850 scoped_refptr<const Extension> extension_c_;
851 }; 851 };
852 TEST_F(ExtensionPrefsBlacklistedExtensions, 852 TEST_F(ExtensionPrefsBlacklistedExtensions,
853 ExtensionPrefsBlacklistedExtensions) {} 853 ExtensionPrefsBlacklistedExtensions) {}
854 854
855 // Tests the blacklist state. Old "blacklist" preference should take precedence
856 // over new "blacklist_state".
857 class ExtensionPrefsBlacklistState : public ExtensionPrefsTest {
858 public:
859 virtual ~ExtensionPrefsBlacklistState() {}
860
861 virtual void Initialize() OVERRIDE {
862 extension_a_ = prefs_.AddExtension("a");
863 }
864
865 virtual void Verify() OVERRIDE {
866 ExtensionIdSet empty_ids;
867 EXPECT_EQ(empty_ids, prefs()->GetBlacklistedExtensions());
868
869 prefs()->SetExtensionBlacklisted(extension_a_->id(), true);
870 EXPECT_EQ(BLACKLISTED_MALWARE,
871 prefs()->GetExtensionBlacklistState(extension_a_->id()));
872
873 prefs()->SetExtensionBlacklistState(extension_a_->id(),
874 BLACKLISTED_POTENTIALLY_UNWANTED);
875 EXPECT_EQ(BLACKLISTED_POTENTIALLY_UNWANTED,
876 prefs()->GetExtensionBlacklistState(extension_a_->id()));
877 EXPECT_FALSE(prefs()->IsExtensionBlacklisted(extension_a_->id()));
878 EXPECT_EQ(empty_ids, prefs()->GetBlacklistedExtensions());
879
880 prefs()->SetExtensionBlacklisted(extension_a_->id(), true);
881 EXPECT_TRUE(prefs()->IsExtensionBlacklisted(extension_a_->id()));
882 EXPECT_EQ(BLACKLISTED_MALWARE,
883 prefs()->GetExtensionBlacklistState(extension_a_->id()));
884 EXPECT_EQ(1u, prefs()->GetBlacklistedExtensions().size());
885
886 prefs()->SetExtensionBlacklistState(extension_a_->id(),
887 NOT_BLACKLISTED);
888 EXPECT_EQ(NOT_BLACKLISTED,
889 prefs()->GetExtensionBlacklistState(extension_a_->id()));
890 EXPECT_FALSE(prefs()->IsExtensionBlacklisted(extension_a_->id()));
891 EXPECT_EQ(empty_ids, prefs()->GetBlacklistedExtensions());
892 }
893
894 private:
895 scoped_refptr<const Extension> extension_a_;
896 };
897 TEST_F(ExtensionPrefsBlacklistState, ExtensionPrefsBlacklistState) {}
898
855 } // namespace extensions 899 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/blacklist_state_fetcher.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698