diff options
author | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-15 00:36:27 +0000 |
---|---|---|
committer | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-15 00:36:27 +0000 |
commit | 6bf9061f137de33b450f5ae9634b8c903bf2326d (patch) | |
tree | bf211f9108fdaafb0c065bb34d01fae62fc2e4bd /chrome/browser/extensions/extension_prefs_unittest.cc | |
parent | 5c10302fc35eff459864d872d33f0091a521c98b (diff) | |
download | chromium_src-6bf9061f137de33b450f5ae9634b8c903bf2326d.zip chromium_src-6bf9061f137de33b450f5ae9634b8c903bf2326d.tar.gz chromium_src-6bf9061f137de33b450f5ae9634b8c903bf2326d.tar.bz2 |
Rename extension_manifest_keys namespace to extensions::manifest_keys.
Move it to extensions/common/manifest_constants.cc.
Minorly improve packaged app + manifest version 1 error message.
BUG=162530
TBR=ben@chromium.org
Review URL: https://chromiumcodereview.appspot.com/22794012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217709 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 | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index eabf8ab..5d5f9c7 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -18,13 +18,13 @@ #include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/extensions/extension_manifest_constants.h" #include "chrome/common/extensions/permissions/permission_set.h" #include "chrome/common/extensions/permissions/permissions_info.h" #include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/test/mock_notification_observer.h" +#include "extensions/common/manifest_constants.h" #include "sync/api/string_ordinal.h" using base::Time; @@ -441,9 +441,8 @@ class ExtensionPrefsDelayedInstallInfo : public ExtensionPrefsTest { // Sets idle install information for one test extension. void SetIdleInfo(std::string id, int num) { DictionaryValue manifest; - manifest.SetString(extension_manifest_keys::kName, "test"); - manifest.SetString(extension_manifest_keys::kVersion, - "1." + base::IntToString(num)); + manifest.SetString(manifest_keys::kName, "test"); + manifest.SetString(manifest_keys::kVersion, "1." + base::IntToString(num)); base::FilePath path = prefs_.extensions_dir().AppendASCII(base::IntToString(num)); std::string errors; @@ -470,7 +469,7 @@ class ExtensionPrefsDelayedInstallInfo : public ExtensionPrefsTest { info->extension_path.BaseName().MaybeAsASCII()); } - bool HasInfoForId(extensions::ExtensionPrefs::ExtensionsInfo* info, + bool HasInfoForId(ExtensionPrefs::ExtensionsInfo* info, const std::string& id) { for (size_t i = 0; i < info->size(); ++i) { if (info->at(i)->extension_id == id) @@ -492,7 +491,7 @@ class ExtensionPrefsDelayedInstallInfo : public ExtensionPrefsTest { SetIdleInfo(id2_, 2); VerifyIdleInfo(id1_, 1); VerifyIdleInfo(id2_, 2); - scoped_ptr<extensions::ExtensionPrefs::ExtensionsInfo> info( + scoped_ptr<ExtensionPrefs::ExtensionsInfo> info( prefs()->GetAllDelayedInstallInfo()); EXPECT_EQ(2u, info->size()); EXPECT_TRUE(HasInfoForId(info.get(), id1_)); @@ -524,7 +523,7 @@ class ExtensionPrefsDelayedInstallInfo : public ExtensionPrefsTest { virtual void Verify() OVERRIDE { // Make sure the info for the 3 extensions we expect is present. - scoped_ptr<extensions::ExtensionPrefs::ExtensionsInfo> info( + scoped_ptr<ExtensionPrefs::ExtensionsInfo> info( prefs()->GetAllDelayedInstallInfo()); EXPECT_EQ(3u, info->size()); EXPECT_TRUE(HasInfoForId(info.get(), id1_)); @@ -553,10 +552,9 @@ class ExtensionPrefsFinishDelayedInstallInfo : public ExtensionPrefsTest { public: virtual void Initialize() OVERRIDE { DictionaryValue dictionary; - dictionary.SetString(extension_manifest_keys::kName, "test"); - dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); - dictionary.SetString(extension_manifest_keys::kBackgroundPage, - "background.html"); + dictionary.SetString(manifest_keys::kName, "test"); + dictionary.SetString(manifest_keys::kVersion, "0.1"); + dictionary.SetString(manifest_keys::kBackgroundPage, "background.html"); scoped_refptr<Extension> extension = prefs_.AddExtensionWithManifest(dictionary, Manifest::INTERNAL); id_ = extension->id(); @@ -564,12 +562,11 @@ class ExtensionPrefsFinishDelayedInstallInfo : public ExtensionPrefsTest { // Set idle info DictionaryValue manifest; - manifest.SetString(extension_manifest_keys::kName, "test"); - manifest.SetString(extension_manifest_keys::kVersion, "0.2"); + manifest.SetString(manifest_keys::kName, "test"); + manifest.SetString(manifest_keys::kVersion, "0.2"); scoped_ptr<ListValue> scripts(new ListValue); scripts->AppendString("test.js"); - manifest.Set(extension_manifest_keys::kBackgroundScripts, - scripts.release()); + manifest.Set(manifest_keys::kBackgroundScripts, scripts.release()); base::FilePath path = prefs_.extensions_dir().AppendASCII("test_0.2"); std::string errors; @@ -594,15 +591,13 @@ class ExtensionPrefsFinishDelayedInstallInfo : public ExtensionPrefsTest { ASSERT_TRUE(prefs()->ReadPrefAsDictionary(id_, "manifest", &manifest)); ASSERT_TRUE(manifest); std::string value; - EXPECT_TRUE(manifest->GetString(extension_manifest_keys::kName, &value)); + EXPECT_TRUE(manifest->GetString(manifest_keys::kName, &value)); EXPECT_EQ("test", value); - EXPECT_TRUE(manifest->GetString(extension_manifest_keys::kVersion, &value)); + EXPECT_TRUE(manifest->GetString(manifest_keys::kVersion, &value)); EXPECT_EQ("0.2", value); - EXPECT_FALSE(manifest->GetString(extension_manifest_keys::kBackgroundPage, - &value)); + EXPECT_FALSE(manifest->GetString(manifest_keys::kBackgroundPage, &value)); const ListValue* scripts; - ASSERT_TRUE(manifest->GetList(extension_manifest_keys::kBackgroundScripts, - &scripts)); + ASSERT_TRUE(manifest->GetList(manifest_keys::kBackgroundScripts, &scripts)); EXPECT_EQ(1u, scripts->GetSize()); } @@ -663,25 +658,24 @@ class ExtensionPrefsFlags : public ExtensionPrefsTest { virtual void Initialize() OVERRIDE { { base::DictionaryValue dictionary; - dictionary.SetString(extension_manifest_keys::kName, "from_webstore"); - dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); + dictionary.SetString(manifest_keys::kName, "from_webstore"); + dictionary.SetString(manifest_keys::kVersion, "0.1"); webstore_extension_ = prefs_.AddExtensionWithManifestAndFlags( dictionary, Manifest::INTERNAL, Extension::FROM_WEBSTORE); } { base::DictionaryValue dictionary; - dictionary.SetString(extension_manifest_keys::kName, "from_bookmark"); - dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); + dictionary.SetString(manifest_keys::kName, "from_bookmark"); + dictionary.SetString(manifest_keys::kVersion, "0.1"); bookmark_extension_ = prefs_.AddExtensionWithManifestAndFlags( dictionary, Manifest::INTERNAL, Extension::FROM_BOOKMARK); } { base::DictionaryValue dictionary; - dictionary.SetString(extension_manifest_keys::kName, - "was_installed_by_default"); - dictionary.SetString(extension_manifest_keys::kVersion, "0.1"); + dictionary.SetString(manifest_keys::kName, "was_installed_by_default"); + dictionary.SetString(manifest_keys::kVersion, "0.1"); default_extension_ = prefs_.AddExtensionWithManifestAndFlags( dictionary, Manifest::INTERNAL, @@ -711,8 +705,8 @@ PrefsPrepopulatedTestBase::PrefsPrepopulatedTestBase() DictionaryValue simple_dict; std::string error; - simple_dict.SetString(extension_manifest_keys::kVersion, "1.0.0.0"); - simple_dict.SetString(extension_manifest_keys::kName, "unused"); + simple_dict.SetString(manifest_keys::kVersion, "1.0.0.0"); + simple_dict.SetString(manifest_keys::kName, "unused"); extension1_ = Extension::Create( prefs_.temp_dir().AppendASCII("ext1_"), |