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

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

Issue 12226026: [ChromeDriver] Select the main frame if a non-existant child frame is targeted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 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/commands_unittest.cc ('k') | chrome/test/chromedriver/run_py_tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/devtools_client_impl.cc
diff --git a/chrome/test/chromedriver/devtools_client_impl.cc b/chrome/test/chromedriver/devtools_client_impl.cc
index e3eca4f8d647bd206ae526a54ac1b84009c98968..cbebceb0ecfc344867cd34891f4ae5008403be56 100644
--- a/chrome/test/chromedriver/devtools_client_impl.cc
+++ b/chrome/test/chromedriver/devtools_client_impl.cc
@@ -14,6 +14,26 @@
#include "chrome/test/chromedriver/net/url_request_context_getter.h"
#include "chrome/test/chromedriver/status.h"
+namespace {
+
+const char* kInspectorContextError =
+ "Execution context with given id not found.";
+
+Status ParseInspectorError(const std::string& error_json) {
+ scoped_ptr<base::Value> error(base::JSONReader::Read(error_json));
+ base::DictionaryValue* error_dict;
+ if (!error || !error->GetAsDictionary(&error_dict))
+ return Status(kUnknownError, "inspector error with no error message");
+ std::string error_message;
+ if (error_dict->GetString("message", &error_message) &&
+ error_message == kInspectorContextError) {
+ return Status(kNoSuchFrame);
+ }
+ return Status(kUnknownError, "unhandled inspector error: " + error_json);
+}
+
+} // namespace
+
namespace internal {
InspectorEvent::InspectorEvent() {}
@@ -160,7 +180,8 @@ Status DevToolsClientImpl::ReceiveNextMessage(
} else if (response->result) {
cmd_response_map_[response->id] = response->result.release();
} else {
- return Status(kUnknownError, "inspector error: " + response->error);
+ cmd_response_map_.erase(response->id);
+ return ParseInspectorError(response->error);
}
}
return Status(kOk);
« no previous file with comments | « chrome/test/chromedriver/commands_unittest.cc ('k') | chrome/test/chromedriver/run_py_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698