diff options
author | rdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-29 22:52:48 +0000 |
---|---|---|
committer | rdevlin.cronin@chromium.org <rdevlin.cronin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-29 22:52:48 +0000 |
commit | 3ab94f3342e28faa932d1e48012ba866f2ddcf6c (patch) | |
tree | eb254bcdc5ab9f1dff195623aef82356d7c7421b /chrome/browser/extensions/extension_prefs_unittest.cc | |
parent | 5357867fc5e028ef9a7bb50d63b1c350e01b4648 (diff) | |
download | chromium_src-3ab94f3342e28faa932d1e48012ba866f2ddcf6c.zip chromium_src-3ab94f3342e28faa932d1e48012ba866f2ddcf6c.tar.gz chromium_src-3ab94f3342e28faa932d1e48012ba866f2ddcf6c.tar.bz2 |
Move MediaGalleries- and Omnibox-related methods and knowledge to MediaGalleriesPrivateAPI and OmniboxAPI, respectively.
Expose methods from ExtensionScopedPrefs to be public in ExtensionPrefs; add non-const versions for value updating (and rename from ReadExtensionPref[Type] to ReadPrefAs[Type], since the Extension is implied).
Share code in ExtensionPrefs between GetInstalledExtensionInfo() and GetDelayedInstallInfo().
BUG=180083
TBR=ben@chromium.org, thestig@chromium.org
(ben - gypis, thestig - c/b/media_galleries/)
Review URL: https://chromiumcodereview.appspot.com/14106002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197176 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_prefs_unittest.cc')
-rw-r--r-- | chrome/browser/extensions/extension_prefs_unittest.cc | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index 173f8f4..5c11240 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -111,102 +111,6 @@ class ExtensionPrefsLastPingDay : public ExtensionPrefsTest { }; TEST_F(ExtensionPrefsLastPingDay, LastPingDay) {} -namespace { - -void AddGalleryPermission(chrome::MediaGalleryPrefId gallery, bool has_access, - std::vector<chrome::MediaGalleryPermission>* vector) { - chrome::MediaGalleryPermission permission; - permission.pref_id = gallery; - permission.has_permission = has_access; - vector->push_back(permission); -} - -} // namspace - -// Test the MediaGalleries permissions functions. -class MediaGalleriesPermissions : public ExtensionPrefsTest { - public: - virtual void Initialize() OVERRIDE { - extension1_id_ = prefs_.AddExtensionAndReturnId("test1"); - extension2_id_ = prefs_.AddExtensionAndReturnId("test2"); - extension3_id_ = prefs_.AddExtensionAndReturnId("test3"); - // Id4 isn't used to ensure that an empty permission list is ok. - extension4_id_ = prefs_.AddExtensionAndReturnId("test4"); - Verify(); - - prefs()->SetMediaGalleryPermission(extension1_id_, 1, false); - AddGalleryPermission(1, false, &extension1_expectation_); - Verify(); - - prefs()->SetMediaGalleryPermission(extension1_id_, 2, true); - AddGalleryPermission(2, true, &extension1_expectation_); - Verify(); - - prefs()->SetMediaGalleryPermission(extension1_id_, 2, false); - extension1_expectation_[1].has_permission = false; - Verify(); - - prefs()->SetMediaGalleryPermission(extension2_id_, 1, true); - prefs()->SetMediaGalleryPermission(extension2_id_, 3, true); - prefs()->SetMediaGalleryPermission(extension2_id_, 4, true); - AddGalleryPermission(1, true, &extension2_expectation_); - AddGalleryPermission(3, true, &extension2_expectation_); - AddGalleryPermission(4, true, &extension2_expectation_); - Verify(); - - prefs()->SetMediaGalleryPermission(extension3_id_, 3, true); - AddGalleryPermission(3, true, &extension3_expectation_); - Verify(); - - prefs()->RemoveMediaGalleryPermissions(3); - extension2_expectation_.erase(extension2_expectation_.begin() + 1); - extension3_expectation_.erase(extension3_expectation_.begin()); - Verify(); - - prefs()->UnsetMediaGalleryPermission(extension1_id_, 1); - extension1_expectation_.erase(extension1_expectation_.begin()); - Verify(); - } - - virtual void Verify() OVERRIDE { - struct TestData { - std::string* id; - std::vector<chrome::MediaGalleryPermission>* expectation; - }; - - const TestData test_data[] = {{&extension1_id_, &extension1_expectation_}, - {&extension2_id_, &extension2_expectation_}, - {&extension3_id_, &extension3_expectation_}, - {&extension4_id_, &extension4_expectation_}}; - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); i++) { - std::vector<chrome::MediaGalleryPermission> actual = - prefs()->GetMediaGalleryPermissions(*test_data[i].id); - EXPECT_EQ(test_data[i].expectation->size(), actual.size()); - for (size_t permission_entry = 0; - permission_entry < test_data[i].expectation->size() && - permission_entry < actual.size(); - permission_entry++) { - EXPECT_EQ(test_data[i].expectation->at(permission_entry).pref_id, - actual[permission_entry].pref_id); - EXPECT_EQ(test_data[i].expectation->at(permission_entry).has_permission, - actual[permission_entry].has_permission); - } - } - } - - private: - std::string extension1_id_; - std::string extension2_id_; - std::string extension3_id_; - std::string extension4_id_; - - std::vector<chrome::MediaGalleryPermission> extension1_expectation_; - std::vector<chrome::MediaGalleryPermission> extension2_expectation_; - std::vector<chrome::MediaGalleryPermission> extension3_expectation_; - std::vector<chrome::MediaGalleryPermission> extension4_expectation_; -}; -TEST_F(MediaGalleriesPermissions, MediaGalleries) {} - // Tests the GetToolbarOrder/SetToolbarOrder functions. class ExtensionPrefsToolbarOrder : public ExtensionPrefsTest { public: |