| Index: chrome/browser/extensions/extension_function_test_utils.cc
|
| diff --git a/chrome/browser/extensions/extension_function_test_utils.cc b/chrome/browser/extensions/extension_function_test_utils.cc
|
| index 7cdb98dc37ade0fdd7d97b090ae2519c2478cc80..e872a1c7cfba0bc66032f388c5fdf8e552025c45 100644
|
| --- a/chrome/browser/extensions/extension_function_test_utils.cc
|
| +++ b/chrome/browser/extensions/extension_function_test_utils.cc
|
| @@ -60,32 +60,20 @@ base::ListValue* ParseList(const std::string& data) {
|
|
|
| base::DictionaryValue* ParseDictionary(
|
| const std::string& data) {
|
| - base::Value* result = ParseJSON(data);
|
| - base::DictionaryValue* dict = NULL;
|
| - result->GetAsDictionary(&dict);
|
| - return dict;
|
| + return extensions::api_test_utils::ParseDictionary(data);
|
| }
|
|
|
| bool GetBoolean(const base::DictionaryValue* val, const std::string& key) {
|
| - bool result = false;
|
| - if (!val->GetBoolean(key, &result))
|
| - ADD_FAILURE() << key << " does not exist or is not a boolean.";
|
| - return result;
|
| + return extensions::api_test_utils::GetBoolean(val, key);
|
| }
|
|
|
| int GetInteger(const base::DictionaryValue* val, const std::string& key) {
|
| - int result = 0;
|
| - if (!val->GetInteger(key, &result))
|
| - ADD_FAILURE() << key << " does not exist or is not an integer.";
|
| - return result;
|
| + return extensions::api_test_utils::GetInteger(val, key);
|
| }
|
|
|
| std::string GetString(const base::DictionaryValue* val,
|
| const std::string& key) {
|
| - std::string result;
|
| - if (!val->GetString(key, &result))
|
| - ADD_FAILURE() << key << " does not exist or is not a string.";
|
| - return result;
|
| + return extensions::api_test_utils::GetString(val, key);
|
| }
|
|
|
| base::DictionaryValue* ToDictionary(base::Value* val) {
|
| @@ -104,33 +92,22 @@ scoped_refptr<Extension> CreateEmptyExtensionWithLocation(
|
| Manifest::Location location) {
|
| scoped_ptr<base::DictionaryValue> test_extension_value(
|
| ParseDictionary("{\"name\": \"Test\", \"version\": \"1.0\"}"));
|
| - return CreateExtension(location, test_extension_value.get(), std::string());
|
| + return extensions::api_test_utils::CreateExtension(
|
| + location, test_extension_value.get(), std::string());
|
| }
|
|
|
| scoped_refptr<Extension> CreateExtension(
|
| base::DictionaryValue* test_extension_value) {
|
| - return CreateExtension(Manifest::INTERNAL, test_extension_value,
|
| - std::string());
|
| + return extensions::api_test_utils::CreateExtension(
|
| + Manifest::INTERNAL, test_extension_value, std::string());
|
| }
|
|
|
| scoped_refptr<Extension> CreateExtension(
|
| Manifest::Location location,
|
| base::DictionaryValue* test_extension_value,
|
| const std::string& id_input) {
|
| - std::string error;
|
| - const base::FilePath test_extension_path;
|
| - std::string id;
|
| - if (!id_input.empty())
|
| - id = crx_file::id_util::GenerateId(id_input);
|
| - scoped_refptr<Extension> extension(Extension::Create(
|
| - test_extension_path,
|
| - location,
|
| - *test_extension_value,
|
| - Extension::NO_FLAGS,
|
| - id,
|
| - &error));
|
| - EXPECT_TRUE(error.empty()) << "Could not parse test extension " << error;
|
| - return extension;
|
| + return extensions::api_test_utils::CreateExtension(
|
| + location, test_extension_value, id_input);
|
| }
|
|
|
| bool HasPrivacySensitiveFields(base::DictionaryValue* val) {
|
|
|