adb_impl.h revision a3f7b4e666c476898878fa745f637129375cd889
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 Log;
20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class Status;
21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)class AdbImpl : public Adb {
23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) public:
24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  explicit AdbImpl(
25a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch      const scoped_refptr<base::SingleThreadTaskRunner>& io_message_loop_proxy,
26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)      Log* log);
27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual ~AdbImpl();
28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Overridden from Adb:
30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual Status GetDevices(std::vector<std::string>* devices) OVERRIDE;
31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual Status ForwardPort(const std::string& device_serial,
32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                             int local_port,
33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                             const std::string& remote_abstract) OVERRIDE;
34eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  virtual Status SetChromeArgs(const std::string& device_serial,
35eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch                               const std::string& args) OVERRIDE;
36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual Status CheckAppInstalled(const std::string& device_serial,
37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                                   const std::string& package) OVERRIDE;
38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual Status ClearAppData(const std::string& device_serial,
39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                              const std::string& package) OVERRIDE;
40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual Status Launch(const std::string& device_serial,
41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                        const std::string& package,
42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                        const std::string& activity) OVERRIDE;
43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  virtual Status ForceStop(const std::string& device_serial,
44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                           const std::string& package) OVERRIDE;
45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) private:
47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  Status ExecuteCommand(const std::string& command,
48868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                        std::string* response);
49868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  Status ExecuteHostCommand(const std::string& device_serial,
50868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                            const std::string& host_command,
51868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                            std::string* response);
52868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  Status ExecuteHostShellCommand(const std::string& device_serial,
53868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                                 const std::string& shell_command,
54868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)                                 std::string* response);
55868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
56a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch  scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
57868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
58868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  Log* log_;
59868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)};
60868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
61868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif  // CHROME_TEST_CHROMEDRIVER_CHROME_ADB_IMPL_H_
62