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

Unified Diff: tools/json_schema_compiler/test/test_util.cc

Issue 11827026: Overhaul JSON Schema Compiler to support a number of features required to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
Index: tools/json_schema_compiler/test/test_util.cc
diff --git a/tools/json_schema_compiler/test/test_util.cc b/tools/json_schema_compiler/test/test_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4c10c3ac6acb3cfec61f67042df78615870cc401
--- /dev/null
+++ b/tools/json_schema_compiler/test/test_util.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tools/json_schema_compiler/test/test_util.h"
+
+#include "base/values.h"
+
+namespace json_schema_compiler {
+namespace test_util {
+
+scoped_ptr<base::DictionaryValue> ValueMapToDictionary(
Yoyo Zhou 2013/01/15 01:49:25 Why are these converters in test_util? You've used
not at google - send to devlin 2013/01/15 21:47:27 Yeah, I'll delete.
+ const std::map<std::string, linked_ptr<base::Value> >& values) {
+ scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
+ for (std::map<std::string, linked_ptr<base::Value> >::const_iterator it =
+ values.begin();
+ it != values.end(); ++it) {
+ dict->SetWithoutPathExpansion(it->first, it->second->DeepCopy());
+ }
+ return dict.Pass();
+}
+
+std::map<std::string, linked_ptr<base::Value> > DictionaryToValueMap(
+ const base::DictionaryValue& dict) {
+ std::map<std::string, linked_ptr<base::Value> > values;
+ for (DictionaryValue::Iterator it(dict); it.HasNext(); it.Advance())
+ values[it.key()] = make_linked_ptr(it.value().DeepCopy());
+ return values;
+}
+
+} // namespace test_util
+} // namespace json_schema_compiler

Powered by Google App Engine
This is Rietveld 408576698