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

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

Issue 2121513002: Replace string::find(prefix) == 0 pattern with base::StartsWith(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos 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
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 @@ std::string WebViewIdToWindowHandle(const std::string& web_view_id) {
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());
Lei Zhang 2016/07/07 22:33:49 At least this is test code?
lazyboy 2016/07/07 23:44:50 Reverted. Done.
Lei Zhang 2016/07/07 23:50:08 No, no, I was fine with the change. I dislike the
lazyboy 2016/07/07 23:57:11 Ah, deleted patchset #3
+ }
+ *web_view_id = window_handle.substr(sizeof(kWindowHandlePrefix) - 1);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698