1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file. 4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#ifndef CHROME_TEST_CHROMEDRIVER_CHROME_ADB_IMPL_H_ 6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#define CHROME_TEST_CHROMEDRIVER_CHROME_ADB_IMPL_H_ 7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include <string> 9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include <vector> 10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/compiler_specific.h" 12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/memory/ref_counted.h" 13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/test/chromedriver/chrome/adb.h" 14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace base { 16a3f7b4e666c476898878fa745f637129375cd889Ben Murdochclass SingleThreadTaskRunner; 17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} 18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class Status; 20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class AdbImpl : public Adb { 22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public: 23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) explicit AdbImpl( 24a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch const scoped_refptr<base::SingleThreadTaskRunner>& io_message_loop_proxy, 2558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) int port); 26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual ~AdbImpl(); 27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // Overridden from Adb: 29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual Status GetDevices(std::vector<std::string>* devices) OVERRIDE; 30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual Status ForwardPort(const std::string& device_serial, 31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int local_port, 32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const std::string& remote_abstract) OVERRIDE; 33d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch virtual Status SetCommandLineFile(const std::string& device_serial, 34d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch const std::string& command_line_file, 35d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch const std::string& exec_name, 36d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch const std::string& args) OVERRIDE; 37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual Status CheckAppInstalled(const std::string& device_serial, 38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const std::string& package) OVERRIDE; 39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual Status ClearAppData(const std::string& device_serial, 40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const std::string& package) OVERRIDE; 415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual Status SetDebugApp(const std::string& device_serial, 425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const std::string& package) OVERRIDE; 43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual Status Launch(const std::string& device_serial, 44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const std::string& package, 45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const std::string& activity) OVERRIDE; 46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) virtual Status ForceStop(const std::string& device_serial, 47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const std::string& package) OVERRIDE; 48d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch virtual Status GetPidByName(const std::string& device_serial, 49d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch const std::string& process_name, 50d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch int* pid) OVERRIDE; 51868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 52868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) private: 53868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) Status ExecuteCommand(const std::string& command, 54868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) std::string* response); 55868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) Status ExecuteHostCommand(const std::string& device_serial, 56868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const std::string& host_command, 57868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) std::string* response); 58868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) Status ExecuteHostShellCommand(const std::string& device_serial, 59868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const std::string& shell_command, 60868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) std::string* response); 61868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 62a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; 63868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 643551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) int port_; 65868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}; 66868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 67868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif // CHROME_TEST_CHROMEDRIVER_CHROME_ADB_IMPL_H_ 68