| Index: base/test/values_test_util.cc
|
| diff --git a/base/test/values_test_util.cc b/base/test/values_test_util.cc
|
| index a5667f14b81e9700ef6e248fb1a34efb183302fd..0dd99552a0ec1e206179a1fdbf453fe14300236a 100644
|
| --- a/base/test/values_test_util.cc
|
| +++ b/base/test/values_test_util.cc
|
| @@ -2,9 +2,11 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "base/test/values_test_util.h"
|
| +
|
| +#include "base/json/json_reader.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/string_number_conversions.h"
|
| -#include "base/test/values_test_util.h"
|
| #include "base/values.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -58,4 +60,16 @@ void ExpectStringValue(const std::string& expected_str,
|
| EXPECT_EQ(expected_str, actual_str);
|
| }
|
|
|
| +scoped_ptr<Value> ParseJson(base::StringPiece json) {
|
| + std::string error_msg;
|
| + scoped_ptr<Value> result(base::JSONReader::ReadAndReturnError(
|
| + json, base::JSON_ALLOW_TRAILING_COMMAS,
|
| + NULL, &error_msg));
|
| + if (!result) {
|
| + ADD_FAILURE() << "Failed to parse \"" << json << "\": " << error_msg;
|
| + result.reset(Value::CreateNullValue());
|
| + }
|
| + return result.Pass();
|
| +}
|
| +
|
| } // namespace base
|
|
|