diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-18 23:43:11 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-18 23:43:11 +0000 |
commit | a9602de83c13669096f15e07e3f613461c58afbc (patch) | |
tree | 5a0f434b63ef6311b309ec2ca796c58374add0bc /base/json | |
parent | 9d3bd0e747adae3c4caf9ddccf8e08a4de68e3bc (diff) | |
download | chromium_src-a9602de83c13669096f15e07e3f613461c58afbc.zip chromium_src-a9602de83c13669096f15e07e3f613461c58afbc.tar.gz chromium_src-a9602de83c13669096f15e07e3f613461c58afbc.tar.bz2 |
Add support for interacting with the DOM in browser_tests.
BUG=none
TEST=none
Reivew url: http://codereview.chromium.org/660046
Review URL: http://codereview.chromium.org/1051005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42026 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/json')
-rw-r--r-- | base/json/string_escape.cc | 12 | ||||
-rw-r--r-- | base/json/string_escape.h | 7 |
2 files changed, 18 insertions, 1 deletions
diff --git a/base/json/string_escape.cc b/base/json/string_escape.cc index 4e1418c..5bf0b86 100644 --- a/base/json/string_escape.cc +++ b/base/json/string_escape.cc @@ -82,10 +82,22 @@ void JsonDoubleQuote(const std::string& str, JsonDoubleQuoteT(str, put_in_quotes, dst); } +std::string GetDoubleQuotedJson(const std::string& str) { + std::string dst; + JsonDoubleQuote(str, true, &dst); + return dst; +} + void JsonDoubleQuote(const string16& str, bool put_in_quotes, std::string* dst) { JsonDoubleQuoteT(str, put_in_quotes, dst); } +std::string GetDoubleQuotedJson(const string16& str) { + std::string dst; + JsonDoubleQuote(str, true, &dst); + return dst; +} + } // namespace base diff --git a/base/json/string_escape.h b/base/json/string_escape.h index 7d74021..7c64c29 100644 --- a/base/json/string_escape.h +++ b/base/json/string_escape.h @@ -13,7 +13,7 @@ namespace base { -// Escape |str| appropriately for a JSON string litereal, _appending_ the +// Escape |str| appropriately for a JSON string literal, _appending_ the // result to |dst|. This will create unicode escape sequences (\uXXXX). // If |put_in_quotes| is true, the result will be surrounded in double quotes. // The outputted literal, when interpreted by the browser, should result in a @@ -22,10 +22,15 @@ void JsonDoubleQuote(const std::string& str, bool put_in_quotes, std::string* dst); +// Same as above, but always returns the result double quoted. +std::string GetDoubleQuotedJson(const std::string& str); + void JsonDoubleQuote(const string16& str, bool put_in_quotes, std::string* dst); +// Same as above, but always returns the result double quoted. +std::string GetDoubleQuotedJson(const string16& str); } // namespace base |