Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1002)

Unified Diff: tools/battor_agent/battor_agent_unittest.cc

Issue 2859353003: [BattOr] Reduce StartTracing time by about four seconds.
Patch Set: Fixed test cases Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/battor_agent/battor_agent.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « tools/battor_agent/battor_agent.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698