OLD | NEW |
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 "extension_prefs_unittest.h" | 5 #include "extension_prefs_unittest.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 dictionary, Extension::INTERNAL, Extension::FROM_WEBSTORE); | 789 dictionary, Extension::INTERNAL, Extension::FROM_WEBSTORE); |
790 } | 790 } |
791 | 791 |
792 { | 792 { |
793 base::DictionaryValue dictionary; | 793 base::DictionaryValue dictionary; |
794 dictionary.SetString(extension_manifest_keys::kName, "from_bookmark"); | 794 dictionary.SetString(extension_manifest_keys::kName, "from_bookmark"); |
795 dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); | 795 dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); |
796 bookmark_extension_ = prefs_.AddExtensionWithManifestAndFlags( | 796 bookmark_extension_ = prefs_.AddExtensionWithManifestAndFlags( |
797 dictionary, Extension::INTERNAL, Extension::FROM_BOOKMARK); | 797 dictionary, Extension::INTERNAL, Extension::FROM_BOOKMARK); |
798 } | 798 } |
| 799 |
| 800 { |
| 801 base::DictionaryValue dictionary; |
| 802 dictionary.SetString(extension_manifest_keys::kName, "from_default"); |
| 803 dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); |
| 804 default_extension_ = prefs_.AddExtensionWithManifestAndFlags( |
| 805 dictionary, Extension::INTERNAL, Extension::FROM_DEFAULT); |
| 806 } |
799 } | 807 } |
800 | 808 |
801 virtual void Verify() { | 809 virtual void Verify() { |
802 EXPECT_TRUE(prefs()->IsFromWebStore(webstore_extension_->id())); | 810 EXPECT_TRUE(prefs()->IsFromWebStore(webstore_extension_->id())); |
803 EXPECT_FALSE(prefs()->IsFromBookmark(webstore_extension_->id())); | 811 EXPECT_FALSE(prefs()->IsFromBookmark(webstore_extension_->id())); |
804 | 812 |
805 EXPECT_TRUE(prefs()->IsFromBookmark(bookmark_extension_->id())); | 813 EXPECT_TRUE(prefs()->IsFromBookmark(bookmark_extension_->id())); |
806 EXPECT_FALSE(prefs()->IsFromWebStore(bookmark_extension_->id())); | 814 EXPECT_FALSE(prefs()->IsFromWebStore(bookmark_extension_->id())); |
| 815 |
| 816 EXPECT_TRUE(prefs()->IsFromDefault(default_extension_->id())); |
807 } | 817 } |
808 | 818 |
809 private: | 819 private: |
810 scoped_refptr<Extension> webstore_extension_; | 820 scoped_refptr<Extension> webstore_extension_; |
811 scoped_refptr<Extension> bookmark_extension_; | 821 scoped_refptr<Extension> bookmark_extension_; |
| 822 scoped_refptr<Extension> default_extension_; |
812 }; | 823 }; |
813 TEST_F(ExtensionPrefsFlags, ExtensionPrefsFlags) {} | 824 TEST_F(ExtensionPrefsFlags, ExtensionPrefsFlags) {} |
814 | 825 |
815 namespace keys = extension_manifest_keys; | 826 namespace keys = extension_manifest_keys; |
816 | 827 |
817 ExtensionPrefsPrepopulatedTest::ExtensionPrefsPrepopulatedTest() | 828 ExtensionPrefsPrepopulatedTest::ExtensionPrefsPrepopulatedTest() |
818 : ExtensionPrefsTest(), | 829 : ExtensionPrefsTest(), |
819 ext1_(NULL), | 830 ext1_(NULL), |
820 ext2_(NULL), | 831 ext2_(NULL), |
821 ext3_(NULL), | 832 ext3_(NULL), |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 EXPECT_EQ(string16(), error16); | 1279 EXPECT_EQ(string16(), error16); |
1269 EXPECT_TRUE(prefs()->UserMayModifySettings(extension_.get(), &error16)); | 1280 EXPECT_TRUE(prefs()->UserMayModifySettings(extension_.get(), &error16)); |
1270 EXPECT_EQ(string16(), error16); | 1281 EXPECT_EQ(string16(), error16); |
1271 EXPECT_FALSE(prefs()->MustRemainEnabled(extension_.get(), &error16)); | 1282 EXPECT_FALSE(prefs()->MustRemainEnabled(extension_.get(), &error16)); |
1272 EXPECT_EQ(string16(), error16); | 1283 EXPECT_EQ(string16(), error16); |
1273 } | 1284 } |
1274 }; | 1285 }; |
1275 TEST_F(ExtensionPrefsNotRequiredExtension, NotRequiredExtension) {} | 1286 TEST_F(ExtensionPrefsNotRequiredExtension, NotRequiredExtension) {} |
1276 | 1287 |
1277 } // namespace extensions | 1288 } // namespace extensions |
OLD | NEW |