OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/test/chromedriver/chrome/adb.h" | 10 #include "chrome/test/chromedriver/chrome/adb.h" |
11 #include "chrome/test/chromedriver/chrome/device_manager.h" | 11 #include "chrome/test/chromedriver/chrome/device_manager.h" |
12 #include "chrome/test/chromedriver/chrome/status.h" | 12 #include "chrome/test/chromedriver/chrome/status.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 class FakeAdb : public Adb { | 17 class FakeAdb : public Adb { |
18 public: | 18 public: |
19 FakeAdb() {} | 19 FakeAdb() {} |
20 virtual ~FakeAdb() {} | 20 virtual ~FakeAdb() {} |
21 | 21 |
22 virtual Status GetDevices(std::vector<std::string>* devices) OVERRIDE { | 22 virtual Status GetDevices(std::vector<std::string>* devices) override { |
23 devices->push_back("a"); | 23 devices->push_back("a"); |
24 devices->push_back("b"); | 24 devices->push_back("b"); |
25 return Status(kOk); | 25 return Status(kOk); |
26 } | 26 } |
27 | 27 |
28 virtual Status ForwardPort(const std::string& device_serial, | 28 virtual Status ForwardPort(const std::string& device_serial, |
29 int local_port, | 29 int local_port, |
30 const std::string& remote_abstract) OVERRIDE { | 30 const std::string& remote_abstract) override { |
31 return Status(kOk); | 31 return Status(kOk); |
32 } | 32 } |
33 | 33 |
34 virtual Status SetCommandLineFile(const std::string& device_serial, | 34 virtual Status SetCommandLineFile(const std::string& device_serial, |
35 const std::string& command_line_file, | 35 const std::string& command_line_file, |
36 const std::string& exec_name, | 36 const std::string& exec_name, |
37 const std::string& args) OVERRIDE { | 37 const std::string& args) override { |
38 return Status(kOk); | 38 return Status(kOk); |
39 } | 39 } |
40 | 40 |
41 virtual Status CheckAppInstalled(const std::string& device_serial, | 41 virtual Status CheckAppInstalled(const std::string& device_serial, |
42 const std::string& package) OVERRIDE { | 42 const std::string& package) override { |
43 return Status(kOk); | 43 return Status(kOk); |
44 } | 44 } |
45 | 45 |
46 virtual Status ClearAppData(const std::string& device_serial, | 46 virtual Status ClearAppData(const std::string& device_serial, |
47 const std::string& package) OVERRIDE { | 47 const std::string& package) override { |
48 return Status(kOk); | 48 return Status(kOk); |
49 } | 49 } |
50 | 50 |
51 virtual Status SetDebugApp(const std::string& device_serial, | 51 virtual Status SetDebugApp(const std::string& device_serial, |
52 const std::string& package) OVERRIDE { | 52 const std::string& package) override { |
53 return Status(kOk); | 53 return Status(kOk); |
54 } | 54 } |
55 | 55 |
56 virtual Status Launch(const std::string& device_serial, | 56 virtual Status Launch(const std::string& device_serial, |
57 const std::string& package, | 57 const std::string& package, |
58 const std::string& activity) OVERRIDE { | 58 const std::string& activity) override { |
59 return Status(kOk); | 59 return Status(kOk); |
60 } | 60 } |
61 | 61 |
62 virtual Status ForceStop(const std::string& device_serial, | 62 virtual Status ForceStop(const std::string& device_serial, |
63 const std::string& package) OVERRIDE { | 63 const std::string& package) override { |
64 return Status(kOk); | 64 return Status(kOk); |
65 } | 65 } |
66 | 66 |
67 virtual Status GetPidByName(const std::string& device_serial, | 67 virtual Status GetPidByName(const std::string& device_serial, |
68 const std::string& process_name, | 68 const std::string& process_name, |
69 int* pid) OVERRIDE { | 69 int* pid) override { |
70 *pid = 0; // avoid uninit error crbug.com/393231 | 70 *pid = 0; // avoid uninit error crbug.com/393231 |
71 return Status(kOk); | 71 return Status(kOk); |
72 } | 72 } |
73 }; | 73 }; |
74 | 74 |
75 } // namespace | 75 } // namespace |
76 | 76 |
77 TEST(DeviceManager, AcquireDevice) { | 77 TEST(DeviceManager, AcquireDevice) { |
78 FakeAdb adb; | 78 FakeAdb adb; |
79 DeviceManager device_manager(&adb); | 79 DeviceManager device_manager(&adb); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 "a.chrome.package", "an.activity", "", "", false, 0).IsOk()); | 116 "a.chrome.package", "an.activity", "", "", false, 0).IsOk()); |
117 ASSERT_FALSE(device1->SetUp("a.package", "", "", "", false, 0).IsOk()); | 117 ASSERT_FALSE(device1->SetUp("a.package", "", "", "", false, 0).IsOk()); |
118 ASSERT_TRUE(device1->SetUp( | 118 ASSERT_TRUE(device1->SetUp( |
119 "a.package", "an.activity", "", "", false, 0).IsOk()); | 119 "a.package", "an.activity", "", "", false, 0).IsOk()); |
120 ASSERT_TRUE(device1->TearDown().IsOk()); | 120 ASSERT_TRUE(device1->TearDown().IsOk()); |
121 ASSERT_TRUE(device1->TearDown().IsOk()); | 121 ASSERT_TRUE(device1->TearDown().IsOk()); |
122 ASSERT_TRUE(device1->SetUp( | 122 ASSERT_TRUE(device1->SetUp( |
123 "a.package", "an.activity", "a.process", "", false, 0).IsOk()); | 123 "a.package", "an.activity", "a.process", "", false, 0).IsOk()); |
124 ASSERT_TRUE(device1->TearDown().IsOk()); | 124 ASSERT_TRUE(device1->TearDown().IsOk()); |
125 } | 125 } |
OLD | NEW |