| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/test/chromedriver/chrome/web_view_impl.h" | 5 #include "chrome/test/chromedriver/chrome/web_view_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } | 506 } |
| 507 file_list.AppendString(files[i].value()); | 507 file_list.AppendString(files[i].value()); |
| 508 } | 508 } |
| 509 | 509 |
| 510 int context_id; | 510 int context_id; |
| 511 Status status = GetContextIdForFrame(frame_tracker_.get(), frame, | 511 Status status = GetContextIdForFrame(frame_tracker_.get(), frame, |
| 512 &context_id); | 512 &context_id); |
| 513 if (status.IsError()) | 513 if (status.IsError()) |
| 514 return status; | 514 return status; |
| 515 base::ListValue args; | 515 base::ListValue args; |
| 516 args.Append(element.DeepCopy()); | 516 args.Append(element.CreateDeepCopy()); |
| 517 bool found_node; | 517 bool found_node; |
| 518 int node_id; | 518 int node_id; |
| 519 status = internal::GetNodeIdFromFunction( | 519 status = internal::GetNodeIdFromFunction( |
| 520 client_.get(), context_id, "function(element) { return element; }", | 520 client_.get(), context_id, "function(element) { return element; }", |
| 521 args, &found_node, &node_id); | 521 args, &found_node, &node_id); |
| 522 if (status.IsError()) | 522 if (status.IsError()) |
| 523 return status; | 523 return status; |
| 524 if (!found_node) | 524 if (!found_node) |
| 525 return Status(kUnknownError, "no node ID for file input"); | 525 return Status(kUnknownError, "no node ID for file input"); |
| 526 base::DictionaryValue params; | 526 base::DictionaryValue params; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 | 668 |
| 669 Status WebViewImpl::CallAsyncFunctionInternal( | 669 Status WebViewImpl::CallAsyncFunctionInternal( |
| 670 const std::string& frame, | 670 const std::string& frame, |
| 671 const std::string& function, | 671 const std::string& function, |
| 672 const base::ListValue& args, | 672 const base::ListValue& args, |
| 673 bool is_user_supplied, | 673 bool is_user_supplied, |
| 674 const base::TimeDelta& timeout, | 674 const base::TimeDelta& timeout, |
| 675 std::unique_ptr<base::Value>* result) { | 675 std::unique_ptr<base::Value>* result) { |
| 676 base::ListValue async_args; | 676 base::ListValue async_args; |
| 677 async_args.AppendString("return (" + function + ").apply(null, arguments);"); | 677 async_args.AppendString("return (" + function + ").apply(null, arguments);"); |
| 678 async_args.Append(args.DeepCopy()); | 678 async_args.Append(args.CreateDeepCopy()); |
| 679 async_args.AppendBoolean(is_user_supplied); | 679 async_args.AppendBoolean(is_user_supplied); |
| 680 async_args.AppendInteger(timeout.InMilliseconds()); | 680 async_args.AppendInteger(timeout.InMilliseconds()); |
| 681 std::unique_ptr<base::Value> tmp; | 681 std::unique_ptr<base::Value> tmp; |
| 682 Status status = CallFunction( | 682 Status status = CallFunction( |
| 683 frame, kExecuteAsyncScriptScript, async_args, &tmp); | 683 frame, kExecuteAsyncScriptScript, async_args, &tmp); |
| 684 if (status.IsError()) | 684 if (status.IsError()) |
| 685 return status; | 685 return status; |
| 686 | 686 |
| 687 const char kDocUnloadError[] = "document unloaded while waiting for result"; | 687 const char kDocUnloadError[] = "document unloaded while waiting for result"; |
| 688 std::string kQueryResult = base::StringPrintf( | 688 std::string kQueryResult = base::StringPrintf( |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 | 904 |
| 905 if (!cmd_result->GetInteger("nodeId", node_id)) | 905 if (!cmd_result->GetInteger("nodeId", node_id)) |
| 906 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'"); | 906 return Status(kUnknownError, "DOM.requestNode missing int 'nodeId'"); |
| 907 *found_node = true; | 907 *found_node = true; |
| 908 return Status(kOk); | 908 return Status(kOk); |
| 909 } | 909 } |
| 910 | 910 |
| 911 | 911 |
| 912 | 912 |
| 913 } // namespace internal | 913 } // namespace internal |
| OLD | NEW |