Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: chrome/test/chromedriver/session_commands.cc

Issue 2137503002: Revert of Replace string::find(prefix) == 0 pattern with base::StartsWith(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
16 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
17 #include "base/synchronization/waitable_event.h" 16 #include "base/synchronization/waitable_event.h"
18 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
19 #include "base/values.h" 18 #include "base/values.h"
20 #include "chrome/test/chromedriver/basic_types.h" 19 #include "chrome/test/chromedriver/basic_types.h"
21 #include "chrome/test/chromedriver/capabilities.h" 20 #include "chrome/test/chromedriver/capabilities.h"
22 #include "chrome/test/chromedriver/chrome/automation_extension.h" 21 #include "chrome/test/chromedriver/chrome/automation_extension.h"
23 #include "chrome/test/chromedriver/chrome/browser_info.h" 22 #include "chrome/test/chromedriver/chrome/browser_info.h"
24 #include "chrome/test/chromedriver/chrome/chrome.h" 23 #include "chrome/test/chromedriver/chrome/chrome.h"
25 #include "chrome/test/chromedriver/chrome/chrome_android_impl.h" 24 #include "chrome/test/chromedriver/chrome/chrome_android_impl.h"
(...skipping 30 matching lines...) Expand all
56 const int k2GThroughput = 250 * 1024; 55 const int k2GThroughput = 250 * 1024;
57 56
58 const char kWindowHandlePrefix[] = "CDwindow-"; 57 const char kWindowHandlePrefix[] = "CDwindow-";
59 58
60 std::string WebViewIdToWindowHandle(const std::string& web_view_id) { 59 std::string WebViewIdToWindowHandle(const std::string& web_view_id) {
61 return kWindowHandlePrefix + web_view_id; 60 return kWindowHandlePrefix + web_view_id;
62 } 61 }
63 62
64 bool WindowHandleToWebViewId(const std::string& window_handle, 63 bool WindowHandleToWebViewId(const std::string& window_handle,
65 std::string* web_view_id) { 64 std::string* web_view_id) {
66 if (!base::StartsWith(window_handle, kWindowHandlePrefix, 65 if (window_handle.find(kWindowHandlePrefix) != 0u)
67 base::CompareCase::SENSITIVE)) {
68 return false; 66 return false;
69 } 67 *web_view_id = window_handle.substr(
70 *web_view_id = window_handle.substr(sizeof(kWindowHandlePrefix) - 1); 68 std::string(kWindowHandlePrefix).length());
71 return true; 69 return true;
72 } 70 }
73 71
74 } // namespace 72 } // namespace
75 73
76 InitSessionParams::InitSessionParams( 74 InitSessionParams::InitSessionParams(
77 scoped_refptr<URLRequestContextGetter> context_getter, 75 scoped_refptr<URLRequestContextGetter> context_getter,
78 const SyncWebSocketFactory& socket_factory, 76 const SyncWebSocketFactory& socket_factory,
79 DeviceManager* device_manager, 77 DeviceManager* device_manager,
80 PortServer* port_server, 78 PortServer* port_server,
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 792
795 Status ExecuteSetAutoReporting(Session* session, 793 Status ExecuteSetAutoReporting(Session* session,
796 const base::DictionaryValue& params, 794 const base::DictionaryValue& params,
797 std::unique_ptr<base::Value>* value) { 795 std::unique_ptr<base::Value>* value) {
798 bool enabled; 796 bool enabled;
799 if (!params.GetBoolean("enabled", &enabled)) 797 if (!params.GetBoolean("enabled", &enabled))
800 return Status(kUnknownError, "missing parameter 'enabled'"); 798 return Status(kUnknownError, "missing parameter 'enabled'");
801 session->auto_reporting_enabled = enabled; 799 session->auto_reporting_enabled = enabled;
802 return Status(kOk); 800 return Status(kOk);
803 } 801 }
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/net/adb_client_socket.cc ('k') | chromeos/settings/timezone_settings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698