| Index: chrome/test/chromedriver/chrome_impl_unittest.cc
|
| diff --git a/chrome/test/chromedriver/chrome_impl_unittest.cc b/chrome/test/chromedriver/chrome_impl_unittest.cc
|
| index 8b52ad2c78e27d063bb1285d47887db5cfacba3b..3a23839d9cc283742c1e517fb567c0826819dddd 100644
|
| --- a/chrome/test/chromedriver/chrome_impl_unittest.cc
|
| +++ b/chrome/test/chromedriver/chrome_impl_unittest.cc
|
| @@ -185,8 +185,7 @@ TEST(EvaluateScriptAndGetValue, Ok) {
|
| base::DictionaryValue dict;
|
| dict.SetBoolean("wasThrown", false);
|
| dict.SetString("result.type", "integer");
|
| - dict.SetInteger("result.value.status", 0);
|
| - dict.SetInteger("result.value.value", 1);
|
| + dict.SetInteger("result.value", 1);
|
| client.set_result(dict);
|
| Status status = internal::EvaluateScriptAndGetValue(
|
| &client, 0, "", &result);
|
| @@ -196,21 +195,6 @@ TEST(EvaluateScriptAndGetValue, Ok) {
|
| ASSERT_EQ(1, value);
|
| }
|
|
|
| -TEST(EvaluateScriptAndGetValue, ScriptError) {
|
| - scoped_ptr<base::Value> result;
|
| - FakeDevToolsClient client;
|
| - base::DictionaryValue dict;
|
| - dict.SetBoolean("wasThrown", false);
|
| - dict.SetString("result.type", "integer");
|
| - dict.SetInteger("result.value.status", 1);
|
| - dict.SetInteger("result.value.value", 1);
|
| - client.set_result(dict);
|
| - Status status = internal::EvaluateScriptAndGetValue(
|
| - &client, 0, "", &result);
|
| - ASSERT_EQ(1, status.code());
|
| - ASSERT_FALSE(result);
|
| -}
|
| -
|
| TEST(EvaluateScriptAndGetObject, NoObject) {
|
| FakeDevToolsClient client;
|
| base::DictionaryValue dict;
|
| @@ -234,3 +218,31 @@ TEST(EvaluateScriptAndGetObject, Ok) {
|
| &client, 0, "", &object_id).IsOk());
|
| ASSERT_STREQ("id", object_id.c_str());
|
| }
|
| +
|
| +TEST(ParseCallFunctionResult, NotDict) {
|
| + scoped_ptr<base::Value> result;
|
| + base::FundamentalValue value(1);
|
| + ASSERT_NE(kOk, internal::ParseCallFunctionResult(value, &result).code());
|
| +}
|
| +
|
| +TEST(ParseCallFunctionResult, Ok) {
|
| + scoped_ptr<base::Value> result;
|
| + base::DictionaryValue dict;
|
| + dict.SetInteger("status", 0);
|
| + dict.SetInteger("value", 1);
|
| + Status status = internal::ParseCallFunctionResult(dict, &result);
|
| + ASSERT_EQ(kOk, status.code());
|
| + int value;
|
| + ASSERT_TRUE(result && result->GetAsInteger(&value));
|
| + ASSERT_EQ(1, value);
|
| +}
|
| +
|
| +TEST(ParseCallFunctionResult, ScriptError) {
|
| + scoped_ptr<base::Value> result;
|
| + base::DictionaryValue dict;
|
| + dict.SetInteger("status", 1);
|
| + dict.SetInteger("value", 1);
|
| + Status status = internal::ParseCallFunctionResult(dict, &result);
|
| + ASSERT_EQ(1, status.code());
|
| + ASSERT_FALSE(result);
|
| +}
|
|
|