OLD | NEW |
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/server/http_handler.h" | 5 #include "chrome/test/chromedriver/server/http_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 received_shutdown_(false), | 73 received_shutdown_(false), |
74 weak_ptr_factory_(this) { | 74 weak_ptr_factory_(this) { |
75 #if defined(OS_MACOSX) | 75 #if defined(OS_MACOSX) |
76 base::mac::ScopedNSAutoreleasePool autorelease_pool; | 76 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
77 #endif | 77 #endif |
78 context_getter_ = new URLRequestContextGetter(io_task_runner); | 78 context_getter_ = new URLRequestContextGetter(io_task_runner); |
79 socket_factory_ = CreateSyncWebSocketFactory(context_getter_.get()); | 79 socket_factory_ = CreateSyncWebSocketFactory(context_getter_.get()); |
80 adb_.reset(new AdbImpl(io_task_runner, adb_port)); | 80 adb_.reset(new AdbImpl(io_task_runner, adb_port)); |
81 device_manager_.reset(new DeviceManager(adb_.get())); | 81 device_manager_.reset(new DeviceManager(adb_.get())); |
82 port_server_ = port_server.Pass(); | 82 port_server_ = port_server.Pass(); |
83 port_manager_.reset(new PortManager(12000, 13000)); | 83 port_manager_.reset(new PortManager(12000, 13000, false)); |
| 84 port_manager_android_.reset(new PortManager(12000, 13000, true)); |
84 | 85 |
85 CommandMapping commands[] = { | 86 CommandMapping commands[] = { |
86 CommandMapping( | 87 CommandMapping( |
87 kPost, | 88 kPost, |
88 internal::kNewSessionPathPattern, | 89 internal::kNewSessionPathPattern, |
89 base::Bind(&ExecuteCreateSession, | 90 base::Bind(&ExecuteCreateSession, |
90 &session_thread_map_, | 91 &session_thread_map_, |
91 WrapToCommand( | 92 WrapToCommand( |
92 "InitSession", | 93 "InitSession", |
93 base::Bind(&ExecuteInitSession, | 94 base::Bind( |
94 InitSessionParams(context_getter_, | 95 &ExecuteInitSession, |
95 socket_factory_, | 96 InitSessionParams(context_getter_, |
96 device_manager_.get(), | 97 socket_factory_, |
97 port_server_.get(), | 98 device_manager_.get(), |
98 port_manager_.get()))))), | 99 port_server_.get(), |
| 100 port_manager_.get(), |
| 101 port_manager_android_.get()))))), |
99 CommandMapping(kGet, | 102 CommandMapping(kGet, |
100 "session/:sessionId", | 103 "session/:sessionId", |
101 WrapToCommand("GetSessionCapabilities", | 104 WrapToCommand("GetSessionCapabilities", |
102 base::Bind(&ExecuteGetSessionCapabilities))), | 105 base::Bind(&ExecuteGetSessionCapabilities))), |
103 CommandMapping(kDelete, | 106 CommandMapping(kDelete, |
104 "session/:sessionId", | 107 "session/:sessionId", |
105 base::Bind(&ExecuteSessionCommand, | 108 base::Bind(&ExecuteSessionCommand, |
106 &session_thread_map_, | 109 &session_thread_map_, |
107 "Quit", | 110 "Quit", |
108 base::Bind(&ExecuteQuit, false), | 111 base::Bind(&ExecuteQuit, false), |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 params.SetString(name, path_parts[i]); | 720 params.SetString(name, path_parts[i]); |
718 } else if (command_path_parts[i] != path_parts[i]) { | 721 } else if (command_path_parts[i] != path_parts[i]) { |
719 return false; | 722 return false; |
720 } | 723 } |
721 } | 724 } |
722 out_params->MergeDictionary(¶ms); | 725 out_params->MergeDictionary(¶ms); |
723 return true; | 726 return true; |
724 } | 727 } |
725 | 728 |
726 } // namespace internal | 729 } // namespace internal |
OLD | NEW |