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 "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 const std::string& element_id, | 331 const std::string& element_id, |
332 const std::string& attribute_name, | 332 const std::string& attribute_name, |
333 const std::string& attribute_value, | 333 const std::string& attribute_value, |
334 bool* is_equal) { | 334 bool* is_equal) { |
335 scoped_ptr<base::Value> result; | 335 scoped_ptr<base::Value> result; |
336 Status status = GetElementAttribute( | 336 Status status = GetElementAttribute( |
337 session, web_view, element_id, attribute_name, &result); | 337 session, web_view, element_id, attribute_name, &result); |
338 if (status.IsError()) | 338 if (status.IsError()) |
339 return status; | 339 return status; |
340 std::string actual_value; | 340 std::string actual_value; |
341 if (result->GetAsString(&actual_value)) { | 341 if (result->GetAsString(&actual_value)) |
342 *is_equal = | 342 *is_equal = LowerCaseEqualsASCII(actual_value, attribute_value.c_str()); |
343 base::LowerCaseEqualsASCII(actual_value, attribute_value.c_str()); | 343 else |
344 } else { | |
345 *is_equal = false; | 344 *is_equal = false; |
346 } | |
347 return status; | 345 return status; |
348 } | 346 } |
349 | 347 |
350 Status GetElementClickableLocation( | 348 Status GetElementClickableLocation( |
351 Session* session, | 349 Session* session, |
352 WebView* web_view, | 350 WebView* web_view, |
353 const std::string& element_id, | 351 const std::string& element_id, |
354 WebPoint* location) { | 352 WebPoint* location) { |
355 std::string tag_name; | 353 std::string tag_name; |
356 Status status = GetElementTagName(session, web_view, element_id, &tag_name); | 354 Status status = GetElementTagName(session, web_view, element_id, &tag_name); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 status = ScrollElementRegionIntoViewHelper( | 650 status = ScrollElementRegionIntoViewHelper( |
653 rit->parent_frame_id, web_view, frame_element_id, | 651 rit->parent_frame_id, web_view, frame_element_id, |
654 WebRect(region_offset, region_size), | 652 WebRect(region_offset, region_size), |
655 center, frame_element_id, ®ion_offset); | 653 center, frame_element_id, ®ion_offset); |
656 if (status.IsError()) | 654 if (status.IsError()) |
657 return status; | 655 return status; |
658 } | 656 } |
659 *location = region_offset; | 657 *location = region_offset; |
660 return Status(kOk); | 658 return Status(kOk); |
661 } | 659 } |
OLD | NEW |