Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4099)

Unified Diff: chrome/common/extensions/api/extension_api_unittest.cc

Issue 10381089: Revert 136296 - Make all extension api types fully qualified. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/api/extension_api.cc ('k') | chrome/common/extensions/api/pageAction.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/common/extensions/api/extension_api.cc ('k') | chrome/common/extensions/api/pageAction.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698