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

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

Issue 1715683002: chrome: Use base's ContainsValue helper function instead of std::find (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing non ContainsValue changes Created 4 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/commands.h" 5 #include "chrome/test/chromedriver/commands.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/linked_ptr.h" 17 #include "base/memory/linked_ptr.h"
18 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
19 #include "base/run_loop.h" 19 #include "base/run_loop.h"
20 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
21 #include "base/stl_util.h"
21 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
22 #include "base/sys_info.h" 23 #include "base/sys_info.h"
23 #include "base/thread_task_runner_handle.h" 24 #include "base/thread_task_runner_handle.h"
24 #include "base/values.h" 25 #include "base/values.h"
25 #include "chrome/test/chromedriver/capabilities.h" 26 #include "chrome/test/chromedriver/capabilities.h"
26 #include "chrome/test/chromedriver/chrome/browser_info.h" 27 #include "chrome/test/chromedriver/chrome/browser_info.h"
27 #include "chrome/test/chromedriver/chrome/chrome.h" 28 #include "chrome/test/chromedriver/chrome/chrome.h"
28 #include "chrome/test/chromedriver/chrome/status.h" 29 #include "chrome/test/chromedriver/chrome/status.h"
29 #include "chrome/test/chromedriver/logging.h" 30 #include "chrome/test/chromedriver/logging.h"
30 #include "chrome/test/chromedriver/session.h" 31 #include "chrome/test/chromedriver/session.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 245 }
245 status = Status(kUnknownError, message, status); 246 status = Status(kUnknownError, message, status);
246 } else if (status.code() == kDisconnected) { 247 } else if (status.code() == kDisconnected) {
247 // Some commands, like clicking a button or link which closes the 248 // Some commands, like clicking a button or link which closes the
248 // window, may result in a kDisconnected error code. 249 // window, may result in a kDisconnected error code.
249 std::list<std::string> web_view_ids; 250 std::list<std::string> web_view_ids;
250 Status status_tmp = session->chrome->GetWebViewIds(&web_view_ids); 251 Status status_tmp = session->chrome->GetWebViewIds(&web_view_ids);
251 if (status_tmp.IsError() && status_tmp.code() != kChromeNotReachable) { 252 if (status_tmp.IsError() && status_tmp.code() != kChromeNotReachable) {
252 status.AddDetails( 253 status.AddDetails(
253 "failed to check if window was closed: " + status_tmp.message()); 254 "failed to check if window was closed: " + status_tmp.message());
254 } else if (std::find(web_view_ids.begin(), 255 } else if (!ContainsValue(web_view_ids, session->window)) {
255 web_view_ids.end(),
256 session->window) == web_view_ids.end()) {
257 status = Status(kOk); 256 status = Status(kOk);
258 } 257 }
259 } 258 }
260 if (status.IsError()) { 259 if (status.IsError()) {
261 const BrowserInfo* browser_info = session->chrome->GetBrowserInfo(); 260 const BrowserInfo* browser_info = session->chrome->GetBrowserInfo();
262 status.AddDetails("Session info: " + browser_info->browser_name + "=" + 261 status.AddDetails("Session info: " + browser_info->browser_name + "=" +
263 browser_info->browser_version); 262 browser_info->browser_version);
264 } 263 }
265 } 264 }
266 265
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } 320 }
322 } 321 }
323 322
324 namespace internal { 323 namespace internal {
325 324
326 void CreateSessionOnSessionThreadForTesting(const std::string& id) { 325 void CreateSessionOnSessionThreadForTesting(const std::string& id) {
327 SetThreadLocalSession(make_scoped_ptr(new Session(id))); 326 SetThreadLocalSession(make_scoped_ptr(new Session(id)));
328 } 327 }
329 328
330 } // namespace internal 329 } // namespace internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698