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

Unified Diff: chrome/test/chromedriver/session_commands.cc

Issue 2136453004: Reland of place 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/chromedriver/session_commands.cc
diff --git a/chrome/test/chromedriver/session_commands.cc b/chrome/test/chromedriver/session_commands.cc
index ecfe4a795013e12ff5c873ec67f0b1e450e9186c..48ad77d7f1c7bddb310ff719df20b306b89bc8b0 100644
--- a/chrome/test/chromedriver/session_commands.cc
+++ b/chrome/test/chromedriver/session_commands.cc
@@ -12,6 +12,7 @@
#include "base/files/file_util.h"
#include "base/logging.h" // For CHECK macros.
#include "base/memory/ref_counted.h"
+#include "base/strings/string_util.h"
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -62,10 +63,11 @@
bool WindowHandleToWebViewId(const std::string& window_handle,
std::string* web_view_id) {
- if (window_handle.find(kWindowHandlePrefix) != 0u)
+ if (!base::StartsWith(window_handle, kWindowHandlePrefix,
+ base::CompareCase::SENSITIVE)) {
return false;
- *web_view_id = window_handle.substr(
- std::string(kWindowHandlePrefix).length());
+ }
+ *web_view_id = window_handle.substr(sizeof(kWindowHandlePrefix) - 1);
return true;
}
« 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