OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "tools/json_schema_compiler/test/test_util.h" | |
6 | |
7 #include "base/values.h" | |
8 | |
9 namespace json_schema_compiler { | |
10 namespace test_util { | |
11 | |
12 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.
| |
13 const std::map<std::string, linked_ptr<base::Value> >& values) { | |
14 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | |
15 for (std::map<std::string, linked_ptr<base::Value> >::const_iterator it = | |
16 values.begin(); | |
17 it != values.end(); ++it) { | |
18 dict->SetWithoutPathExpansion(it->first, it->second->DeepCopy()); | |
19 } | |
20 return dict.Pass(); | |
21 } | |
22 | |
23 std::map<std::string, linked_ptr<base::Value> > DictionaryToValueMap( | |
24 const base::DictionaryValue& dict) { | |
25 std::map<std::string, linked_ptr<base::Value> > values; | |
26 for (DictionaryValue::Iterator it(dict); it.HasNext(); it.Advance()) | |
27 values[it.key()] = make_linked_ptr(it.value().DeepCopy()); | |
28 return values; | |
29 } | |
30 | |
31 } // namespace test_util | |
32 } // namespace json_schema_compiler | |
OLD | NEW |