| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/logging.h" // For CHECK macros. | 13 #include "base/logging.h" // For CHECK macros. |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/strings/string_util.h" |
| 15 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 16 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "base/values.h" | 19 #include "base/values.h" |
| 19 #include "chrome/test/chromedriver/basic_types.h" | 20 #include "chrome/test/chromedriver/basic_types.h" |
| 20 #include "chrome/test/chromedriver/capabilities.h" | 21 #include "chrome/test/chromedriver/capabilities.h" |
| 21 #include "chrome/test/chromedriver/chrome/automation_extension.h" | 22 #include "chrome/test/chromedriver/chrome/automation_extension.h" |
| 22 #include "chrome/test/chromedriver/chrome/browser_info.h" | 23 #include "chrome/test/chromedriver/chrome/browser_info.h" |
| 23 #include "chrome/test/chromedriver/chrome/chrome.h" | 24 #include "chrome/test/chromedriver/chrome/chrome.h" |
| 24 #include "chrome/test/chromedriver/chrome/chrome_android_impl.h" | 25 #include "chrome/test/chromedriver/chrome/chrome_android_impl.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 55 const int k2GThroughput = 250 * 1024; | 56 const int k2GThroughput = 250 * 1024; |
| 56 | 57 |
| 57 const char kWindowHandlePrefix[] = "CDwindow-"; | 58 const char kWindowHandlePrefix[] = "CDwindow-"; |
| 58 | 59 |
| 59 std::string WebViewIdToWindowHandle(const std::string& web_view_id) { | 60 std::string WebViewIdToWindowHandle(const std::string& web_view_id) { |
| 60 return kWindowHandlePrefix + web_view_id; | 61 return kWindowHandlePrefix + web_view_id; |
| 61 } | 62 } |
| 62 | 63 |
| 63 bool WindowHandleToWebViewId(const std::string& window_handle, | 64 bool WindowHandleToWebViewId(const std::string& window_handle, |
| 64 std::string* web_view_id) { | 65 std::string* web_view_id) { |
| 65 if (window_handle.find(kWindowHandlePrefix) != 0u) | 66 if (!base::StartsWith(window_handle, kWindowHandlePrefix, |
| 67 base::CompareCase::SENSITIVE)) { |
| 66 return false; | 68 return false; |
| 67 *web_view_id = window_handle.substr( | 69 } |
| 68 std::string(kWindowHandlePrefix).length()); | 70 *web_view_id = window_handle.substr(sizeof(kWindowHandlePrefix) - 1); |
| 69 return true; | 71 return true; |
| 70 } | 72 } |
| 71 | 73 |
| 72 } // namespace | 74 } // namespace |
| 73 | 75 |
| 74 InitSessionParams::InitSessionParams( | 76 InitSessionParams::InitSessionParams( |
| 75 scoped_refptr<URLRequestContextGetter> context_getter, | 77 scoped_refptr<URLRequestContextGetter> context_getter, |
| 76 const SyncWebSocketFactory& socket_factory, | 78 const SyncWebSocketFactory& socket_factory, |
| 77 DeviceManager* device_manager, | 79 DeviceManager* device_manager, |
| 78 PortServer* port_server, | 80 PortServer* port_server, |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 794 |
| 793 Status ExecuteSetAutoReporting(Session* session, | 795 Status ExecuteSetAutoReporting(Session* session, |
| 794 const base::DictionaryValue& params, | 796 const base::DictionaryValue& params, |
| 795 std::unique_ptr<base::Value>* value) { | 797 std::unique_ptr<base::Value>* value) { |
| 796 bool enabled; | 798 bool enabled; |
| 797 if (!params.GetBoolean("enabled", &enabled)) | 799 if (!params.GetBoolean("enabled", &enabled)) |
| 798 return Status(kUnknownError, "missing parameter 'enabled'"); | 800 return Status(kUnknownError, "missing parameter 'enabled'"); |
| 799 session->auto_reporting_enabled = enabled; | 801 session->auto_reporting_enabled = enabled; |
| 800 return Status(kOk); | 802 return Status(kOk); |
| 801 } | 803 } |
| OLD | NEW |