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

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

Issue 2375613002: Fix Chromedriver Issue 749
Patch Set: Fix for chromedriver issue 749 Created 4 years, 2 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) 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/chrome/device_manager.h" 5 #include "chrome/test/chromedriver/chrome/device_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 return status; 114 return status;
115 } 115 }
116 116
117 Status Device::ForwardDevtoolsPort(const std::string& package, 117 Status Device::ForwardDevtoolsPort(const std::string& package,
118 const std::string& process, 118 const std::string& process,
119 int port, 119 int port,
120 std::string* device_socket) { 120 std::string* device_socket) {
121 if (device_socket->empty()) { 121 if (device_socket->empty()) {
122 // Assume this is a WebView app. 122 // Assume this is a WebView app.
123 int pid; 123 Status status = adb_->GetDevtoolsRemoteSocket(serial_,
124 Status status = adb_->GetPidByName(serial_,
125 process.empty() ? package : process, 124 process.empty() ? package : process,
126 &pid); 125 device_socket);
samuong 2016/10/03 18:50:40 reindent so that all arguments are aligned
Rahul Kavalapara 2016/10/05 08:06:42 Done.
127 if (status.IsError()) { 126 if (status.IsError()) {
128 if (process.empty()) 127 if (process.empty())
129 status.AddDetails( 128 status.AddDetails(
130 "process name must be specified if not equal to package name"); 129 "process name must be specified if not equal to package name");
131 return status; 130 return status;
132 } 131 }
133 *device_socket = base::StringPrintf("webview_devtools_remote_%d", pid); 132 // *device_socket = base::StringPrintf("webview_devtools_remote_%d", pid);
samuong 2016/10/03 18:50:40 don't uncomment, just delete this line
Rahul Kavalapara 2016/10/05 08:06:42 Done.
134 } 133 }
135 134
136 return adb_->ForwardPort(serial_, port, *device_socket); 135 return adb_->ForwardPort(serial_, port, *device_socket);
137 } 136 }
138 137
139 Status Device::TearDown() { 138 Status Device::TearDown() {
140 if (!active_package_.empty()) { 139 if (!active_package_.empty()) {
141 std::string response; 140 std::string response;
142 Status status = adb_->ForceStop(serial_, active_package_); 141 Status status = adb_->ForceStop(serial_, active_package_);
143 if (status.IsError()) 142 if (status.IsError())
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 Device* DeviceManager::LockDevice(const std::string& device_serial) { 205 Device* DeviceManager::LockDevice(const std::string& device_serial) {
207 active_devices_.push_back(device_serial); 206 active_devices_.push_back(device_serial);
208 return new Device(device_serial, adb_, 207 return new Device(device_serial, adb_,
209 base::Bind(&DeviceManager::ReleaseDevice, base::Unretained(this), 208 base::Bind(&DeviceManager::ReleaseDevice, base::Unretained(this),
210 device_serial)); 209 device_serial));
211 } 210 }
212 211
213 bool DeviceManager::IsDeviceLocked(const std::string& device_serial) { 212 bool DeviceManager::IsDeviceLocked(const std::string& device_serial) {
214 return base::ContainsValue(active_devices_, device_serial); 213 return base::ContainsValue(active_devices_, device_serial);
215 } 214 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698