summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-14 07:32:45 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-14 07:32:45 +0000
commitc9c89a156b8769fab8b25f64343ae2bc89706750 (patch)
treef248914e905950fb60118e38065004cdeb144fd2
parent2f95bf6f3832adcc2c9cf330ad837f30e76884c4 (diff)
downloadchromium_src-c9c89a156b8769fab8b25f64343ae2bc89706750.zip
chromium_src-c9c89a156b8769fab8b25f64343ae2bc89706750.tar.gz
chromium_src-c9c89a156b8769fab8b25f64343ae2bc89706750.tar.bz2
Cleanup: Remove deprecated base::Value methods from chrome/common. Use base::Value too.
Review URL: https://chromiumcodereview.appspot.com/12207167 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182406 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/common/custom_handlers/protocol_handler.cc14
-rw-r--r--chrome/common/extensions/api/extension_api_unittest.cc32
-rw-r--r--chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc14
-rw-r--r--chrome/common/extensions/extension_file_util_unittest.cc25
-rw-r--r--chrome/common/extensions/extension_set_unittest.cc8
-rw-r--r--chrome/common/extensions/features/base_feature_provider_unittest.cc26
-rw-r--r--chrome/common/extensions/features/simple_feature_unittest.cc64
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc10
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc8
-rw-r--r--chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc10
-rw-r--r--chrome/common/extensions/manifest_unittest.cc35
-rw-r--r--chrome/common/extensions/permissions/api_permission_set_unittest.cc74
-rw-r--r--chrome/common/extensions/permissions/socket_permission_data.cc2
-rw-r--r--chrome/common/extensions/value_builder.cc20
-rw-r--r--chrome/common/json_schema_validator_unittest_base.cc258
15 files changed, 308 insertions, 292 deletions
diff --git a/chrome/common/custom_handlers/protocol_handler.cc b/chrome/common/custom_handlers/protocol_handler.cc
index e1bc8cc..1298404 100644
--- a/chrome/common/custom_handlers/protocol_handler.cc
+++ b/chrome/common/custom_handlers/protocol_handler.cc
@@ -28,7 +28,7 @@ ProtocolHandler ProtocolHandler::CreateProtocolHandler(
ProtocolHandler::ProtocolHandler() {
}
-bool ProtocolHandler::IsValidDict(const DictionaryValue* value) {
+bool ProtocolHandler::IsValidDict(const base::DictionaryValue* value) {
return value->HasKey("protocol") && value->HasKey("url") &&
value->HasKey("title");
}
@@ -44,7 +44,7 @@ const ProtocolHandler& ProtocolHandler::EmptyProtocolHandler() {
}
ProtocolHandler ProtocolHandler::CreateProtocolHandler(
- const DictionaryValue* value) {
+ const base::DictionaryValue* value) {
if (!IsValidDict(value)) {
return EmptyProtocolHandler();
}
@@ -63,11 +63,11 @@ GURL ProtocolHandler::TranslateUrl(const GURL& url) const {
return GURL(translatedUrlSpec);
}
-DictionaryValue* ProtocolHandler::Encode() const {
- DictionaryValue* d = new DictionaryValue();
- d->Set("protocol", Value::CreateStringValue(protocol_));
- d->Set("url", Value::CreateStringValue(url_.spec()));
- d->Set("title", Value::CreateStringValue(title_));
+base::DictionaryValue* ProtocolHandler::Encode() const {
+ base::DictionaryValue* d = new base::DictionaryValue();
+ d->Set("protocol", new base::StringValue(protocol_));
+ d->Set("url", new base::StringValue(url_.spec()));
+ d->Set("title", new base::StringValue(title_));
return d;
}
diff --git a/chrome/common/extensions/api/extension_api_unittest.cc b/chrome/common/extensions/api/extension_api_unittest.cc
index 35b1b64..ee169dc 100644
--- a/chrome/common/extensions/api/extension_api_unittest.cc
+++ b/chrome/common/extensions/api/extension_api_unittest.cc
@@ -193,15 +193,15 @@ TEST(ExtensionAPI, LazyGetSchema) {
scoped_refptr<Extension> CreateExtensionWithPermissions(
const std::set<std::string>& permissions) {
- DictionaryValue manifest;
+ base::DictionaryValue manifest;
manifest.SetString("name", "extension");
manifest.SetString("version", "1.0");
manifest.SetInteger("manifest_version", 2);
{
- scoped_ptr<ListValue> permissions_list(new ListValue());
+ scoped_ptr<base::ListValue> permissions_list(new base::ListValue());
for (std::set<std::string>::const_iterator i = permissions.begin();
i != permissions.end(); ++i) {
- permissions_list->Append(Value::CreateStringValue(*i));
+ permissions_list->Append(new base::StringValue(*i));
}
manifest.Set("permissions", permissions_list.release());
}
@@ -386,20 +386,20 @@ TEST(ExtensionAPI, DefaultConfigurationFeatures) {
}
TEST(ExtensionAPI, FeaturesRequireContexts) {
- scoped_ptr<ListValue> schema1(new ListValue());
- DictionaryValue* feature_definition = new DictionaryValue();
+ scoped_ptr<base::ListValue> schema1(new base::ListValue());
+ base::DictionaryValue* feature_definition = new base::DictionaryValue();
schema1->Append(feature_definition);
feature_definition->SetString("namespace", "test");
feature_definition->SetBoolean("uses_feature_system", true);
- scoped_ptr<ListValue> schema2(schema1->DeepCopy());
+ scoped_ptr<base::ListValue> schema2(schema1->DeepCopy());
- ListValue* contexts = new ListValue();
- contexts->Append(Value::CreateStringValue("content_script"));
+ base::ListValue* contexts = new base::ListValue();
+ contexts->Append(new base::StringValue("content_script"));
feature_definition->Set("contexts", contexts);
struct {
- ListValue* schema;
+ base::ListValue* schema;
bool expect_success;
} test_data[] = {
{ schema1.get(), true },
@@ -419,11 +419,11 @@ TEST(ExtensionAPI, FeaturesRequireContexts) {
}
}
-static void GetDictionaryFromList(const DictionaryValue* schema,
+static void GetDictionaryFromList(const base::DictionaryValue* schema,
const std::string& list_name,
const int list_index,
- const DictionaryValue** out) {
- const ListValue* list;
+ const base::DictionaryValue** out) {
+ const base::ListValue* list;
EXPECT_TRUE(schema->GetList(list_name, &list));
EXPECT_TRUE(list->GetDictionary(list_index, out));
}
@@ -443,10 +443,10 @@ TEST(ExtensionAPI, TypesHaveNamespace) {
api.RegisterSchema("test.foo", manifest_str);
api.LoadAllSchemas();
- const DictionaryValue* schema = api.GetSchema("test.foo");
+ const base::DictionaryValue* schema = api.GetSchema("test.foo");
- const DictionaryValue* dict;
- const DictionaryValue* sub_dict;
+ const base::DictionaryValue* dict;
+ const base::DictionaryValue* sub_dict;
std::string type;
GetDictionaryFromList(schema, "types", 0, &dict);
@@ -455,7 +455,7 @@ TEST(ExtensionAPI, TypesHaveNamespace) {
EXPECT_TRUE(dict->GetString("customBindings", &type));
EXPECT_EQ("test.foo.TestType", type);
EXPECT_TRUE(dict->GetDictionary("properties", &sub_dict));
- const DictionaryValue* property;
+ const base::DictionaryValue* property;
EXPECT_TRUE(sub_dict->GetDictionary("foo", &property));
EXPECT_TRUE(property->GetString("$ref", &type));
EXPECT_EQ("test.foo.OtherType", type);
diff --git a/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc b/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc
index d056d70..a810544 100644
--- a/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc
+++ b/chrome/common/extensions/api/identity/extension_manifests_auth_unittest.cc
@@ -21,20 +21,20 @@ class OAuth2ManifestTest : public ExtensionManifestTest {
};
TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) {
- DictionaryValue base_manifest;
+ base::DictionaryValue base_manifest;
base_manifest.SetString(keys::kName, "test");
base_manifest.SetString(keys::kVersion, "0.1");
base_manifest.SetInteger(keys::kManifestVersion, 2);
base_manifest.SetString(keys::kOAuth2ClientId, "client1");
- ListValue* scopes = new ListValue();
- scopes->Append(Value::CreateStringValue("scope1"));
- scopes->Append(Value::CreateStringValue("scope2"));
+ base::ListValue* scopes = new base::ListValue();
+ scopes->Append(new base::StringValue("scope1"));
+ scopes->Append(new base::StringValue("scope2"));
base_manifest.Set(keys::kOAuth2Scopes, scopes);
// OAuth2 section should be parsed for an extension.
{
- DictionaryValue ext_manifest;
+ base::DictionaryValue ext_manifest;
// Lack of "app" section representa an extension. So the base manifest
// itself represents an extension.
ext_manifest.MergeDictionary(&base_manifest);
@@ -51,7 +51,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) {
// OAuth2 section should be parsed for a packaged app.
{
- DictionaryValue app_manifest;
+ base::DictionaryValue app_manifest;
app_manifest.SetString(keys::kLaunchLocalPath, "launch.html");
app_manifest.MergeDictionary(&base_manifest);
@@ -67,7 +67,7 @@ TEST_F(OAuth2ManifestTest, OAuth2SectionParsing) {
// OAuth2 section should NOT be parsed for a hosted app.
{
- DictionaryValue app_manifest;
+ base::DictionaryValue app_manifest;
app_manifest.SetString(keys::kLaunchWebURL, "http://www.google.com");
app_manifest.MergeDictionary(&base_manifest);
diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc
index 25ed860..dc3fd3b 100644
--- a/chrome/common/extensions/extension_file_util_unittest.cc
+++ b/chrome/common/extensions/extension_file_util_unittest.cc
@@ -379,7 +379,7 @@ TEST_F(ExtensionFileUtilTest, ExtensionResourceURLToFilePath) {
}
static scoped_refptr<Extension> LoadExtensionManifest(
- DictionaryValue* manifest,
+ base::DictionaryValue* manifest,
const base::FilePath& manifest_dir,
Manifest::Location location,
int extra_flags,
@@ -396,15 +396,16 @@ static scoped_refptr<Extension> LoadExtensionManifest(
int extra_flags,
std::string* error) {
JSONStringValueSerializer serializer(manifest_value);
- scoped_ptr<Value> result(serializer.Deserialize(NULL, error));
+ scoped_ptr<base::Value> result(serializer.Deserialize(NULL, error));
if (!result.get())
return NULL;
- CHECK_EQ(Value::TYPE_DICTIONARY, result->GetType());
- return LoadExtensionManifest(static_cast<DictionaryValue*>(result.get()),
- manifest_dir,
- location,
- extra_flags,
- error);
+ CHECK_EQ(base::Value::TYPE_DICTIONARY, result->GetType());
+ return LoadExtensionManifest(
+ static_cast<base::DictionaryValue*>(result.get()),
+ manifest_dir,
+ location,
+ extra_flags,
+ error);
}
#if defined(OS_WIN)
@@ -448,13 +449,13 @@ TEST_F(ExtensionFileUtilTest, MAYBE_BackgroundScriptsMustExist) {
base::ScopedTempDir temp;
ASSERT_TRUE(temp.CreateUniqueTempDir());
- scoped_ptr<DictionaryValue> value(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetString("name", "test");
value->SetString("version", "1");
value->SetInteger("manifest_version", 1);
- ListValue* scripts = new ListValue();
- scripts->Append(Value::CreateStringValue("foo.js"));
+ base::ListValue* scripts = new base::ListValue();
+ scripts->Append(new base::StringValue("foo.js"));
value->Set("background.scripts", scripts);
std::string error;
@@ -471,7 +472,7 @@ TEST_F(ExtensionFileUtilTest, MAYBE_BackgroundScriptsMustExist) {
EXPECT_EQ(0U, warnings.size());
scripts->Clear();
- scripts->Append(Value::CreateStringValue("http://google.com/foo.js"));
+ scripts->Append(new base::StringValue("http://google.com/foo.js"));
extension = LoadExtensionManifest(value.get(), temp.path(), Manifest::LOAD,
0, &error);
diff --git a/chrome/common/extensions/extension_set_unittest.cc b/chrome/common/extensions/extension_set_unittest.cc
index 2d28e65..cf1e8ad 100644
--- a/chrome/common/extensions/extension_set_unittest.cc
+++ b/chrome/common/extensions/extension_set_unittest.cc
@@ -25,7 +25,7 @@ scoped_refptr<Extension> CreateTestExtension(const std::string& name,
#endif
path = path.AppendASCII(name);
- DictionaryValue manifest;
+ base::DictionaryValue manifest;
manifest.SetString("name", name);
manifest.SetString("version", "1");
@@ -33,9 +33,9 @@ scoped_refptr<Extension> CreateTestExtension(const std::string& name,
manifest.SetString("app.launch.web_url", launch_url);
if (!extent.empty()) {
- ListValue* urls = new ListValue();
+ base::ListValue* urls = new base::ListValue();
manifest.Set("app.urls", urls);
- urls->Append(Value::CreateStringValue(extent));
+ urls->Append(new base::StringValue(extent));
}
std::string error;
@@ -46,7 +46,7 @@ scoped_refptr<Extension> CreateTestExtension(const std::string& name,
return extension;
}
-} // namespace
+} // namespace
TEST(ExtensionSetTest, ExtensionSet) {
scoped_refptr<Extension> ext1(CreateTestExtension(
diff --git a/chrome/common/extensions/features/base_feature_provider_unittest.cc b/chrome/common/extensions/features/base_feature_provider_unittest.cc
index fd0a6b4..17284f9 100644
--- a/chrome/common/extensions/features/base_feature_provider_unittest.cc
+++ b/chrome/common/extensions/features/base_feature_provider_unittest.cc
@@ -31,7 +31,7 @@ TEST(BaseFeatureProvider, ManifestFeatures) {
EXPECT_EQ(1u, feature->extension_types()->count(Manifest::TYPE_HOSTED_APP));
EXPECT_EQ(1u, feature->extension_types()->count(Manifest::TYPE_THEME));
- DictionaryValue manifest;
+ base::DictionaryValue manifest;
manifest.SetString("name", "test extension");
manifest.SetString("version", "1");
manifest.SetString("description", "hello there");
@@ -71,12 +71,12 @@ TEST(BaseFeatureProvider, PermissionFeatures) {
EXPECT_EQ(1u,
feature->extension_types()->count(Manifest::TYPE_PLATFORM_APP));
- DictionaryValue manifest;
+ base::DictionaryValue manifest;
manifest.SetString("name", "test extension");
manifest.SetString("version", "1");
- ListValue* permissions = new ListValue();
+ base::ListValue* permissions = new base::ListValue();
manifest.Set("permissions", permissions);
- permissions->Append(Value::CreateStringValue("contextMenus"));
+ permissions->Append(new base::StringValue("contextMenus"));
std::string error;
scoped_refptr<const Extension> extension(Extension::Create(
@@ -101,17 +101,17 @@ TEST(BaseFeatureProvider, PermissionFeatures) {
}
TEST(BaseFeatureProvider, Validation) {
- scoped_ptr<DictionaryValue> value(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
- DictionaryValue* feature1 = new DictionaryValue();
+ base::DictionaryValue* feature1 = new base::DictionaryValue();
value->Set("feature1", feature1);
- DictionaryValue* feature2 = new DictionaryValue();
- ListValue* extension_types = new ListValue();
- extension_types->Append(Value::CreateStringValue("extension"));
+ base::DictionaryValue* feature2 = new base::DictionaryValue();
+ base::ListValue* extension_types = new base::ListValue();
+ extension_types->Append(new base::StringValue("extension"));
feature2->Set("extension_types", extension_types);
- ListValue* contexts = new ListValue();
- contexts->Append(Value::CreateStringValue("blessed_extension"));
+ base::ListValue* contexts = new base::ListValue();
+ contexts->Append(new base::StringValue("blessed_extension"));
feature2->Set("contexts", contexts);
value->Set("feature2", feature2);
@@ -136,7 +136,7 @@ TEST(BaseFeatureProvider, Validation) {
}
TEST(BaseFeatureProvider, ComplexFeatures) {
- scoped_ptr<DictionaryValue> rule(
+ scoped_ptr<base::DictionaryValue> rule(
DictionaryBuilder()
.Set("feature1",
ListBuilder().Append(DictionaryBuilder()
@@ -152,7 +152,7 @@ TEST(BaseFeatureProvider, ComplexFeatures) {
scoped_ptr<BaseFeatureProvider> provider(
new BaseFeatureProvider(*rule, NULL));
- Feature *feature = provider->GetFeature("feature1");
+ Feature* feature = provider->GetFeature("feature1");
EXPECT_TRUE(feature);
// Make sure both rules are applied correctly.
diff --git a/chrome/common/extensions/features/simple_feature_unittest.cc b/chrome/common/extensions/features/simple_feature_unittest.cc
index f8338cd..76d313c 100644
--- a/chrome/common/extensions/features/simple_feature_unittest.cc
+++ b/chrome/common/extensions/features/simple_feature_unittest.cc
@@ -127,7 +127,7 @@ TEST_F(ExtensionSimpleFeatureTest, Context) {
feature.set_min_manifest_version(21);
feature.set_max_manifest_version(25);
- DictionaryValue manifest;
+ base::DictionaryValue manifest;
manifest.SetString("name", "test");
manifest.SetString("version", "1");
manifest.SetInteger("manifest_version", 21);
@@ -252,7 +252,7 @@ TEST_F(ExtensionSimpleFeatureTest, Version) {
}
TEST_F(ExtensionSimpleFeatureTest, ParseNull) {
- scoped_ptr<DictionaryValue> value(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
scoped_ptr<SimpleFeature> feature(new SimpleFeature());
feature->Parse(value.get());
EXPECT_TRUE(feature->whitelist()->empty());
@@ -265,10 +265,10 @@ TEST_F(ExtensionSimpleFeatureTest, ParseNull) {
}
TEST_F(ExtensionSimpleFeatureTest, ParseWhitelist) {
- scoped_ptr<DictionaryValue> value(new DictionaryValue());
- ListValue* whitelist = new ListValue();
- whitelist->Append(Value::CreateStringValue("foo"));
- whitelist->Append(Value::CreateStringValue("bar"));
+ scoped_ptr<base::DictionaryValue> value(new DictionaryValue());
+ base::ListValue* whitelist = new base::ListValue();
+ whitelist->Append(new base::StringValue("foo"));
+ whitelist->Append(new base::StringValue("bar"));
value->Set("whitelist", whitelist);
scoped_ptr<SimpleFeature> feature(new SimpleFeature());
feature->Parse(value.get());
@@ -278,13 +278,13 @@ TEST_F(ExtensionSimpleFeatureTest, ParseWhitelist) {
}
TEST_F(ExtensionSimpleFeatureTest, ParsePackageTypes) {
- scoped_ptr<DictionaryValue> value(new DictionaryValue());
- ListValue* extension_types = new ListValue();
- extension_types->Append(Value::CreateStringValue("extension"));
- extension_types->Append(Value::CreateStringValue("theme"));
- extension_types->Append(Value::CreateStringValue("packaged_app"));
- extension_types->Append(Value::CreateStringValue("hosted_app"));
- extension_types->Append(Value::CreateStringValue("platform_app"));
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
+ base::ListValue* extension_types = new base::ListValue();
+ extension_types->Append(new base::StringValue("extension"));
+ extension_types->Append(new base::StringValue("theme"));
+ extension_types->Append(new base::StringValue("packaged_app"));
+ extension_types->Append(new base::StringValue("hosted_app"));
+ extension_types->Append(new base::StringValue("platform_app"));
value->Set("extension_types", extension_types);
scoped_ptr<SimpleFeature> feature(new SimpleFeature());
feature->Parse(value.get());
@@ -303,12 +303,12 @@ TEST_F(ExtensionSimpleFeatureTest, ParsePackageTypes) {
}
TEST_F(ExtensionSimpleFeatureTest, ParseContexts) {
- scoped_ptr<DictionaryValue> value(new DictionaryValue());
- ListValue* contexts = new ListValue();
- contexts->Append(Value::CreateStringValue("blessed_extension"));
- contexts->Append(Value::CreateStringValue("unblessed_extension"));
- contexts->Append(Value::CreateStringValue("content_script"));
- contexts->Append(Value::CreateStringValue("web_page"));
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
+ base::ListValue* contexts = new base::ListValue();
+ contexts->Append(new base::StringValue("blessed_extension"));
+ contexts->Append(new base::StringValue("unblessed_extension"));
+ contexts->Append(new base::StringValue("content_script"));
+ contexts->Append(new base::StringValue("web_page"));
value->Set("contexts", contexts);
scoped_ptr<SimpleFeature> feature(new SimpleFeature());
feature->Parse(value.get());
@@ -329,7 +329,7 @@ TEST_F(ExtensionSimpleFeatureTest, ParseContexts) {
}
TEST_F(ExtensionSimpleFeatureTest, ParseLocation) {
- scoped_ptr<DictionaryValue> value(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetString("location", "component");
scoped_ptr<SimpleFeature> feature(new SimpleFeature());
feature->Parse(value.get());
@@ -337,7 +337,7 @@ TEST_F(ExtensionSimpleFeatureTest, ParseLocation) {
}
TEST_F(ExtensionSimpleFeatureTest, ParsePlatform) {
- scoped_ptr<DictionaryValue> value(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetString("platform", "chromeos");
scoped_ptr<SimpleFeature> feature(new SimpleFeature());
feature->Parse(value.get());
@@ -345,7 +345,7 @@ TEST_F(ExtensionSimpleFeatureTest, ParsePlatform) {
}
TEST_F(ExtensionSimpleFeatureTest, ManifestVersion) {
- scoped_ptr<DictionaryValue> value(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetInteger("min_manifest_version", 1);
value->SetInteger("max_manifest_version", 5);
scoped_ptr<SimpleFeature> feature(new SimpleFeature());
@@ -367,22 +367,22 @@ TEST_F(ExtensionSimpleFeatureTest, Inheritance) {
SimpleFeature feature2 = feature;
EXPECT_TRUE(feature2.Equals(feature));
- DictionaryValue definition;
+ base::DictionaryValue definition;
feature2.Parse(&definition);
EXPECT_TRUE(feature2.Equals(feature));
- ListValue* whitelist = new ListValue();
- ListValue* extension_types = new ListValue();
- ListValue* contexts = new ListValue();
- whitelist->Append(Value::CreateStringValue("bar"));
- extension_types->Append(Value::CreateStringValue("extension"));
- contexts->Append(Value::CreateStringValue("unblessed_extension"));
+ base::ListValue* whitelist = new base::ListValue();
+ base::ListValue* extension_types = new base::ListValue();
+ base::ListValue* contexts = new base::ListValue();
+ whitelist->Append(new base::StringValue("bar"));
+ extension_types->Append(new base::StringValue("extension"));
+ contexts->Append(new base::StringValue("unblessed_extension"));
definition.Set("whitelist", whitelist);
definition.Set("extension_types", extension_types);
definition.Set("contexts", contexts);
// Can't test location or platform because we only have one value so far.
- definition.Set("min_manifest_version", Value::CreateIntegerValue(2));
- definition.Set("max_manifest_version", Value::CreateIntegerValue(3));
+ definition.Set("min_manifest_version", new base::FundamentalValue(2));
+ definition.Set("max_manifest_version", new base::FundamentalValue(3));
feature2.Parse(&definition);
EXPECT_FALSE(feature2.Equals(feature));
@@ -444,7 +444,7 @@ Feature::AvailabilityResult IsAvailableInChannel(
SimpleFeature feature;
if (!channel.empty()) {
- DictionaryValue feature_value;
+ base::DictionaryValue feature_value;
feature_value.SetString("channel", channel);
feature.Parse(&feature_value);
}
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc
index 2913f72..e85c9d6 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc
@@ -27,7 +27,7 @@ TEST_F(ExtensionManifestTest, BackgroundPermission) {
TEST_F(ExtensionManifestTest, BackgroundScripts) {
std::string error;
- scoped_ptr<DictionaryValue> manifest(
+ scoped_ptr<base::DictionaryValue> manifest(
LoadManifest("background_scripts.json", &error));
ASSERT_TRUE(manifest.get());
@@ -56,7 +56,7 @@ TEST_F(ExtensionManifestTest, BackgroundPage) {
EXPECT_TRUE(extension->allow_background_js_access());
std::string error;
- scoped_ptr<DictionaryValue> manifest(
+ scoped_ptr<base::DictionaryValue> manifest(
LoadManifest("background_page_legacy.json", &error));
ASSERT_TRUE(manifest.get());
extension = LoadAndExpectSuccess(Manifest(manifest.get(), ""));
@@ -87,7 +87,7 @@ TEST_F(ExtensionManifestTest, BackgroundPageWebRequest) {
chrome::VersionInfo::CHANNEL_DEV);
std::string error;
- scoped_ptr<DictionaryValue> manifest(
+ scoped_ptr<base::DictionaryValue> manifest(
LoadManifest("background_page.json", &error));
ASSERT_TRUE(manifest.get());
manifest->SetBoolean(keys::kBackgroundPersistent, false);
@@ -97,8 +97,8 @@ TEST_F(ExtensionManifestTest, BackgroundPageWebRequest) {
ASSERT_TRUE(extension);
EXPECT_TRUE(extension->has_lazy_background_page());
- ListValue* permissions = new ListValue();
- permissions->Append(Value::CreateStringValue("webRequest"));
+ base::ListValue* permissions = new base::ListValue();
+ permissions->Append(new base::StringValue("webRequest"));
manifest->Set(keys::kPermissions, permissions);
LoadAndExpectError(Manifest(manifest.get(), ""),
errors::kWebRequestConflictsWithLazyBackground);
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc
index dd0b9f9..83588dd 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_platformapp_unittest.cc
@@ -103,7 +103,7 @@ TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) {
// testing. The requirements are that (1) it be a valid platform app, and (2)
// it contain no permissions dictionary.
std::string error;
- scoped_ptr<DictionaryValue> manifest(
+ scoped_ptr<base::DictionaryValue> manifest(
LoadManifest("init_valid_platform_app.json", &error));
std::vector<linked_ptr<DictionaryValue> > manifests;
@@ -112,9 +112,9 @@ TEST_F(ExtensionManifestTest, CertainApisRequirePlatformApps) {
const char* api_name = kPlatformAppExperimentalApis[i];
// DictionaryValue will take ownership of this ListValue.
- ListValue *permissions = new ListValue();
- permissions->Append(base::Value::CreateStringValue("experimental"));
- permissions->Append(base::Value::CreateStringValue(api_name));
+ base::ListValue *permissions = new base::ListValue();
+ permissions->Append(new base::StringValue("experimental"));
+ permissions->Append(new base::StringValue(api_name));
manifest->Set("permissions", permissions);
manifests.push_back(make_linked_ptr(manifest->DeepCopy()));
}
diff --git a/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc b/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc
index ad2ab7f..e0aa833 100644
--- a/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc
+++ b/chrome/common/extensions/manifest_tests/extension_manifests_storage_unittest.cc
@@ -10,12 +10,12 @@
namespace keys = extension_manifest_keys;
TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) {
- DictionaryValue base_manifest;
+ base::DictionaryValue base_manifest;
{
base_manifest.SetString(keys::kName, "test");
base_manifest.SetString(keys::kVersion, "0.1");
- ListValue* permissions = new ListValue();
- permissions->Append(Value::CreateStringValue("storage"));
+ base::ListValue* permissions = new base::ListValue();
+ permissions->Append(new base::StringValue("storage"));
base_manifest.Set(keys::kPermissions, permissions);
}
@@ -30,7 +30,7 @@ TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) {
// Extension with manifest version 1 cannot use storage API.
{
- DictionaryValue manifest_with_version;
+ base::DictionaryValue manifest_with_version;
manifest_with_version.SetInteger(keys::kManifestVersion, 1);
manifest_with_version.MergeDictionary(&base_manifest);
@@ -40,7 +40,7 @@ TEST_F(ExtensionManifestTest, StorageAPIManifestVersionAvailability) {
// Extension with manifest version 2 *can* use storage API.
{
- DictionaryValue manifest_with_version;
+ base::DictionaryValue manifest_with_version;
manifest_with_version.SetInteger(keys::kManifestVersion, 2);
manifest_with_version.MergeDictionary(&base_manifest);
diff --git a/chrome/common/extensions/manifest_unittest.cc b/chrome/common/extensions/manifest_unittest.cc
index 195f797..5fd0f02 100644
--- a/chrome/common/extensions/manifest_unittest.cc
+++ b/chrome/common/extensions/manifest_unittest.cc
@@ -41,9 +41,10 @@ class ManifestTest : public testing::Test {
// Helper function that replaces the Manifest held by |manifest| with a copy
// with its |key| changed to |value|. If |value| is NULL, then |key| will
// instead be deleted.
- void MutateManifest(
- scoped_ptr<Manifest>* manifest, const std::string& key, Value* value) {
- scoped_ptr<DictionaryValue> manifest_value(
+ void MutateManifest(scoped_ptr<Manifest>* manifest,
+ const std::string& key,
+ base::Value* value) {
+ scoped_ptr<base::DictionaryValue> manifest_value(
manifest->get()->value()->DeepCopy());
if (value)
manifest_value->Set(key, value);
@@ -57,7 +58,7 @@ class ManifestTest : public testing::Test {
// Verifies that extensions can access the correct keys.
TEST_F(ManifestTest, Extension) {
- scoped_ptr<DictionaryValue> manifest_value(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> manifest_value(new base::DictionaryValue());
manifest_value->SetString(keys::kName, "extension");
manifest_value->SetString(keys::kVersion, "1");
// Only supported in manifest_version=1.
@@ -86,7 +87,7 @@ TEST_F(ManifestTest, Extension) {
// Set the manifest_version to 2; background_page should stop working.
value.clear();
MutateManifest(
- &manifest, keys::kManifestVersion, Value::CreateIntegerValue(2));
+ &manifest, keys::kManifestVersion, new base::FundamentalValue(2));
EXPECT_FALSE(manifest->GetString("background_page", &value));
EXPECT_EQ("", value);
@@ -109,13 +110,13 @@ TEST_F(ManifestTest, Extension) {
EXPECT_TRUE(manifest->Equals(manifest2.get()));
EXPECT_TRUE(manifest2->Equals(manifest.get()));
MutateManifest(
- &manifest, "foo", Value::CreateStringValue("blah"));
+ &manifest, "foo", new base::StringValue("blah"));
EXPECT_FALSE(manifest->Equals(manifest2.get()));
}
// Verifies that key restriction based on type works.
TEST_F(ManifestTest, ExtensionTypes) {
- scoped_ptr<DictionaryValue> value(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetString(keys::kName, "extension");
value->SetString(keys::kVersion, "1");
@@ -132,31 +133,31 @@ TEST_F(ManifestTest, ExtensionTypes) {
// Theme.
MutateManifest(
- &manifest, keys::kTheme, new DictionaryValue());
+ &manifest, keys::kTheme, new base::DictionaryValue());
AssertType(manifest.get(), Manifest::TYPE_THEME);
MutateManifest(
&manifest, keys::kTheme, NULL);
// Packaged app.
MutateManifest(
- &manifest, keys::kApp, new DictionaryValue());
+ &manifest, keys::kApp, new base::DictionaryValue());
AssertType(manifest.get(), Manifest::TYPE_LEGACY_PACKAGED_APP);
// Platform app.
MutateManifest(
- &manifest, keys::kPlatformAppBackground, new DictionaryValue());
+ &manifest, keys::kPlatformAppBackground, new base::DictionaryValue());
AssertType(manifest.get(), Manifest::TYPE_PLATFORM_APP);
MutateManifest(
&manifest, keys::kPlatformAppBackground, NULL);
// Hosted app.
MutateManifest(
- &manifest, keys::kWebURLs, new ListValue());
+ &manifest, keys::kWebURLs, new base::ListValue());
AssertType(manifest.get(), Manifest::TYPE_HOSTED_APP);
MutateManifest(
&manifest, keys::kWebURLs, NULL);
MutateManifest(
- &manifest, keys::kLaunchWebURL, Value::CreateStringValue("foo"));
+ &manifest, keys::kLaunchWebURL, new base::StringValue("foo"));
AssertType(manifest.get(), Manifest::TYPE_HOSTED_APP);
MutateManifest(
&manifest, keys::kLaunchWebURL, NULL);
@@ -164,7 +165,7 @@ TEST_F(ManifestTest, ExtensionTypes) {
// Verifies that the getters filter restricted keys.
TEST_F(ManifestTest, RestrictedKeys) {
- scoped_ptr<DictionaryValue> value(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue());
value->SetString(keys::kName, "extension");
value->SetString(keys::kVersion, "1");
@@ -178,14 +179,14 @@ TEST_F(ManifestTest, RestrictedKeys) {
// Platform apps cannot have a "page_action" key.
MutateManifest(
- &manifest, keys::kPageAction, new DictionaryValue());
+ &manifest, keys::kPageAction, new base::DictionaryValue());
AssertType(manifest.get(), Manifest::TYPE_EXTENSION);
base::Value* output = NULL;
EXPECT_TRUE(manifest->HasKey(keys::kPageAction));
EXPECT_TRUE(manifest->Get(keys::kPageAction, &output));
MutateManifest(
- &manifest, keys::kPlatformAppBackground, new DictionaryValue());
+ &manifest, keys::kPlatformAppBackground, new base::DictionaryValue());
AssertType(manifest.get(), Manifest::TYPE_PLATFORM_APP);
EXPECT_FALSE(manifest->HasKey(keys::kPageAction));
EXPECT_FALSE(manifest->Get(keys::kPageAction, &output));
@@ -199,12 +200,12 @@ TEST_F(ManifestTest, RestrictedKeys) {
chrome::VersionInfo::CHANNEL_DEV);
MutateManifest(
- &manifest, keys::kCommands, new DictionaryValue());
+ &manifest, keys::kCommands, new base::DictionaryValue());
EXPECT_FALSE(manifest->HasKey(keys::kCommands));
EXPECT_FALSE(manifest->Get(keys::kCommands, &output));
MutateManifest(
- &manifest, keys::kManifestVersion, Value::CreateIntegerValue(2));
+ &manifest, keys::kManifestVersion, new base::FundamentalValue(2));
EXPECT_TRUE(manifest->HasKey(keys::kCommands));
EXPECT_TRUE(manifest->Get(keys::kCommands, &output));
}
diff --git a/chrome/common/extensions/permissions/api_permission_set_unittest.cc b/chrome/common/extensions/permissions/api_permission_set_unittest.cc
index dcc7321..182e5f8 100644
--- a/chrome/common/extensions/permissions/api_permission_set_unittest.cc
+++ b/chrome/common/extensions/permissions/api_permission_set_unittest.cc
@@ -47,10 +47,10 @@ TEST(APIPermissionSetTest, CreateUnion) {
PermissionsInfo::GetInstance()->GetByID(APIPermission::kSocket);
permission = permission_info->CreateAPIPermission();
{
- scoped_ptr<ListValue> value(new ListValue());
- value->Append(Value::CreateStringValue("tcp-connect:*.example.com:80"));
- value->Append(Value::CreateStringValue("udp-bind::8080"));
- value->Append(Value::CreateStringValue("udp-send-to::8888"));
+ scoped_ptr<base::ListValue> value(new base::ListValue());
+ value->Append(new base::StringValue("tcp-connect:*.example.com:80"));
+ value->Append(new base::StringValue("udp-bind::8080"));
+ value->Append(new base::StringValue("udp-send-to::8888"));
if (!permission->FromValue(value.get())) {
NOTREACHED();
}
@@ -83,9 +83,9 @@ TEST(APIPermissionSetTest, CreateUnion) {
permission = permission_info->CreateAPIPermission();
{
- scoped_ptr<ListValue> value(new ListValue());
- value->Append(Value::CreateStringValue("tcp-connect:*.example.com:80"));
- value->Append(Value::CreateStringValue("udp-send-to::8899"));
+ scoped_ptr<base::ListValue> value(new base::ListValue());
+ value->Append(new base::StringValue("tcp-connect:*.example.com:80"));
+ value->Append(new base::StringValue("udp-send-to::8899"));
if (!permission->FromValue(value.get())) {
NOTREACHED();
}
@@ -99,11 +99,11 @@ TEST(APIPermissionSetTest, CreateUnion) {
permission = permission_info->CreateAPIPermission();
{
- scoped_ptr<ListValue> value(new ListValue());
- value->Append(Value::CreateStringValue("tcp-connect:*.example.com:80"));
- value->Append(Value::CreateStringValue("udp-bind::8080"));
- value->Append(Value::CreateStringValue("udp-send-to::8888"));
- value->Append(Value::CreateStringValue("udp-send-to::8899"));
+ scoped_ptr<base::ListValue> value(new base::ListValue());
+ value->Append(new base::StringValue("tcp-connect:*.example.com:80"));
+ value->Append(new base::StringValue("udp-bind::8080"));
+ value->Append(new base::StringValue("udp-send-to::8888"));
+ value->Append(new base::StringValue("udp-send-to::8899"));
if (!permission->FromValue(value.get())) {
NOTREACHED();
}
@@ -139,10 +139,10 @@ TEST(APIPermissionSetTest, CreateIntersection) {
apis1.insert(APIPermission::kBackground);
permission = permission_info->CreateAPIPermission();
{
- scoped_ptr<ListValue> value(new ListValue());
- value->Append(Value::CreateStringValue("tcp-connect:*.example.com:80"));
- value->Append(Value::CreateStringValue("udp-bind::8080"));
- value->Append(Value::CreateStringValue("udp-send-to::8888"));
+ scoped_ptr<base::ListValue> value(new base::ListValue());
+ value->Append(new base::StringValue("tcp-connect:*.example.com:80"));
+ value->Append(new base::StringValue("udp-bind::8080"));
+ value->Append(new base::StringValue("udp-send-to::8888"));
if (!permission->FromValue(value.get())) {
NOTREACHED();
}
@@ -167,10 +167,10 @@ TEST(APIPermissionSetTest, CreateIntersection) {
apis2.insert(APIPermission::kPlugin);
permission = permission_info->CreateAPIPermission();
{
- scoped_ptr<ListValue> value(new ListValue());
- value->Append(Value::CreateStringValue("udp-bind::8080"));
- value->Append(Value::CreateStringValue("udp-send-to::8888"));
- value->Append(Value::CreateStringValue("udp-send-to::8899"));
+ scoped_ptr<base::ListValue> value(new base::ListValue());
+ value->Append(new base::StringValue("udp-bind::8080"));
+ value->Append(new base::StringValue("udp-send-to::8888"));
+ value->Append(new base::StringValue("udp-send-to::8899"));
if (!permission->FromValue(value.get())) {
NOTREACHED();
}
@@ -180,9 +180,9 @@ TEST(APIPermissionSetTest, CreateIntersection) {
expected_apis.insert(APIPermission::kTab);
permission = permission_info->CreateAPIPermission();
{
- scoped_ptr<ListValue> value(new ListValue());
- value->Append(Value::CreateStringValue("udp-bind::8080"));
- value->Append(Value::CreateStringValue("udp-send-to::8888"));
+ scoped_ptr<base::ListValue> value(new base::ListValue());
+ value->Append(new base::StringValue("udp-bind::8080"));
+ value->Append(new base::StringValue("udp-send-to::8888"));
if (!permission->FromValue(value.get())) {
NOTREACHED();
}
@@ -217,10 +217,10 @@ TEST(APIPermissionSetTest, CreateDifference) {
apis1.insert(APIPermission::kBackground);
permission = permission_info->CreateAPIPermission();
{
- scoped_ptr<ListValue> value(new ListValue());
- value->Append(Value::CreateStringValue("tcp-connect:*.example.com:80"));
- value->Append(Value::CreateStringValue("udp-bind::8080"));
- value->Append(Value::CreateStringValue("udp-send-to::8888"));
+ scoped_ptr<base::ListValue> value(new base::ListValue());
+ value->Append(new base::StringValue("tcp-connect:*.example.com:80"));
+ value->Append(new base::StringValue("udp-bind::8080"));
+ value->Append(new base::StringValue("udp-send-to::8888"));
if (!permission->FromValue(value.get())) {
NOTREACHED();
}
@@ -238,9 +238,9 @@ TEST(APIPermissionSetTest, CreateDifference) {
apis2.insert(APIPermission::kPlugin);
permission = permission_info->CreateAPIPermission();
{
- scoped_ptr<ListValue> value(new ListValue());
- value->Append(Value::CreateStringValue("tcp-connect:*.example.com:80"));
- value->Append(Value::CreateStringValue("udp-send-to::8899"));
+ scoped_ptr<base::ListValue> value(new base::ListValue());
+ value->Append(new base::StringValue("tcp-connect:*.example.com:80"));
+ value->Append(new base::StringValue("udp-send-to::8899"));
if (!permission->FromValue(value.get())) {
NOTREACHED();
}
@@ -250,9 +250,9 @@ TEST(APIPermissionSetTest, CreateDifference) {
expected_apis.insert(APIPermission::kBackground);
permission = permission_info->CreateAPIPermission();
{
- scoped_ptr<ListValue> value(new ListValue());
- value->Append(Value::CreateStringValue("udp-bind::8080"));
- value->Append(Value::CreateStringValue("udp-send-to::8888"));
+ scoped_ptr<base::ListValue> value(new base::ListValue());
+ value->Append(new base::StringValue("udp-bind::8080"));
+ value->Append(new base::StringValue("udp-send-to::8888"));
if (!permission->FromValue(value.get())) {
NOTREACHED();
}
@@ -285,10 +285,10 @@ TEST(APIPermissionSetTest, IPC) {
apis.insert(APIPermission::kBackground);
permission = permission_info->CreateAPIPermission();
{
- scoped_ptr<ListValue> value(new ListValue());
- value->Append(Value::CreateStringValue("tcp-connect:*.example.com:80"));
- value->Append(Value::CreateStringValue("udp-bind::8080"));
- value->Append(Value::CreateStringValue("udp-send-to::8888"));
+ scoped_ptr<base::ListValue> value(new base::ListValue());
+ value->Append(new base::StringValue("tcp-connect:*.example.com:80"));
+ value->Append(new base::StringValue("udp-bind::8080"));
+ value->Append(new base::StringValue("udp-send-to::8888"));
if (!permission->FromValue(value.get())) {
NOTREACHED();
}
diff --git a/chrome/common/extensions/permissions/socket_permission_data.cc b/chrome/common/extensions/permissions/socket_permission_data.cc
index 8c1229b..b45cf95 100644
--- a/chrome/common/extensions/permissions/socket_permission_data.cc
+++ b/chrome/common/extensions/permissions/socket_permission_data.cc
@@ -154,7 +154,7 @@ bool SocketPermissionData::Check(
}
scoped_ptr<base::Value> SocketPermissionData::ToValue() const {
- return scoped_ptr<base::Value>(base::Value::CreateStringValue(GetAsString()));
+ return scoped_ptr<base::Value>(new base::StringValue(GetAsString()));
}
bool SocketPermissionData::FromValue(const base::Value* value) {
diff --git a/chrome/common/extensions/value_builder.cc b/chrome/common/extensions/value_builder.cc
index bf57d22..2b09858 100644
--- a/chrome/common/extensions/value_builder.cc
+++ b/chrome/common/extensions/value_builder.cc
@@ -20,25 +20,25 @@ DictionaryBuilder::~DictionaryBuilder() {}
DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
int in_value) {
- dict_->SetWithoutPathExpansion(path, Value::CreateIntegerValue(in_value));
+ dict_->SetWithoutPathExpansion(path, new base::FundamentalValue(in_value));
return *this;
}
DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
double in_value) {
- dict_->SetWithoutPathExpansion(path, Value::CreateDoubleValue(in_value));
+ dict_->SetWithoutPathExpansion(path, new base::FundamentalValue(in_value));
return *this;
}
DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
const std::string& in_value) {
- dict_->SetWithoutPathExpansion(path, Value::CreateStringValue(in_value));
+ dict_->SetWithoutPathExpansion(path, new base::StringValue(in_value));
return *this;
}
DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
const string16& in_value) {
- dict_->SetWithoutPathExpansion(path, Value::CreateStringValue(in_value));
+ dict_->SetWithoutPathExpansion(path, new base::StringValue(in_value));
return *this;
}
@@ -56,7 +56,7 @@ DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
DictionaryBuilder& DictionaryBuilder::SetBoolean(
const std::string& path, bool in_value) {
- dict_->SetWithoutPathExpansion(path, Value::CreateBooleanValue(in_value));
+ dict_->SetWithoutPathExpansion(path, new base::FundamentalValue(in_value));
return *this;
}
@@ -67,22 +67,22 @@ ListBuilder::ListBuilder(const ListValue& init) : list_(init.DeepCopy()) {}
ListBuilder::~ListBuilder() {}
ListBuilder& ListBuilder::Append(int in_value) {
- list_->Append(Value::CreateIntegerValue(in_value));
+ list_->Append(new base::FundamentalValue(in_value));
return *this;
}
ListBuilder& ListBuilder::Append(double in_value) {
- list_->Append(Value::CreateDoubleValue(in_value));
+ list_->Append(new base::FundamentalValue(in_value));
return *this;
}
ListBuilder& ListBuilder::Append(const std::string& in_value) {
- list_->Append(Value::CreateStringValue(in_value));
+ list_->Append(new base::StringValue(in_value));
return *this;
}
ListBuilder& ListBuilder::Append(const string16& in_value) {
- list_->Append(Value::CreateStringValue(in_value));
+ list_->Append(new base::StringValue(in_value));
return *this;
}
@@ -97,7 +97,7 @@ ListBuilder& ListBuilder::Append(ListBuilder& in_value) {
}
ListBuilder& ListBuilder::AppendBoolean(bool in_value) {
- list_->Append(Value::CreateBooleanValue(in_value));
+ list_->Append(new base::FundamentalValue(in_value));
return *this;
}
diff --git a/chrome/common/json_schema_validator_unittest_base.cc b/chrome/common/json_schema_validator_unittest_base.cc
index 8ef33db..fd66bf5 100644
--- a/chrome/common/json_schema_validator_unittest_base.cc
+++ b/chrome/common/json_schema_validator_unittest_base.cc
@@ -25,7 +25,7 @@ namespace {
#define TEST_SOURCE base::StringPrintf("%s:%i", __FILE__, __LINE__)
-Value* LoadValue(const std::string& filename) {
+base::Value* LoadValue(const std::string& filename) {
base::FilePath path;
PathService::Get(chrome::DIR_TEST_DATA, &path);
path = path.AppendASCII("json_schema_validator").AppendASCII(filename);
@@ -33,14 +33,14 @@ Value* LoadValue(const std::string& filename) {
std::string error_message;
JSONFileValueSerializer serializer(path);
- Value* result = serializer.Deserialize(NULL, &error_message);
+ base::Value* result = serializer.Deserialize(NULL, &error_message);
if (!result)
ADD_FAILURE() << "Could not parse JSON: " << error_message;
return result;
}
-Value* LoadValue(const std::string& filename, base::Value::Type type) {
- scoped_ptr<Value> result(LoadValue(filename));
+base::Value* LoadValue(const std::string& filename, base::Value::Type type) {
+ scoped_ptr<base::Value> result(LoadValue(filename));
if (!result.get())
return NULL;
if (!result->IsType(type)) {
@@ -50,14 +50,14 @@ Value* LoadValue(const std::string& filename, base::Value::Type type) {
return result.release();
}
-ListValue* LoadList(const std::string& filename) {
- return static_cast<ListValue*>(
- LoadValue(filename, Value::TYPE_LIST));
+base::ListValue* LoadList(const std::string& filename) {
+ return static_cast<base::ListValue*>(
+ LoadValue(filename, base::Value::TYPE_LIST));
}
-DictionaryValue* LoadDictionary(const std::string& filename) {
- return static_cast<DictionaryValue*>(
- LoadValue(filename, Value::TYPE_DICTIONARY));
+base::DictionaryValue* LoadDictionary(const std::string& filename) {
+ return static_cast<base::DictionaryValue*>(
+ LoadValue(filename, base::Value::TYPE_DICTIONARY));
}
} // namespace
@@ -85,8 +85,9 @@ void JSONSchemaValidatorTestBase::RunTests() {
}
void JSONSchemaValidatorTestBase::TestComplex() {
- scoped_ptr<DictionaryValue> schema(LoadDictionary("complex_schema.json"));
- scoped_ptr<ListValue> instance(LoadList("complex_instance.json"));
+ scoped_ptr<base::DictionaryValue> schema(
+ LoadDictionary("complex_schema.json"));
+ scoped_ptr<base::ListValue> instance(LoadList("complex_instance.json"));
ASSERT_TRUE(schema.get());
ASSERT_TRUE(instance.get());
@@ -94,7 +95,7 @@ void JSONSchemaValidatorTestBase::TestComplex() {
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
instance->Remove(instance->GetSize() - 1, NULL);
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Append(new DictionaryValue());
+ instance->Append(new base::DictionaryValue());
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "1",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -102,7 +103,7 @@ void JSONSchemaValidatorTestBase::TestComplex() {
schema::kObject));
instance->Remove(instance->GetSize() - 1, NULL);
- DictionaryValue* item = NULL;
+ base::DictionaryValue* item = NULL;
ASSERT_TRUE(instance->GetDictionary(0, &item));
item->SetString("url", "xxxxxxxxxxx");
@@ -117,63 +118,64 @@ void JSONSchemaValidatorTestBase::TestStringPattern() {
if (type_ == CPP)
return;
- scoped_ptr<DictionaryValue> schema(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> schema(new base::DictionaryValue());
schema->SetString(schema::kType, schema::kString);
schema->SetString(schema::kPattern, "foo+");
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("foo")).get(),
+ scoped_ptr<base::Value>(new base::StringValue("foo")).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("foooooo")).get(),
+ scoped_ptr<base::Value>(new base::StringValue("foooooo")).get(),
schema.get(), NULL);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("bar")).get(),
+ scoped_ptr<base::Value>(new base::StringValue("bar")).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kStringPattern, "foo+"));
}
void JSONSchemaValidatorTestBase::TestEnum() {
- scoped_ptr<DictionaryValue> schema(LoadDictionary("enum_schema.json"));
+ scoped_ptr<base::DictionaryValue> schema(LoadDictionary("enum_schema.json"));
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("foo")).get(),
+ scoped_ptr<base::Value>(new base::StringValue("foo")).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateBooleanValue(false)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(false)).get(),
schema.get(), NULL);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("42")).get(),
+ scoped_ptr<base::Value>(new base::StringValue("42")).get(),
schema.get(), NULL, "", JSONSchemaValidator::kInvalidEnum);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateNullValue()).get(),
+ scoped_ptr<base::Value>(base::Value::CreateNullValue()).get(),
schema.get(), NULL, "", JSONSchemaValidator::kInvalidEnum);
}
void JSONSchemaValidatorTestBase::TestChoices() {
- scoped_ptr<DictionaryValue> schema(LoadDictionary("choices_schema.json"));
+ scoped_ptr<base::DictionaryValue> schema(
+ LoadDictionary("choices_schema.json"));
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateNullValue()).get(),
+ scoped_ptr<base::Value>(base::Value::CreateNullValue()).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
schema.get(), NULL);
- scoped_ptr<DictionaryValue> instance(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> instance(new base::DictionaryValue());
instance->SetString("foo", "bar");
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("foo")).get(),
+ scoped_ptr<base::Value>(new base::StringValue("foo")).get(),
schema.get(), NULL, "", JSONSchemaValidator::kInvalidChoice);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(new ListValue()).get(),
+ scoped_ptr<base::Value>(new base::ListValue()).get(),
schema.get(), NULL, "", JSONSchemaValidator::kInvalidChoice);
instance->SetInteger("foo", 42);
@@ -186,12 +188,12 @@ void JSONSchemaValidatorTestBase::TestExtends() {
}
void JSONSchemaValidatorTestBase::TestObject() {
- scoped_ptr<DictionaryValue> schema(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> schema(new base::DictionaryValue());
schema->SetString(schema::kType, schema::kObject);
schema->SetString("properties.foo.type", schema::kString);
schema->SetString("properties.bar.type", schema::kInteger);
- scoped_ptr<DictionaryValue> instance(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> instance(new base::DictionaryValue());
instance->SetString("foo", "foo");
instance->SetInteger("bar", 42);
@@ -213,7 +215,7 @@ void JSONSchemaValidatorTestBase::TestObject() {
schema::kInteger,
schema::kString));
- DictionaryValue* additional_properties = new DictionaryValue();
+ base::DictionaryValue* additional_properties = new base::DictionaryValue();
additional_properties->SetString(schema::kType, schema::kAny);
schema->Set(schema::kAdditionalProperties, additional_properties);
@@ -235,8 +237,8 @@ void JSONSchemaValidatorTestBase::TestObject() {
schema::kBoolean,
schema::kString));
- DictionaryValue* properties = NULL;
- DictionaryValue* bar_property = NULL;
+ base::DictionaryValue* properties = NULL;
+ base::DictionaryValue* bar_property = NULL;
ASSERT_TRUE(schema->GetDictionary(schema::kProperties, &properties));
ASSERT_TRUE(properties->GetDictionary("bar", &bar_property));
@@ -245,7 +247,7 @@ void JSONSchemaValidatorTestBase::TestObject() {
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
instance->Remove("bar", NULL);
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Set("bar", Value::CreateNullValue());
+ instance->Set("bar", base::Value::CreateNullValue());
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL,
"bar", JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -260,16 +262,16 @@ void JSONSchemaValidatorTestBase::TestObject() {
}
void JSONSchemaValidatorTestBase::TestTypeReference() {
- scoped_ptr<ListValue> types(LoadList("reference_types.json"));
+ scoped_ptr<base::ListValue> types(LoadList("reference_types.json"));
ASSERT_TRUE(types.get());
- scoped_ptr<DictionaryValue> schema(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> schema(new base::DictionaryValue());
schema->SetString(schema::kType, schema::kObject);
schema->SetString("properties.foo.type", schema::kString);
schema->SetString("properties.bar.$ref", "Max10Int");
schema->SetString("properties.baz.$ref", "MinLengthString");
- scoped_ptr<DictionaryValue> schema_inline(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> schema_inline(new base::DictionaryValue());
schema_inline->SetString(schema::kType, schema::kObject);
schema_inline->SetString("properties.foo.type", schema::kString);
schema_inline->SetString("properties.bar.id", "NegativeInt");
@@ -277,12 +279,13 @@ void JSONSchemaValidatorTestBase::TestTypeReference() {
schema_inline->SetInteger("properties.bar.maximum", 0);
schema_inline->SetString("properties.baz.$ref", "NegativeInt");
- scoped_ptr<DictionaryValue> instance(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> instance(new base::DictionaryValue());
instance->SetString("foo", "foo");
instance->SetInteger("bar", 4);
instance->SetString("baz", "ab");
- scoped_ptr<DictionaryValue> instance_inline(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> instance_inline(
+ new base::DictionaryValue());
instance_inline->SetString("foo", "foo");
instance_inline->SetInteger("bar", -4);
instance_inline->SetInteger("baz", -2);
@@ -319,16 +322,17 @@ void JSONSchemaValidatorTestBase::TestTypeReference() {
}
void JSONSchemaValidatorTestBase::TestArrayTuple() {
- scoped_ptr<DictionaryValue> schema(LoadDictionary("array_tuple_schema.json"));
+ scoped_ptr<base::DictionaryValue> schema(
+ LoadDictionary("array_tuple_schema.json"));
ASSERT_TRUE(schema.get());
- scoped_ptr<ListValue> instance(new ListValue());
- instance->Append(Value::CreateStringValue("42"));
- instance->Append(Value::CreateIntegerValue(42));
+ scoped_ptr<base::ListValue> instance(new base::ListValue());
+ instance->Append(new base::StringValue("42"));
+ instance->Append(new base::FundamentalValue(42));
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Append(Value::CreateStringValue("anything"));
+ instance->Append(new base::StringValue("anything"));
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kArrayMaxItems, "2"));
@@ -338,21 +342,21 @@ void JSONSchemaValidatorTestBase::TestArrayTuple() {
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "1",
JSONSchemaValidator::kArrayItemRequired);
- instance->Set(0, Value::CreateIntegerValue(42));
- instance->Append(Value::CreateIntegerValue(42));
+ instance->Set(0, new base::FundamentalValue(42));
+ instance->Append(new base::FundamentalValue(42));
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "0",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
schema::kString,
schema::kInteger));
- DictionaryValue* additional_properties = new DictionaryValue();
+ base::DictionaryValue* additional_properties = new base::DictionaryValue();
additional_properties->SetString(schema::kType, schema::kAny);
schema->Set(schema::kAdditionalProperties, additional_properties);
- instance->Set(0, Value::CreateStringValue("42"));
- instance->Append(Value::CreateStringValue("anything"));
+ instance->Set(0, new base::StringValue("42"));
+ instance->Append(new base::StringValue("anything"));
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Set(2, new ListValue());
+ instance->Set(2, new base::ListValue());
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
additional_properties->SetString(schema::kType, schema::kBoolean);
@@ -361,11 +365,11 @@ void JSONSchemaValidatorTestBase::TestArrayTuple() {
JSONSchemaValidator::kInvalidType,
schema::kBoolean,
schema::kArray));
- instance->Set(2, Value::CreateBooleanValue(false));
+ instance->Set(2, new base::FundamentalValue(false));
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- ListValue* items_schema = NULL;
- DictionaryValue* item0_schema = NULL;
+ base::ListValue* items_schema = NULL;
+ base::DictionaryValue* item0_schema = NULL;
ASSERT_TRUE(schema->GetList(schema::kItems, &items_schema));
ASSERT_TRUE(items_schema->GetDictionary(0, &item0_schema));
item0_schema->SetBoolean(schema::kOptional, true);
@@ -373,9 +377,9 @@ void JSONSchemaValidatorTestBase::TestArrayTuple() {
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
// TODO(aa): I think this is inconsistent with the handling of NULL+optional
// for objects.
- instance->Set(0, Value::CreateNullValue());
+ instance->Set(0, base::Value::CreateNullValue());
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Set(0, Value::CreateIntegerValue(42));
+ instance->Set(0, new base::FundamentalValue(42));
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "0",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -384,21 +388,21 @@ void JSONSchemaValidatorTestBase::TestArrayTuple() {
}
void JSONSchemaValidatorTestBase::TestArrayNonTuple() {
- scoped_ptr<DictionaryValue> schema(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> schema(new base::DictionaryValue());
schema->SetString(schema::kType, schema::kArray);
schema->SetString("items.type", schema::kString);
schema->SetInteger(schema::kMinItems, 2);
schema->SetInteger(schema::kMaxItems, 3);
- scoped_ptr<ListValue> instance(new ListValue());
- instance->Append(Value::CreateStringValue("x"));
- instance->Append(Value::CreateStringValue("x"));
+ scoped_ptr<base::ListValue> instance(new base::ListValue());
+ instance->Append(new base::StringValue("x"));
+ instance->Append(new base::StringValue("x"));
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Append(Value::CreateStringValue("x"));
+ instance->Append(new base::StringValue("x"));
ExpectValid(TEST_SOURCE, instance.get(), schema.get(), NULL);
- instance->Append(Value::CreateStringValue("x"));
+ instance->Append(new base::StringValue("x"));
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kArrayMaxItems, "3"));
@@ -410,7 +414,7 @@ void JSONSchemaValidatorTestBase::TestArrayNonTuple() {
JSONSchemaValidator::kArrayMinItems, "2"));
instance->Remove(1, NULL);
- instance->Append(Value::CreateIntegerValue(42));
+ instance->Append(new base::FundamentalValue(42));
ExpectNotValid(TEST_SOURCE, instance.get(), schema.get(), NULL, "1",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -419,61 +423,61 @@ void JSONSchemaValidatorTestBase::TestArrayNonTuple() {
}
void JSONSchemaValidatorTestBase::TestString() {
- scoped_ptr<DictionaryValue> schema(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> schema(new base::DictionaryValue());
schema->SetString(schema::kType, schema::kString);
schema->SetInteger(schema::kMinLength, 1);
schema->SetInteger(schema::kMaxLength, 10);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("x")).get(),
+ scoped_ptr<base::Value>(new base::StringValue("x")).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("xxxxxxxxxx")).get(),
+ scoped_ptr<base::Value>(
+ new base::StringValue("xxxxxxxxxx")).get(),
schema.get(), NULL);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("")).get(),
+ scoped_ptr<base::Value>(new base::StringValue("")).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kStringMinLength, "1"));
ExpectNotValid(
TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("xxxxxxxxxxx")).get(),
+ scoped_ptr<base::Value>(new base::StringValue("xxxxxxxxxxx")).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kStringMaxLength, "10"));
-
}
void JSONSchemaValidatorTestBase::TestNumber() {
- scoped_ptr<DictionaryValue> schema(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> schema(new base::DictionaryValue());
schema->SetString(schema::kType, schema::kNumber);
schema->SetInteger(schema::kMinimum, 1);
schema->SetInteger(schema::kMaximum, 100);
schema->SetInteger("maxDecimal", 2);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(1)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(1)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(50)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(50)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(100)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(100)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(88.88)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(88.88)).get(),
schema.get(), NULL);
ExpectNotValid(
TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(0.5)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(0.5)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kNumberMinimum, "1"));
ExpectNotValid(
TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(100.1)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(100.1)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kNumberMaximum, "100"));
@@ -482,122 +486,128 @@ void JSONSchemaValidatorTestBase::TestNumber() {
void JSONSchemaValidatorTestBase::TestTypeClassifier() {
EXPECT_EQ(std::string(schema::kBoolean),
JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateBooleanValue(true)).get()));
+ scoped_ptr<base::Value>(
+ new base::FundamentalValue(true)).get()));
EXPECT_EQ(std::string(schema::kBoolean),
JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateBooleanValue(false)).get()));
+ scoped_ptr<base::Value>(
+ new base::FundamentalValue(false)).get()));
// It doesn't matter whether the C++ type is 'integer' or 'real'. If the
// number is integral and within the representable range of integers in
// double, it's classified as 'integer'.
EXPECT_EQ(std::string(schema::kInteger),
JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get()));
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get()));
EXPECT_EQ(std::string(schema::kInteger),
JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateIntegerValue(0)).get()));
+ scoped_ptr<base::Value>(new base::FundamentalValue(0)).get()));
EXPECT_EQ(std::string(schema::kInteger),
JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateDoubleValue(42)).get()));
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get()));
EXPECT_EQ(std::string(schema::kInteger),
- JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<Value>(
- Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG))).get()));
+ JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<base::Value>(
+ new base::FundamentalValue(pow(2.0, DBL_MANT_DIG))).get()));
EXPECT_EQ(std::string(schema::kInteger),
- JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<Value>(
- Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG))).get()));
+ JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<base::Value>(
+ new base::FundamentalValue(pow(-2.0, DBL_MANT_DIG))).get()));
// "number" is only used for non-integral numbers, or numbers beyond what
// double can accurately represent.
EXPECT_EQ(std::string(schema::kNumber),
JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get()));
+ scoped_ptr<base::Value>(
+ new base::FundamentalValue(88.8)).get()));
EXPECT_EQ(std::string(schema::kNumber),
- JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<Value>(
- Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG) * 2)).get()));
+ JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<base::Value>(
+ new base::FundamentalValue(pow(2.0, DBL_MANT_DIG) * 2)).get()));
EXPECT_EQ(std::string(schema::kNumber),
- JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<Value>(
- Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG) * 2)).get()));
+ JSONSchemaValidator::GetJSONSchemaType(scoped_ptr<base::Value>(
+ new base::FundamentalValue(
+ pow(-2.0, DBL_MANT_DIG) * 2)).get()));
EXPECT_EQ(std::string(schema::kString),
JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateStringValue("foo")).get()));
+ scoped_ptr<base::Value>(new base::StringValue("foo")).get()));
EXPECT_EQ(std::string(schema::kArray),
JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(new ListValue()).get()));
+ scoped_ptr<base::Value>(new base::ListValue()).get()));
EXPECT_EQ(std::string(schema::kObject),
JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(new DictionaryValue()).get()));
+ scoped_ptr<base::Value>(new base::DictionaryValue()).get()));
EXPECT_EQ(std::string(schema::kNull),
JSONSchemaValidator::GetJSONSchemaType(
- scoped_ptr<Value>(Value::CreateNullValue()).get()));
+ scoped_ptr<base::Value>(base::Value::CreateNullValue()).get()));
}
void JSONSchemaValidatorTestBase::TestTypes() {
- scoped_ptr<DictionaryValue> schema(new DictionaryValue());
+ scoped_ptr<base::DictionaryValue> schema(new base::DictionaryValue());
// valid
schema->SetString(schema::kType, schema::kObject);
- ExpectValid(TEST_SOURCE, scoped_ptr<Value>(new DictionaryValue()).get(),
+ ExpectValid(TEST_SOURCE,
+ scoped_ptr<base::Value>(new base::DictionaryValue()).get(),
schema.get(), NULL);
schema->SetString(schema::kType, schema::kArray);
- ExpectValid(TEST_SOURCE, scoped_ptr<Value>(new ListValue()).get(),
+ ExpectValid(TEST_SOURCE, scoped_ptr<base::Value>(new base::ListValue()).get(),
schema.get(), NULL);
schema->SetString(schema::kType, schema::kString);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("foobar")).get(),
+ scoped_ptr<base::Value>(new base::StringValue("foobar")).get(),
schema.get(), NULL);
schema->SetString(schema::kType, schema::kNumber);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(88.8)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(42)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(0)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(0)).get(),
schema.get(), NULL);
schema->SetString(schema::kType, schema::kInteger);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(42)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(0)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(0)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(
- Value::CreateDoubleValue(pow(2.0, DBL_MANT_DIG))).get(),
+ scoped_ptr<base::Value>(
+ new base::FundamentalValue(pow(2.0, DBL_MANT_DIG))).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(
- Value::CreateDoubleValue(pow(-2.0, DBL_MANT_DIG))).get(),
+ scoped_ptr<base::Value>(
+ new base::FundamentalValue(pow(-2.0, DBL_MANT_DIG))).get(),
schema.get(), NULL);
schema->SetString(schema::kType, schema::kBoolean);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateBooleanValue(false)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(false)).get(),
schema.get(), NULL);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateBooleanValue(true)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(true)).get(),
schema.get(), NULL);
schema->SetString(schema::kType, schema::kNull);
ExpectValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateNullValue()).get(),
+ scoped_ptr<base::Value>(base::Value::CreateNullValue()).get(),
schema.get(), NULL);
// not valid
schema->SetString(schema::kType, schema::kObject);
- ExpectNotValid(TEST_SOURCE, scoped_ptr<Value>(new ListValue()).get(),
+ ExpectNotValid(TEST_SOURCE,
+ scoped_ptr<base::Value>(new base::ListValue()).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -605,7 +615,8 @@ void JSONSchemaValidatorTestBase::TestTypes() {
schema::kArray));
schema->SetString(schema::kType, schema::kObject);
- ExpectNotValid(TEST_SOURCE, scoped_ptr<Value>(Value::CreateNullValue()).get(),
+ ExpectNotValid(TEST_SOURCE,
+ scoped_ptr<base::Value>(base::Value::CreateNullValue()).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -614,7 +625,7 @@ void JSONSchemaValidatorTestBase::TestTypes() {
schema->SetString(schema::kType, schema::kArray);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -623,7 +634,7 @@ void JSONSchemaValidatorTestBase::TestTypes() {
schema->SetString(schema::kType, schema::kString);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(42)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(42)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -632,7 +643,7 @@ void JSONSchemaValidatorTestBase::TestTypes() {
schema->SetString(schema::kType, schema::kNumber);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateStringValue("42")).get(),
+ scoped_ptr<base::Value>(new base::StringValue("42")).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -641,7 +652,8 @@ void JSONSchemaValidatorTestBase::TestTypes() {
schema->SetString(schema::kType, schema::kInteger);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(),
+ scoped_ptr<base::Value>(
+ new base::FundamentalValue(88.8)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -650,7 +662,8 @@ void JSONSchemaValidatorTestBase::TestTypes() {
schema->SetString(schema::kType, schema::kInteger);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateDoubleValue(88.8)).get(),
+ scoped_ptr<base::Value>(
+ new base::FundamentalValue(88.8)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -659,7 +672,7 @@ void JSONSchemaValidatorTestBase::TestTypes() {
schema->SetString(schema::kType, schema::kBoolean);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateIntegerValue(1)).get(),
+ scoped_ptr<base::Value>(new base::FundamentalValue(1)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,
@@ -668,7 +681,8 @@ void JSONSchemaValidatorTestBase::TestTypes() {
schema->SetString(schema::kType, schema::kNull);
ExpectNotValid(TEST_SOURCE,
- scoped_ptr<Value>(Value::CreateBooleanValue(false)).get(),
+ scoped_ptr<base::Value>(
+ new base::FundamentalValue(false)).get(),
schema.get(), NULL, "",
JSONSchemaValidator::FormatErrorMessage(
JSONSchemaValidator::kInvalidType,