| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 | 6 |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 #include "device/serial/test_serial_io_handler.h" | 8 #include "device/serial/test_serial_io_handler.h" |
| 9 #include "extensions/browser/api/serial/serial_api.h" | 9 #include "extensions/browser/api/serial/serial_api.h" |
| 10 #include "extensions/browser/api/serial/serial_connection.h" | 10 #include "extensions/browser/api/serial/serial_connection.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 DISALLOW_COPY_AND_ASSIGN(FakeEchoSerialIoHandler); | 64 DISALLOW_COPY_AND_ASSIGN(FakeEchoSerialIoHandler); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 class FakeSerialConnectFunction : public core_api::SerialConnectFunction { | 67 class FakeSerialConnectFunction : public core_api::SerialConnectFunction { |
| 68 protected: | 68 protected: |
| 69 virtual SerialConnection* CreateSerialConnection( | 69 virtual SerialConnection* CreateSerialConnection( |
| 70 const std::string& port, | 70 const std::string& port, |
| 71 const std::string& owner_extension_id) const OVERRIDE { | 71 const std::string& owner_extension_id) const OVERRIDE { |
| 72 scoped_refptr<FakeEchoSerialIoHandler> io_handler = | 72 scoped_refptr<FakeEchoSerialIoHandler> io_handler = |
| 73 new FakeEchoSerialIoHandler; | 73 new FakeEchoSerialIoHandler; |
| 74 EXPECT_CALL(*io_handler, SetControlSignals(_)).Times(1).WillOnce( | 74 EXPECT_CALL(*io_handler.get(), SetControlSignals(_)).Times(1).WillOnce( |
| 75 Return(true)); | 75 Return(true)); |
| 76 SerialConnection* serial_connection = | 76 SerialConnection* serial_connection = |
| 77 new SerialConnection(port, owner_extension_id); | 77 new SerialConnection(port, owner_extension_id); |
| 78 serial_connection->SetIoHandlerForTest(io_handler); | 78 serial_connection->SetIoHandlerForTest(io_handler); |
| 79 return serial_connection; | 79 return serial_connection; |
| 80 } | 80 } |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 virtual ~FakeSerialConnectFunction() {} | 83 virtual ~FakeSerialConnectFunction() {} |
| 84 }; | 84 }; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 ASSERT_TRUE(RunExtensionTest("serial/api")) << message_; | 127 ASSERT_TRUE(RunExtensionTest("serial/api")) << message_; |
| 128 } | 128 } |
| 129 | 129 |
| 130 IN_PROC_BROWSER_TEST_F(SerialApiTest, SerialRealHardware) { | 130 IN_PROC_BROWSER_TEST_F(SerialApiTest, SerialRealHardware) { |
| 131 ResultCatcher catcher; | 131 ResultCatcher catcher; |
| 132 catcher.RestrictToProfile(browser()->profile()); | 132 catcher.RestrictToProfile(browser()->profile()); |
| 133 | 133 |
| 134 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_; | 134 ASSERT_TRUE(RunExtensionTest("serial/real_hardware")) << message_; |
| 135 } | 135 } |
| OLD | NEW |