OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/macros.h" | 5 #include "base/macros.h" |
6 #include "device/serial/serial_io_handler_posix.h" | 6 #include "device/serial/serial_io_handler_posix.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace device { | 9 namespace device { |
10 | 10 |
11 class SerialIoHandlerPosixTest : public testing::Test { | 11 class SerialIoHandlerPosixTest : public testing::Test { |
12 public: | 12 public: |
13 SerialIoHandlerPosixTest() {} | 13 SerialIoHandlerPosixTest() {} |
14 | 14 |
15 void SetUp() override { | 15 void SetUp() override { |
16 serial_io_handler_posix_ = new SerialIoHandlerPosix(nullptr, nullptr); | 16 serial_io_handler_posix_ = new SerialIoHandlerPosix(nullptr); |
17 } | 17 } |
18 | 18 |
19 void Initialize(bool parity_check_enabled, | 19 void Initialize(bool parity_check_enabled, |
20 const char* chars_stashed, | 20 const char* chars_stashed, |
21 int num_chars_stashed) { | 21 int num_chars_stashed) { |
22 serial_io_handler_posix_->error_detect_state_ = ErrorDetectState::NO_ERROR; | 22 serial_io_handler_posix_->error_detect_state_ = ErrorDetectState::NO_ERROR; |
23 serial_io_handler_posix_->parity_check_enabled_ = parity_check_enabled; | 23 serial_io_handler_posix_->parity_check_enabled_ = parity_check_enabled; |
24 serial_io_handler_posix_->num_chars_stashed_ = num_chars_stashed; | 24 serial_io_handler_posix_->num_chars_stashed_ = num_chars_stashed; |
25 for (int i = 0; i < num_chars_stashed; ++i) { | 25 for (int i = 0; i < num_chars_stashed; ++i) { |
26 serial_io_handler_posix_->chars_stashed_[i] = chars_stashed[i]; | 26 serial_io_handler_posix_->chars_stashed_[i] = chars_stashed[i]; |
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 "\377\0", 2, "\377", 1, false, false); | 1012 "\377\0", 2, "\377", 1, false, false); |
1013 | 1013 |
1014 char buffer_3[30] = {'a', 'd', 'e'}; | 1014 char buffer_3[30] = {'a', 'd', 'e'}; |
1015 bytes_read = 3; | 1015 bytes_read = 3; |
1016 TestHelper(buffer_3, buffer_len, bytes_read, ErrorDetectState::NO_ERROR, "", | 1016 TestHelper(buffer_3, buffer_len, bytes_read, ErrorDetectState::NO_ERROR, "", |
1017 0, "de", 2, false, true); | 1017 0, "de", 2, false, true); |
1018 } | 1018 } |
1019 } | 1019 } |
1020 | 1020 |
1021 } // namespace device | 1021 } // namespace device |
OLD | NEW |