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/capabilities.h" | 5 #include "chrome/test/chromedriver/capabilities.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 parser_map["forceDevToolsScreenshot"] = base::Bind( | 467 parser_map["forceDevToolsScreenshot"] = base::Bind( |
468 &ParseBoolean, &capabilities->force_devtools_screenshot); | 468 &ParseBoolean, &capabilities->force_devtools_screenshot); |
469 parser_map["loadAsync"] = base::Bind(&IgnoreDeprecatedOption, "loadAsync"); | 469 parser_map["loadAsync"] = base::Bind(&IgnoreDeprecatedOption, "loadAsync"); |
470 parser_map["localState"] = | 470 parser_map["localState"] = |
471 base::Bind(&ParseDict, &capabilities->local_state); | 471 base::Bind(&ParseDict, &capabilities->local_state); |
472 parser_map["logPath"] = base::Bind(&ParseLogPath); | 472 parser_map["logPath"] = base::Bind(&ParseLogPath); |
473 parser_map["minidumpPath"] = | 473 parser_map["minidumpPath"] = |
474 base::Bind(&ParseString, &capabilities->minidump_path); | 474 base::Bind(&ParseString, &capabilities->minidump_path); |
475 parser_map["mobileEmulation"] = base::Bind(&ParseMobileEmulation); | 475 parser_map["mobileEmulation"] = base::Bind(&ParseMobileEmulation); |
476 parser_map["prefs"] = base::Bind(&ParseDict, &capabilities->prefs); | 476 parser_map["prefs"] = base::Bind(&ParseDict, &capabilities->prefs); |
| 477 parser_map["useAutomationExtension"] = |
| 478 base::Bind(&ParseBoolean, &capabilities->use_automation_extension); |
477 } | 479 } |
478 | 480 |
479 for (base::DictionaryValue::Iterator it(*chrome_options); !it.IsAtEnd(); | 481 for (base::DictionaryValue::Iterator it(*chrome_options); !it.IsAtEnd(); |
480 it.Advance()) { | 482 it.Advance()) { |
481 if (parser_map.find(it.key()) == parser_map.end()) { | 483 if (parser_map.find(it.key()) == parser_map.end()) { |
482 return Status(kUnknownError, | 484 return Status(kUnknownError, |
483 "unrecognized chrome option: " + it.key()); | 485 "unrecognized chrome option: " + it.key()); |
484 } | 486 } |
485 Status status = parser_map[it.key()].Run(it.value(), capabilities); | 487 Status status = parser_map[it.key()].Run(it.value(), capabilities); |
486 if (status.IsError()) | 488 if (status.IsError()) |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 trace_categories(), | 609 trace_categories(), |
608 buffer_usage_reporting_interval(1000) {} | 610 buffer_usage_reporting_interval(1000) {} |
609 | 611 |
610 PerfLoggingPrefs::~PerfLoggingPrefs() {} | 612 PerfLoggingPrefs::~PerfLoggingPrefs() {} |
611 | 613 |
612 Capabilities::Capabilities() | 614 Capabilities::Capabilities() |
613 : android_use_running_app(false), | 615 : android_use_running_app(false), |
614 detach(false), | 616 detach(false), |
615 force_devtools_screenshot(true), | 617 force_devtools_screenshot(true), |
616 page_load_strategy(PageLoadStrategy::kNormal), | 618 page_load_strategy(PageLoadStrategy::kNormal), |
617 network_emulation_enabled(false) {} | 619 network_emulation_enabled(false), |
| 620 use_automation_extension(true) {} |
618 | 621 |
619 Capabilities::~Capabilities() {} | 622 Capabilities::~Capabilities() {} |
620 | 623 |
621 bool Capabilities::IsAndroid() const { | 624 bool Capabilities::IsAndroid() const { |
622 return !android_package.empty(); | 625 return !android_package.empty(); |
623 } | 626 } |
624 | 627 |
625 bool Capabilities::IsRemoteBrowser() const { | 628 bool Capabilities::IsRemoteBrowser() const { |
626 return debugger_address.IsValid(); | 629 return debugger_address.IsValid(); |
627 } | 630 } |
(...skipping 29 matching lines...) Expand all Loading... |
657 if (iter == logging_prefs.end() || iter->second == Log::kOff) { | 660 if (iter == logging_prefs.end() || iter->second == Log::kOff) { |
658 const base::DictionaryValue* chrome_options = NULL; | 661 const base::DictionaryValue* chrome_options = NULL; |
659 if (desired_caps.GetDictionary("chromeOptions", &chrome_options) && | 662 if (desired_caps.GetDictionary("chromeOptions", &chrome_options) && |
660 chrome_options->HasKey("perfLoggingPrefs")) { | 663 chrome_options->HasKey("perfLoggingPrefs")) { |
661 return Status(kUnknownError, "perfLoggingPrefs specified, " | 664 return Status(kUnknownError, "perfLoggingPrefs specified, " |
662 "but performance logging was not enabled"); | 665 "but performance logging was not enabled"); |
663 } | 666 } |
664 } | 667 } |
665 return Status(kOk); | 668 return Status(kOk); |
666 } | 669 } |
OLD | NEW |