OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <deque> | 5 #include <deque> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/extensions/api/serial/serial_api.h" | 10 #include "chrome/browser/extensions/api/serial/serial_api.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 SetResult(ports); | 42 SetResult(ports); |
43 SendResponse(true); | 43 SendResponse(true); |
44 return true; | 44 return true; |
45 } | 45 } |
46 protected: | 46 protected: |
47 virtual ~FakeSerialGetPortsFunction() {} | 47 virtual ~FakeSerialGetPortsFunction() {} |
48 }; | 48 }; |
49 | 49 |
50 class FakeEchoSerialConnection : public SerialConnection { | 50 class FakeEchoSerialConnection : public SerialConnection { |
51 public: | 51 public: |
52 explicit FakeEchoSerialConnection( | 52 FakeEchoSerialConnection(const std::string& port, int bitrate, |
53 const std::string& port, | 53 const std::string& owner_extension_id) |
54 int bitrate, | |
55 const std::string& owner_extension_id) | |
56 : SerialConnection(port, bitrate, owner_extension_id), | 54 : SerialConnection(port, bitrate, owner_extension_id), |
57 opened_(true) { | 55 opened_(true) { |
58 Flush(); | 56 Flush(); |
59 opened_ = false; | 57 opened_ = false; |
60 } | 58 } |
61 | 59 |
62 virtual ~FakeEchoSerialConnection() { | 60 virtual ~FakeEchoSerialConnection() { |
63 } | 61 } |
64 | 62 |
65 virtual bool Open() { | 63 virtual bool Open() { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 178 |
181 ASSERT_TRUE(RunExtensionTest("serial/api")) << message_; | 179 ASSERT_TRUE(RunExtensionTest("serial/api")) << message_; |
182 } | 180 } |
183 | 181 |
184 IN_PROC_BROWSER_TEST_F(SerialApiTest, SerialRealHardware) { | 182 IN_PROC_BROWSER_TEST_F(SerialApiTest, SerialRealHardware) { |
185 ResultCatcher catcher; | 183 ResultCatcher catcher; |
186 catcher.RestrictToProfile(browser()->profile()); | 184 catcher.RestrictToProfile(browser()->profile()); |
187 | 185 |
188 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_; | 186 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_; |
189 } | 187 } |
OLD | NEW |