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; |