Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / test / chromedriver / chrome / adb_impl.h
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_TEST_CHROMEDRIVER_CHROME_ADB_IMPL_H_
6 #define CHROME_TEST_CHROMEDRIVER_CHROME_ADB_IMPL_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h"
13 #include "chrome/test/chromedriver/chrome/adb.h"
14
15 namespace base {
16 class SingleThreadTaskRunner;
17 }
18
19 class Status;
20
21 class AdbImpl : public Adb {
22  public:
23   explicit AdbImpl(
24       const scoped_refptr<base::SingleThreadTaskRunner>& io_message_loop_proxy,
25       int port);
26   ~AdbImpl() override;
27
28   // Overridden from Adb:
29   Status GetDevices(std::vector<std::string>* devices) override;
30   Status ForwardPort(const std::string& device_serial,
31                      int local_port,
32                      const std::string& remote_abstract) override;
33   Status SetCommandLineFile(const std::string& device_serial,
34                             const std::string& command_line_file,
35                             const std::string& exec_name,
36                             const std::string& args) override;
37   Status CheckAppInstalled(const std::string& device_serial,
38                            const std::string& package) override;
39   Status ClearAppData(const std::string& device_serial,
40                       const std::string& package) override;
41   Status SetDebugApp(const std::string& device_serial,
42                      const std::string& package) override;
43   Status Launch(const std::string& device_serial,
44                 const std::string& package,
45                 const std::string& activity) override;
46   Status ForceStop(const std::string& device_serial,
47                    const std::string& package) override;
48   Status GetPidByName(const std::string& device_serial,
49                       const std::string& process_name,
50                       int* pid) override;
51
52  private:
53   Status ExecuteCommand(const std::string& command,
54                         std::string* response);
55   Status ExecuteHostCommand(const std::string& device_serial,
56                             const std::string& host_command,
57                             std::string* response);
58   Status ExecuteHostShellCommand(const std::string& device_serial,
59                                  const std::string& shell_command,
60                                  std::string* response);
61
62   scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
63
64   int port_;
65 };
66
67 #endif  // CHROME_TEST_CHROMEDRIVER_CHROME_ADB_IMPL_H_