OLD | NEW |
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/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
20 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
21 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
22 #include "base/stl_util.h" | 22 #include "base/stl_util.h" |
23 #include "base/strings/stringprintf.h" | |
24 #include "base/sys_info.h" | 23 #include "base/sys_info.h" |
25 #include "base/threading/thread_task_runner_handle.h" | 24 #include "base/threading/thread_task_runner_handle.h" |
26 #include "base/values.h" | 25 #include "base/values.h" |
27 #include "chrome/test/chromedriver/capabilities.h" | 26 #include "chrome/test/chromedriver/capabilities.h" |
28 #include "chrome/test/chromedriver/chrome/browser_info.h" | 27 #include "chrome/test/chromedriver/chrome/browser_info.h" |
29 #include "chrome/test/chromedriver/chrome/chrome.h" | 28 #include "chrome/test/chromedriver/chrome/chrome.h" |
30 #include "chrome/test/chromedriver/chrome/status.h" | 29 #include "chrome/test/chromedriver/chrome/status.h" |
31 #include "chrome/test/chromedriver/logging.h" | 30 #include "chrome/test/chromedriver/logging.h" |
32 #include "chrome/test/chromedriver/session.h" | 31 #include "chrome/test/chromedriver/session.h" |
33 #include "chrome/test/chromedriver/session_thread_map.h" | 32 #include "chrome/test/chromedriver/session_thread_map.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 101 } |
103 } | 102 } |
104 | 103 |
105 } // namespace | 104 } // namespace |
106 | 105 |
107 void ExecuteGetSessions(const Command& session_capabilities_command, | 106 void ExecuteGetSessions(const Command& session_capabilities_command, |
108 SessionThreadMap* session_thread_map, | 107 SessionThreadMap* session_thread_map, |
109 const base::DictionaryValue& params, | 108 const base::DictionaryValue& params, |
110 const std::string& session_id, | 109 const std::string& session_id, |
111 const CommandCallback& callback) { | 110 const CommandCallback& callback) { |
112 | |
113 size_t get_remaining_count = session_thread_map->size(); | 111 size_t get_remaining_count = session_thread_map->size(); |
114 base::WeakPtrFactory<size_t> weak_ptr_factory(&get_remaining_count); | 112 base::WeakPtrFactory<size_t> weak_ptr_factory(&get_remaining_count); |
115 std::unique_ptr<base::ListValue> session_list(new base::ListValue()); | 113 std::unique_ptr<base::ListValue> session_list(new base::ListValue()); |
116 | 114 |
117 if (!get_remaining_count) { | 115 if (!get_remaining_count) { |
118 callback.Run(Status(kOk), std::move(session_list), session_id, false); | 116 callback.Run(Status(kOk), std::move(session_list), session_id, false); |
119 return; | 117 return; |
120 } | 118 } |
121 | 119 |
122 base::RunLoop run_loop; | 120 base::RunLoop run_loop; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 } | 324 } |
327 } | 325 } |
328 | 326 |
329 namespace internal { | 327 namespace internal { |
330 | 328 |
331 void CreateSessionOnSessionThreadForTesting(const std::string& id) { | 329 void CreateSessionOnSessionThreadForTesting(const std::string& id) { |
332 SetThreadLocalSession(base::MakeUnique<Session>(id)); | 330 SetThreadLocalSession(base::MakeUnique<Session>(id)); |
333 } | 331 } |
334 | 332 |
335 } // namespace internal | 333 } // namespace internal |
OLD | NEW |