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/element_util.h" | 5 #include "chrome/test/chromedriver/element_util.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 arguments.Append(CreateElement(*root_element_id)); | 257 arguments.Append(CreateElement(*root_element_id)); |
258 | 258 |
259 base::TimeTicks start_time = base::TimeTicks::Now(); | 259 base::TimeTicks start_time = base::TimeTicks::Now(); |
260 while (true) { | 260 while (true) { |
261 std::unique_ptr<base::Value> temp; | 261 std::unique_ptr<base::Value> temp; |
262 Status status = web_view->CallFunction( | 262 Status status = web_view->CallFunction( |
263 session->GetCurrentFrameId(), script, arguments, &temp); | 263 session->GetCurrentFrameId(), script, arguments, &temp); |
264 if (status.IsError()) | 264 if (status.IsError()) |
265 return status; | 265 return status; |
266 | 266 |
267 if (!temp->IsType(base::Value::TYPE_NULL)) { | 267 if (!temp->IsType(base::Value::Type::NONE)) { |
268 if (only_one) { | 268 if (only_one) { |
269 value->reset(temp.release()); | 269 value->reset(temp.release()); |
270 return Status(kOk); | 270 return Status(kOk); |
271 } else { | 271 } else { |
272 base::ListValue* result; | 272 base::ListValue* result; |
273 if (!temp->GetAsList(&result)) | 273 if (!temp->GetAsList(&result)) |
274 return Status(kUnknownError, "script returns unexpected result"); | 274 return Status(kUnknownError, "script returns unexpected result"); |
275 if (result->GetSize() > 0U) { | 275 if (result->GetSize() > 0U) { |
276 value->reset(temp.release()); | 276 value->reset(temp.release()); |
277 return Status(kOk); | 277 return Status(kOk); |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 status = ScrollElementRegionIntoViewHelper( | 655 status = ScrollElementRegionIntoViewHelper( |
656 rit->parent_frame_id, web_view, frame_element_id, | 656 rit->parent_frame_id, web_view, frame_element_id, |
657 WebRect(region_offset, region_size), | 657 WebRect(region_offset, region_size), |
658 center, frame_element_id, ®ion_offset); | 658 center, frame_element_id, ®ion_offset); |
659 if (status.IsError()) | 659 if (status.IsError()) |
660 return status; | 660 return status; |
661 } | 661 } |
662 *location = region_offset; | 662 *location = region_offset; |
663 return Status(kOk); | 663 return Status(kOk); |
664 } | 664 } |
OLD | NEW |