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

Unified Diff: base/test/values_test_util.h

Issue 11567027: Add a base::ParseJson() function to help tests construct Values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move ParseJson into base::test Created 8 years 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 | « no previous file | base/test/values_test_util.cc » ('j') | content/renderer/v8_value_converter_impl_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/values_test_util.h
diff --git a/base/test/values_test_util.h b/base/test/values_test_util.h
index f2b5abdcf7af1b317ba289f1ef5000e11457a352..ef4710d91313229d6842218436b46e27a2773625 100644
--- a/base/test/values_test_util.h
+++ b/base/test/values_test_util.h
@@ -7,10 +7,14 @@
#include <string>
+#include "base/memory/scoped_ptr.h"
+#include "base/string_piece.h"
+
namespace base {
class DictionaryValue;
class ListValue;
class StringValue;
+class Value;
// All the functions below expect that the value for the given key in
// the given dictionary equals the given expected value.
@@ -39,6 +43,14 @@ void ExpectDictStringValue(const std::string& expected_value,
void ExpectStringValue(const std::string& expected_str,
StringValue* actual);
+namespace test {
+
+// Parses |json| as JSON, allowing trailing commas, and returns the
+// resulting value. If the json fails to parse, causes an EXPECT
+// failure and returns the Null Value (but never a NULL pointer).
+scoped_ptr<Value> ParseJson(base::StringPiece json);
+
+} // namespace test
} // namespace base
#endif // BASE_TEST_VALUES_TEST_UTIL_H_
« no previous file with comments | « no previous file | base/test/values_test_util.cc » ('j') | content/renderer/v8_value_converter_impl_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698