Chromium Code Reviews| Index: tools/battor_agent/battor_agent_unittest.cc |
| diff --git a/tools/battor_agent/battor_agent_unittest.cc b/tools/battor_agent/battor_agent_unittest.cc |
| index 627096077ce28defc11cdd9d15fc8b660b6d77d3..d790820c8a1fd15c5c26ccefec41e15677a27858 100644 |
| --- a/tools/battor_agent/battor_agent_unittest.cc |
| +++ b/tools/battor_agent/battor_agent_unittest.cc |
| @@ -578,7 +578,15 @@ TEST_F(BattOrAgentTest, StopTracing) { |
| ReadMessage(BATTOR_MESSAGE_TYPE_SAMPLES)) |
| .Times(4); |
| + // Ensure that the proactive reset message is be sent after the trace, |
| + BattOrControlMessage reset_msg{BATTOR_CONTROL_MESSAGE_TYPE_RESET, 0, 0}; |
| + EXPECT_CALL( |
| + *GetAgent()->GetConnection(), |
| + SendBytes(BATTOR_MESSAGE_TYPE_CONTROL, |
| + BufferEq(&reset_msg, sizeof(reset_msg)), sizeof(reset_msg))); |
| + |
| GetAgent()->StopTracing(); |
| + |
| RunStopTracingTo(BattOrAgentState::SAMPLES_REQUEST_SENT); |
| // Send the calibration frame. |
| @@ -607,6 +615,9 @@ TEST_F(BattOrAgentTest, StopTracing) { |
| OnMessageRead(true, BATTOR_MESSAGE_TYPE_SAMPLES, |
| CreateFrame(frame_header3, nullptr, 0)); |
| + // Bytes will be sent beause the proactive RESET message will be sent. |
| + OnBytesSent(true); |
| + |
| EXPECT_TRUE(IsCommandComplete()); |
| EXPECT_EQ(BATTOR_ERROR_NONE, GetCommandError()); |
| EXPECT_EQ( |
| @@ -688,6 +699,9 @@ TEST_F(BattOrAgentTest, StopTracingSucceedsAfterCalibrationFrameReadFailure) { |
| RunStopTracingTo(BattOrAgentState::SAMPLES_END_FRAME_RECEIVED); |
| + // Bytes will be sent beause the proactive RESET message will be sent. |
| + OnBytesSent(true); |
| + |
| EXPECT_TRUE(IsCommandComplete()); |
| EXPECT_EQ(BATTOR_ERROR_NONE, GetCommandError()); |
| } |
| @@ -704,6 +718,9 @@ TEST_F(BattOrAgentTest, StopTracingSucceedsAfterDataFrameReadFailure) { |
| RunStopTracingTo(BattOrAgentState::SAMPLES_END_FRAME_RECEIVED); |
| + // Bytes will be sent beause the proactive RESET message will be sent. |
| + OnBytesSent(true); |
| + |
| EXPECT_TRUE(IsCommandComplete()); |
| EXPECT_EQ(BATTOR_ERROR_NONE, GetCommandError()); |
| } |
| @@ -762,6 +779,9 @@ TEST_F(BattOrAgentTest, StopTracingSucceedsWithFewDataFrameReadFailures) { |
| RunStopTracingTo(BattOrAgentState::SAMPLES_END_FRAME_RECEIVED); |
| + // Bytes will be sent beause the proactive RESET message will be sent. |
| + OnBytesSent(true); |
|
charliea (OOO until 10-5)
2017/05/24 18:41:29
I think there should be a test where everything go
|
| + |
| EXPECT_TRUE(IsCommandComplete()); |
| EXPECT_EQ(BATTOR_ERROR_NONE, GetCommandError()); |
| } |