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

Unified Diff: chrome/test/chromedriver/chrome_impl.cc

Issue 12052004: [chromedriver] Create release script and handle Chrome/ChromeDriver versions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 11 months 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 | « chrome/test/chromedriver/chrome_impl.h ('k') | chrome/test/chromedriver/chrome_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/chrome_impl.cc
diff --git a/chrome/test/chromedriver/chrome_impl.cc b/chrome/test/chromedriver/chrome_impl.cc
index add517eb344afaacb853764689dbc02ee5f7d189..3751146b7408a15389d2caa4ee6f5129adc8a7e2 100644
--- a/chrome/test/chromedriver/chrome_impl.cc
+++ b/chrome/test/chromedriver/chrome_impl.cc
@@ -129,7 +129,12 @@ Status ChromeImpl::CallFunction(const std::string& frame,
kCallFunctionScript,
function.c_str(),
json.c_str());
- return EvaluateScript(frame, expression, result);
+ scoped_ptr<base::Value> temp_result;
+ Status status = EvaluateScript(frame, expression, &temp_result);
+ if (status.IsError())
+ return status;
+
+ return internal::ParseCallFunctionResult(*temp_result, result);
}
Status ChromeImpl::GetFrameByFunction(const std::string& frame,
@@ -243,20 +248,32 @@ Status EvaluateScriptAndGetValue(DevToolsClient* client,
if (type == "undefined") {
result->reset(base::Value::CreateNullValue());
} else {
- int status_code;
- if (!temp_result->GetInteger("value.status", &status_code)) {
- return Status(kUnknownError,
- "Runtime.evaluate missing int 'value.status'");
- }
- if (status_code != kOk)
- return Status(static_cast<StatusCode>(status_code));
- base::Value* unscoped_value;
- if (!temp_result->Get("value.value", &unscoped_value)) {
- return Status(kUnknownError,
- "Runtime.evaluate missing 'value.value'");
- }
- result->reset(unscoped_value->DeepCopy());
+ base::Value* value;
+ if (!temp_result->Get("value", &value))
+ return Status(kUnknownError, "Runtime.evaluate missing 'value'");
+ result->reset(value->DeepCopy());
+ }
+ return Status(kOk);
+}
+
+Status ParseCallFunctionResult(const base::Value& temp_result,
+ scoped_ptr<base::Value>* result) {
+ const base::DictionaryValue* dict;
+ if (!temp_result.GetAsDictionary(&dict))
+ return Status(kUnknownError, "call function result must be a dictionary");
+ int status_code;
+ if (!dict->GetInteger("status", &status_code)) {
+ return Status(kUnknownError,
+ "call function result missing int 'status'");
+ }
+ if (status_code != kOk)
+ return Status(static_cast<StatusCode>(status_code));
+ const base::Value* unscoped_value;
+ if (!dict->Get("value", &unscoped_value)) {
+ return Status(kUnknownError,
+ "call function result missing 'value'");
}
+ result->reset(unscoped_value->DeepCopy());
return Status(kOk);
}
« no previous file with comments | « chrome/test/chromedriver/chrome_impl.h ('k') | chrome/test/chromedriver/chrome_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698