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_commands.h" | 5 #include "chrome/test/chromedriver/element_commands.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 args, | 364 args, |
365 value); | 365 value); |
366 } | 366 } |
367 | 367 |
368 Status ExecuteGetElementLocationOnceScrolledIntoView( | 368 Status ExecuteGetElementLocationOnceScrolledIntoView( |
369 Session* session, | 369 Session* session, |
370 WebView* web_view, | 370 WebView* web_view, |
371 const std::string& element_id, | 371 const std::string& element_id, |
372 const base::DictionaryValue& params, | 372 const base::DictionaryValue& params, |
373 scoped_ptr<base::Value>* value) { | 373 scoped_ptr<base::Value>* value) { |
374 base::ListValue args; | 374 WebPoint location; |
375 args.Append(CreateElement(element_id)); | 375 Status status = ScrollElementIntoView( |
376 return web_view->CallFunction( | 376 session, web_view, element_id, &location); |
377 session->GetCurrentFrameId(), | 377 if (status.IsError()) |
378 webdriver::atoms::asString(webdriver::atoms::GET_LOCATION_IN_VIEW), | 378 return status; |
379 args, | 379 value->reset(CreateValueFrom(location)); |
380 value); | 380 return Status(kOk); |
381 } | 381 } |
382 | 382 |
383 Status ExecuteGetElementSize( | 383 Status ExecuteGetElementSize( |
384 Session* session, | 384 Session* session, |
385 WebView* web_view, | 385 WebView* web_view, |
386 const std::string& element_id, | 386 const std::string& element_id, |
387 const base::DictionaryValue& params, | 387 const base::DictionaryValue& params, |
388 scoped_ptr<base::Value>* value) { | 388 scoped_ptr<base::Value>* value) { |
389 base::ListValue args; | 389 base::ListValue args; |
390 args.Append(CreateElement(element_id)); | 390 args.Append(CreateElement(element_id)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 WebView* web_view, | 430 WebView* web_view, |
431 const std::string& element_id, | 431 const std::string& element_id, |
432 const base::DictionaryValue& params, | 432 const base::DictionaryValue& params, |
433 scoped_ptr<base::Value>* value) { | 433 scoped_ptr<base::Value>* value) { |
434 std::string other_element_id; | 434 std::string other_element_id; |
435 if (!params.GetString("other", &other_element_id)) | 435 if (!params.GetString("other", &other_element_id)) |
436 return Status(kUnknownError, "'other' must be a string"); | 436 return Status(kUnknownError, "'other' must be a string"); |
437 value->reset(new base::FundamentalValue(element_id == other_element_id)); | 437 value->reset(new base::FundamentalValue(element_id == other_element_id)); |
438 return Status(kOk); | 438 return Status(kOk); |
439 } | 439 } |
OLD | NEW |