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

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

Issue 2230053002: [chromedriver] Added option to make element references W3C compliant. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed presubmit errors. Created 4 years, 4 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/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 27ad54f0f8bcc61c72b8268b8d3264f7e40eb383..694432e4214c60da2c9aa557bc7f02593d6e772c 100644
--- a/chrome/test/chromedriver/chrome/web_view_impl.cc
+++ b/chrome/test/chromedriver/chrome/web_view_impl.cc
@@ -123,11 +123,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())),
@@ -272,12 +274,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())
@@ -316,7 +320,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)
@@ -518,7 +523,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)
@@ -825,15 +830,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