blob: 665a2d1b2ed5e966e665cb8585db125e90325037 [file] [log] [blame]
Alex Vakulenko6201d2d2014-07-16 14:46:48 -07001// Copyright 2014 The Chromium OS 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#ifndef BUFFET_COMMANDS_UNITTEST_UTILS_H_
6#define BUFFET_COMMANDS_UNITTEST_UTILS_H_
7
8#include <memory>
9#include <string>
10
11#include <base/values.h>
12
13namespace buffet {
14namespace unittests {
15
16// Helper method to create base::Value from a string as a smart pointer.
17// For ease of definition in C++ code, double-quotes in the source definition
18// are replaced with apostrophes.
Alex Vakulenko7c36b672014-07-16 14:50:58 -070019std::unique_ptr<base::Value> CreateValue(const char* json);
Alex Vakulenko6201d2d2014-07-16 14:46:48 -070020
21// Helper method to create a JSON dictionary object from a string.
22std::unique_ptr<base::DictionaryValue> CreateDictionaryValue(const char* json);
23
24// Converts a JSON value to a string. It also converts double-quotes to
25// apostrophes for easy comparisons in C++ source code.
26std::string ValueToString(const base::Value* value);
27
28} // namespace unittests
29} // namespace buffet
30
31#endif // BUFFET_COMMANDS_UNITTEST_UTILS_H_