| Index: chrome/test/base/ui_test_utils.cc
|
| diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
|
| index 3bb8ad30180aeb117bd941e12ea7f3dc6704d00d..92a677ec7e43d1a29c88a492743a2a59dbd35aeb 100644
|
| --- a/chrome/test/base/ui_test_utils.cc
|
| +++ b/chrome/test/base/ui_test_utils.cc
|
| @@ -247,28 +247,13 @@ bool ExecuteJavaScriptHelper(RenderViewHost* render_view_host,
|
| if (!result)
|
| return true;
|
|
|
| - // Wrap |json| in an array before deserializing because valid JSON has an
|
| - // array or an object as the root.
|
| - json.insert(0, "[");
|
| - json.append("]");
|
| -
|
| - scoped_ptr<Value> root_val(
|
| - base::JSONReader::Read(json, base::JSON_ALLOW_TRAILING_COMMAS));
|
| - if (!root_val->IsType(Value::TYPE_LIST)) {
|
| - DLOG(ERROR) << "JSON result is not a list.";
|
| + base::JSONReader reader(base::JSON_ALLOW_TRAILING_COMMAS);
|
| + result->reset(reader.ReadToValue(json));
|
| + if (!result->get()) {
|
| + DLOG(ERROR) << reader.GetErrorMessage();
|
| return false;
|
| }
|
|
|
| - ListValue* list = static_cast<ListValue*>(root_val.get());
|
| - Value* result_val;
|
| - if (!list || !list->GetSize() ||
|
| - // Remove gives us ownership of the value.
|
| - !list->Remove(0, &result_val)) {
|
| - DLOG(ERROR) << "JSON result list is empty.";
|
| - return false;
|
| - }
|
| -
|
| - result->reset(result_val);
|
| return true;
|
| }
|
|
|
|
|