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/session_commands.h" | 5 #include "chrome/test/chromedriver/session_commands.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 position.SetInteger("x", x); | 470 position.SetInteger("x", x); |
471 position.SetInteger("y", y); | 471 position.SetInteger("y", y); |
472 value->reset(position.DeepCopy()); | 472 value->reset(position.DeepCopy()); |
473 return Status(kOk); | 473 return Status(kOk); |
474 } | 474 } |
475 | 475 |
476 Status ExecuteSetWindowPosition( | 476 Status ExecuteSetWindowPosition( |
477 Session* session, | 477 Session* session, |
478 const base::DictionaryValue& params, | 478 const base::DictionaryValue& params, |
479 scoped_ptr<base::Value>* value) { | 479 scoped_ptr<base::Value>* value) { |
480 double x, y; | 480 double x = 0; |
| 481 double y = 0; |
481 if (!params.GetDouble("x", &x) || !params.GetDouble("y", &y)) | 482 if (!params.GetDouble("x", &x) || !params.GetDouble("y", &y)) |
482 return Status(kUnknownError, "missing or invalid 'x' or 'y'"); | 483 return Status(kUnknownError, "missing or invalid 'x' or 'y'"); |
483 | 484 |
484 ChromeDesktopImpl* desktop = session->chrome->GetAsDesktop(); | 485 ChromeDesktopImpl* desktop = session->chrome->GetAsDesktop(); |
485 if (!desktop) { | 486 if (!desktop) { |
486 return Status( | 487 return Status( |
487 kUnknownError, | 488 kUnknownError, |
488 "command only supported for desktop Chrome without debuggerAddress"); | 489 "command only supported for desktop Chrome without debuggerAddress"); |
489 } | 490 } |
490 | 491 |
(...skipping 30 matching lines...) Expand all Loading... |
521 size.SetInteger("width", width); | 522 size.SetInteger("width", width); |
522 size.SetInteger("height", height); | 523 size.SetInteger("height", height); |
523 value->reset(size.DeepCopy()); | 524 value->reset(size.DeepCopy()); |
524 return Status(kOk); | 525 return Status(kOk); |
525 } | 526 } |
526 | 527 |
527 Status ExecuteSetWindowSize( | 528 Status ExecuteSetWindowSize( |
528 Session* session, | 529 Session* session, |
529 const base::DictionaryValue& params, | 530 const base::DictionaryValue& params, |
530 scoped_ptr<base::Value>* value) { | 531 scoped_ptr<base::Value>* value) { |
531 double width, height; | 532 double width = 0; |
| 533 double height = 0; |
532 if (!params.GetDouble("width", &width) || | 534 if (!params.GetDouble("width", &width) || |
533 !params.GetDouble("height", &height)) | 535 !params.GetDouble("height", &height)) |
534 return Status(kUnknownError, "missing or invalid 'width' or 'height'"); | 536 return Status(kUnknownError, "missing or invalid 'width' or 'height'"); |
535 | 537 |
536 ChromeDesktopImpl* desktop = session->chrome->GetAsDesktop(); | 538 ChromeDesktopImpl* desktop = session->chrome->GetAsDesktop(); |
537 if (!desktop) { | 539 if (!desktop) { |
538 return Status( | 540 return Status( |
539 kUnknownError, | 541 kUnknownError, |
540 "command only supported for desktop Chrome without debuggerAddress"); | 542 "command only supported for desktop Chrome without debuggerAddress"); |
541 } | 543 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 Status ExecuteSetAutoReporting( | 647 Status ExecuteSetAutoReporting( |
646 Session* session, | 648 Session* session, |
647 const base::DictionaryValue& params, | 649 const base::DictionaryValue& params, |
648 scoped_ptr<base::Value>* value) { | 650 scoped_ptr<base::Value>* value) { |
649 bool enabled; | 651 bool enabled; |
650 if (!params.GetBoolean("enabled", &enabled)) | 652 if (!params.GetBoolean("enabled", &enabled)) |
651 return Status(kUnknownError, "missing parameter 'enabled'"); | 653 return Status(kUnknownError, "missing parameter 'enabled'"); |
652 session->auto_reporting_enabled = enabled; | 654 session->auto_reporting_enabled = enabled; |
653 return Status(kOk); | 655 return Status(kOk); |
654 } | 656 } |
OLD | NEW |