From c41a003c834c0605e271aa6061b046a776940b86 Mon Sep 17 00:00:00 2001 From: juncai Date: Thu, 16 Jul 2015 17:07:32 -0700 Subject: Add unit tests for new added ReceiveError This patch added unit tests for new added ReceiveError enums. BUG=414105 Review URL: https://codereview.chromium.org/1242523002 Cr-Commit-Position: refs/heads/master@{#339181} --- .../renderer/api/serial/serial_api_unittest.cc | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'extensions/renderer/api') diff --git a/extensions/renderer/api/serial/serial_api_unittest.cc b/extensions/renderer/api/serial/serial_api_unittest.cc index 603a2e7..8ba15f0 100644 --- a/extensions/renderer/api/serial/serial_api_unittest.cc +++ b/extensions/renderer/api/serial/serial_api_unittest.cc @@ -602,6 +602,36 @@ TEST_F(SerialApiTest, ReceiveErrorDeviceLost) { RunTest("serial_unittest.js", "testReceiveErrorDeviceLost"); } +TEST_F(SerialApiTest, ReceiveErrorBreak) { + io_handler_ = + new ReceiveErrorTestIoHandler(device::serial::RECEIVE_ERROR_BREAK); + RunTest("serial_unittest.js", "testReceiveErrorBreak"); +} + +TEST_F(SerialApiTest, ReceiveErrorFrameError) { + io_handler_ = + new ReceiveErrorTestIoHandler(device::serial::RECEIVE_ERROR_FRAME_ERROR); + RunTest("serial_unittest.js", "testReceiveErrorFrameError"); +} + +TEST_F(SerialApiTest, ReceiveErrorOverrun) { + io_handler_ = + new ReceiveErrorTestIoHandler(device::serial::RECEIVE_ERROR_OVERRUN); + RunTest("serial_unittest.js", "testReceiveErrorOverrun"); +} + +TEST_F(SerialApiTest, ReceiveErrorBufferOverflow) { + io_handler_ = new ReceiveErrorTestIoHandler( + device::serial::RECEIVE_ERROR_BUFFER_OVERFLOW); + RunTest("serial_unittest.js", "testReceiveErrorBufferOverflow"); +} + +TEST_F(SerialApiTest, ReceiveErrorParityError) { + io_handler_ = + new ReceiveErrorTestIoHandler(device::serial::RECEIVE_ERROR_PARITY_ERROR); + RunTest("serial_unittest.js", "testReceiveErrorParityError"); +} + TEST_F(SerialApiTest, ReceiveErrorSystemError) { io_handler_ = new ReceiveErrorTestIoHandler(device::serial::RECEIVE_ERROR_SYSTEM_ERROR); -- cgit v1.1