| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 caps->SetString("browserName", "chrome"); | 74 caps->SetString("browserName", "chrome"); |
| 75 caps->SetString("version", chrome->GetBrowserInfo()->browser_version); | 75 caps->SetString("version", chrome->GetBrowserInfo()->browser_version); |
| 76 caps->SetString("chrome.chromedriverVersion", kChromeDriverVersion); | 76 caps->SetString("chrome.chromedriverVersion", kChromeDriverVersion); |
| 77 caps->SetString("platform", chrome->GetOperatingSystemName()); | 77 caps->SetString("platform", chrome->GetOperatingSystemName()); |
| 78 caps->SetBoolean("javascriptEnabled", true); | 78 caps->SetBoolean("javascriptEnabled", true); |
| 79 caps->SetBoolean("takesScreenshot", true); | 79 caps->SetBoolean("takesScreenshot", true); |
| 80 caps->SetBoolean("takesHeapSnapshot", true); | 80 caps->SetBoolean("takesHeapSnapshot", true); |
| 81 caps->SetBoolean("handlesAlerts", true); | 81 caps->SetBoolean("handlesAlerts", true); |
| 82 caps->SetBoolean("databaseEnabled", false); | 82 caps->SetBoolean("databaseEnabled", false); |
| 83 caps->SetBoolean("locationContextEnabled", true); | 83 caps->SetBoolean("locationContextEnabled", true); |
| 84 caps->SetBoolean("mobileEmulationEnabled", |
| 85 chrome->IsMobileEmulationEnabled()); |
| 84 caps->SetBoolean("applicationCacheEnabled", false); | 86 caps->SetBoolean("applicationCacheEnabled", false); |
| 85 caps->SetBoolean("browserConnectionEnabled", false); | 87 caps->SetBoolean("browserConnectionEnabled", false); |
| 86 caps->SetBoolean("cssSelectorsEnabled", true); | 88 caps->SetBoolean("cssSelectorsEnabled", true); |
| 87 caps->SetBoolean("webStorageEnabled", true); | 89 caps->SetBoolean("webStorageEnabled", true); |
| 88 caps->SetBoolean("rotatable", false); | 90 caps->SetBoolean("rotatable", false); |
| 89 caps->SetBoolean("acceptSslCerts", true); | 91 caps->SetBoolean("acceptSslCerts", true); |
| 90 caps->SetBoolean("nativeEvents", true); | 92 caps->SetBoolean("nativeEvents", true); |
| 91 scoped_ptr<base::DictionaryValue> chrome_caps(new base::DictionaryValue()); | 93 scoped_ptr<base::DictionaryValue> chrome_caps(new base::DictionaryValue()); |
| 92 if (chrome->GetAsDesktop()) { | 94 if (chrome->GetAsDesktop()) { |
| 93 chrome_caps->SetString( | 95 chrome_caps->SetString( |
| 94 "userDataDir", | 96 "userDataDir", |
| 95 chrome->GetAsDesktop()->command().GetSwitchValueNative( | 97 chrome->GetAsDesktop()->command().GetSwitchValueNative( |
| 96 "user-data-dir")); | 98 "user-data-dir")); |
| 97 } | 99 } |
| 98 caps->Set("chrome", chrome_caps.release()); | 100 caps->Set("chrome", chrome_caps.release()); |
| 99 return caps.Pass(); | 101 return caps.Pass(); |
| 100 } | 102 } |
| 101 | 103 |
| 102 | |
| 103 Status InitSessionHelper( | 104 Status InitSessionHelper( |
| 104 const InitSessionParams& bound_params, | 105 const InitSessionParams& bound_params, |
| 105 Session* session, | 106 Session* session, |
| 106 const base::DictionaryValue& params, | 107 const base::DictionaryValue& params, |
| 107 scoped_ptr<base::Value>* value) { | 108 scoped_ptr<base::Value>* value) { |
| 108 session->driver_log.reset( | 109 session->driver_log.reset( |
| 109 new WebDriverLog(WebDriverLog::kDriverType, Log::kAll)); | 110 new WebDriverLog(WebDriverLog::kDriverType, Log::kAll)); |
| 110 const base::DictionaryValue* desired_caps; | 111 const base::DictionaryValue* desired_caps; |
| 111 if (!params.GetDictionary("desiredCapabilities", &desired_caps)) | 112 if (!params.GetDictionary("desiredCapabilities", &desired_caps)) |
| 112 return Status(kUnknownError, "cannot find dict 'desiredCapabilities'"); | 113 return Status(kUnknownError, "cannot find dict 'desiredCapabilities'"); |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 Status ExecuteSetAutoReporting( | 645 Status ExecuteSetAutoReporting( |
| 645 Session* session, | 646 Session* session, |
| 646 const base::DictionaryValue& params, | 647 const base::DictionaryValue& params, |
| 647 scoped_ptr<base::Value>* value) { | 648 scoped_ptr<base::Value>* value) { |
| 648 bool enabled; | 649 bool enabled; |
| 649 if (!params.GetBoolean("enabled", &enabled)) | 650 if (!params.GetBoolean("enabled", &enabled)) |
| 650 return Status(kUnknownError, "missing parameter 'enabled'"); | 651 return Status(kUnknownError, "missing parameter 'enabled'"); |
| 651 session->auto_reporting_enabled = enabled; | 652 session->auto_reporting_enabled = enabled; |
| 652 return Status(kOk); | 653 return Status(kOk); |
| 653 } | 654 } |
| OLD | NEW |