Index: chrome/common/extensions/api/extension_api_unittest.cc |
=================================================================== |
--- chrome/common/extensions/api/extension_api_unittest.cc (revision 136322) |
+++ chrome/common/extensions/api/extension_api_unittest.cc (working copy) |
@@ -416,74 +416,5 @@ |
} |
} |
-static void GetDictionaryFromList(const DictionaryValue* schema, |
- const std::string& list_name, |
- const int list_index, |
- DictionaryValue** out) { |
- ListValue* list; |
- EXPECT_TRUE(schema->GetList(list_name, &list)); |
- EXPECT_TRUE(list->GetDictionary(list_index, out)); |
-} |
- |
-TEST(ExtensionAPI, TypesHaveNamespace) { |
- FilePath manifest_path; |
- PathService::Get(chrome::DIR_TEST_DATA, &manifest_path); |
- manifest_path = manifest_path.AppendASCII("extensions") |
- .AppendASCII("extension_api_unittest") |
- .AppendASCII("types_have_namespace.json"); |
- |
- std::string manifest_str; |
- ASSERT_TRUE(file_util::ReadFileToString(manifest_path, &manifest_str)) |
- << "Failed to load: " << manifest_path.value(); |
- |
- ExtensionAPI api; |
- api.RegisterSchema("test.foo", manifest_str); |
- api.LoadAllSchemas(); |
- |
- const DictionaryValue* schema = api.GetSchema("test.foo"); |
- |
- DictionaryValue* dict; |
- DictionaryValue* sub_dict; |
- std::string type; |
- |
- GetDictionaryFromList(schema, "types", 0, &dict); |
- EXPECT_TRUE(dict->GetString("id", &type)); |
- EXPECT_EQ("test.foo.TestType", type); |
- EXPECT_TRUE(dict->GetString("customBindings", &type)); |
- EXPECT_EQ("test.foo.TestType", type); |
- EXPECT_TRUE(dict->GetDictionary("properties", &sub_dict)); |
- DictionaryValue* property; |
- EXPECT_TRUE(sub_dict->GetDictionary("foo", &property)); |
- EXPECT_TRUE(property->GetString("$ref", &type)); |
- EXPECT_EQ("test.foo.OtherType", type); |
- EXPECT_TRUE(sub_dict->GetDictionary("bar", &property)); |
- EXPECT_TRUE(property->GetString("$ref", &type)); |
- EXPECT_EQ("fully.qualified.Type", type); |
- |
- GetDictionaryFromList(schema, "functions", 0, &dict); |
- GetDictionaryFromList(dict, "parameters", 0, &sub_dict); |
- EXPECT_TRUE(sub_dict->GetString("$ref", &type)); |
- EXPECT_EQ("test.foo.TestType", type); |
- EXPECT_TRUE(dict->GetDictionary("returns", &sub_dict)); |
- EXPECT_TRUE(sub_dict->GetString("$ref", &type)); |
- EXPECT_EQ("fully.qualified.Type", type); |
- |
- GetDictionaryFromList(schema, "functions", 1, &dict); |
- GetDictionaryFromList(dict, "parameters", 0, &sub_dict); |
- EXPECT_TRUE(sub_dict->GetString("$ref", &type)); |
- EXPECT_EQ("fully.qualified.Type", type); |
- EXPECT_TRUE(dict->GetDictionary("returns", &sub_dict)); |
- EXPECT_TRUE(sub_dict->GetString("$ref", &type)); |
- EXPECT_EQ("test.foo.TestType", type); |
- |
- GetDictionaryFromList(schema, "events", 0, &dict); |
- GetDictionaryFromList(dict, "parameters", 0, &sub_dict); |
- EXPECT_TRUE(sub_dict->GetString("$ref", &type)); |
- EXPECT_EQ("test.foo.TestType", type); |
- GetDictionaryFromList(dict, "parameters", 1, &sub_dict); |
- EXPECT_TRUE(sub_dict->GetString("$ref", &type)); |
- EXPECT_EQ("fully.qualified.Type", type); |
-} |
- |
} // namespace |
} // namespace extensions |