Chromium Code Reviews| 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..19ffd03ceb908389991e6fa891cc7d6fbeaa776d 100644 |
| --- a/chrome/test/chromedriver/chrome/web_view_impl.cc |
| +++ b/chrome/test/chromedriver/chrome/web_view_impl.cc |
| @@ -126,8 +126,10 @@ WebViewImpl::WebViewImpl(const std::string& id, |
| const BrowserInfo* browser_info, |
| std::unique_ptr<DevToolsClient> client, |
| const DeviceMetrics* device_metrics, |
| - std::string page_load_strategy) |
| + std::string page_load_strategy, |
| + const bool w3c_compliant) |
|
samuong
2016/08/11 18:13:20
nit: move the |w3c_compliant| parameter up to the
roisinmcl
2016/08/13 01:47:26
Done.
|
| : 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; |