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

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

Issue 2295443003: [chromedriver] Added option to make element references W3C compliant. (Closed)
Patch Set: fix errors introduced during previous rebase Created 4 years, 1 month 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/web_view_impl.h ('k') | chrome/test/chromedriver/chrome_launcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/chrome/web_view_impl.cc
diff --git a/chrome/test/chromedriver/chrome/web_view_impl.cc b/chrome/test/chromedriver/chrome/web_view_impl.cc
index 6ab1f3462e15d3764034a4161d90936b4b4a579c..167151bce9c5095df9a9107226799f6c16960b71 100644
--- a/chrome/test/chromedriver/chrome/web_view_impl.cc
+++ b/chrome/test/chromedriver/chrome/web_view_impl.cc
@@ -125,11 +125,13 @@ const char* GetAsString(KeyEventType type) {
} // namespace
WebViewImpl::WebViewImpl(const std::string& id,
+ const bool w3c_compliant,
const BrowserInfo* browser_info,
std::unique_ptr<DevToolsClient> client,
const DeviceMetrics* device_metrics,
std::string page_load_strategy)
: id_(id),
+ w3c_compliant_(w3c_compliant),
browser_info_(browser_info),
dom_tracker_(new DomTracker(client.get())),
frame_tracker_(new FrameTracker(client.get())),
@@ -274,12 +276,14 @@ Status WebViewImpl::CallFunction(const std::string& frame,
std::unique_ptr<base::Value>* result) {
std::string json;
base::JSONWriter::Write(args, &json);
+ std::string w3c = w3c_compliant_ ? "true" : "false";
// TODO(zachconrad): Second null should be array of shadow host ids.
std::string expression = base::StringPrintf(
- "(%s).apply(null, [null, %s, %s])",
+ "(%s).apply(null, [null, %s, %s, %s])",
kCallFunctionScript,
function.c_str(),
- json.c_str());
+ json.c_str(),
+ w3c.c_str());
std::unique_ptr<base::Value> temp_result;
Status status = EvaluateScript(frame, expression, &temp_result);
if (status.IsError())
@@ -318,7 +322,8 @@ Status WebViewImpl::GetFrameByFunction(const std::string& frame,
bool found_node;
int node_id;
status = internal::GetNodeIdFromFunction(
- client_.get(), context_id, function, args, &found_node, &node_id);
+ client_.get(), context_id, function, args,
+ &found_node, &node_id, w3c_compliant_);
if (status.IsError())
return status;
if (!found_node)
@@ -526,7 +531,7 @@ Status WebViewImpl::SetFileInputFiles(
int node_id;
status = internal::GetNodeIdFromFunction(
client_.get(), context_id, "function(element) { return element; }",
- args, &found_node, &node_id);
+ args, &found_node, &node_id, w3c_compliant_);
if (status.IsError())
return status;
if (!found_node)
@@ -868,15 +873,18 @@ Status GetNodeIdFromFunction(DevToolsClient* client,
const std::string& function,
const base::ListValue& args,
bool* found_node,
- int* node_id) {
+ int* node_id,
+ bool w3c_compliant) {
std::string json;
base::JSONWriter::Write(args, &json);
+ std::string w3c = w3c_compliant ? "true" : "false";
// TODO(zachconrad): Second null should be array of shadow host ids.
std::string expression = base::StringPrintf(
- "(%s).apply(null, [null, %s, %s, true])",
+ "(%s).apply(null, [null, %s, %s, %s, true])",
kCallFunctionScript,
function.c_str(),
- json.c_str());
+ json.c_str(),
+ w3c.c_str());
bool got_object;
std::string element_id;
« no previous file with comments | « chrome/test/chromedriver/chrome/web_view_impl.h ('k') | chrome/test/chromedriver/chrome_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698