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

Unified Diff: tools/battor_agent/battor_agent_unittest.cc

Issue 1642493004: tools/battor_agent: Adds missing RunUntilIdles in unit test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | 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 d1b43e9638c1cc36a3d21e3987ab18bd23f3de7c..ec4af611d1979e6323fa76741ad71d12d54041a8 100644
--- a/tools/battor_agent/battor_agent_unittest.cc
+++ b/tools/battor_agent/battor_agent_unittest.cc
@@ -456,6 +456,7 @@ TEST_F(BattOrAgentTest, StopTracing) {
};
GetAgent()->OnMessageRead(true, BATTOR_MESSAGE_TYPE_SAMPLES,
CreateFrame(cal_frame_header, cal_frame, 2));
+ GetTaskRunner()->RunUntilIdle();
// Send the two real data frames.
BattOrFrameHeader frame_header1{0, 3 * sizeof(RawBattOrSample)};
@@ -464,16 +465,19 @@ TEST_F(BattOrAgentTest, StopTracing) {
};
GetAgent()->OnMessageRead(true, BATTOR_MESSAGE_TYPE_SAMPLES,
CreateFrame(frame_header1, frame1, 3));
+ GetTaskRunner()->RunUntilIdle();
BattOrFrameHeader frame_header2{0, 1 * sizeof(RawBattOrSample)};
RawBattOrSample frame2[] = {RawBattOrSample{1, 1}};
GetAgent()->OnMessageRead(true, BATTOR_MESSAGE_TYPE_SAMPLES,
CreateFrame(frame_header2, frame2, 1));
+ GetTaskRunner()->RunUntilIdle();
// Send an empty last frame to indicate that we're done.
BattOrFrameHeader frame_header3{0, 0 * sizeof(RawBattOrSample)};
GetAgent()->OnMessageRead(true, BATTOR_MESSAGE_TYPE_SAMPLES,
CreateFrame(frame_header3, nullptr, 0));
+ GetTaskRunner()->RunUntilIdle();
EXPECT_TRUE(IsCommandComplete());
EXPECT_EQ(BATTOR_ERROR_NONE, GetCommandError());
@@ -676,6 +680,7 @@ TEST_F(BattOrAgentTest, StopTracingFailsIfCalibrationFrameHasWrongLength) {
};
GetAgent()->OnMessageRead(true, BATTOR_MESSAGE_TYPE_SAMPLES,
CreateFrame(cal_frame_header, cal_frame, 2));
+ GetTaskRunner()->RunUntilIdle();
EXPECT_TRUE(IsCommandComplete());
EXPECT_EQ(BATTOR_ERROR_UNEXPECTED_MESSAGE, GetCommandError());
@@ -690,6 +695,7 @@ TEST_F(BattOrAgentTest, StopTracingFailsIfDataFrameHasWrongLength) {
};
GetAgent()->OnMessageRead(true, BATTOR_MESSAGE_TYPE_SAMPLES,
CreateFrame(cal_frame_header, cal_frame, 1));
+ GetTaskRunner()->RunUntilIdle();
// Send a data frame with a mismatch between the frame length in the
// header and the actual frame length.
@@ -718,6 +724,7 @@ TEST_F(BattOrAgentTest, StopTracingFailsIfCalibrationFrameMissingByte) {
GetAgent()->OnMessageRead(true, BATTOR_MESSAGE_TYPE_SAMPLES,
std::move(cal_frame_bytes));
+ GetTaskRunner()->RunUntilIdle();
EXPECT_TRUE(IsCommandComplete());
EXPECT_EQ(BATTOR_ERROR_UNEXPECTED_MESSAGE, GetCommandError());
@@ -732,6 +739,7 @@ TEST_F(BattOrAgentTest, StopTracingFailsIfDataFrameMissingByte) {
};
GetAgent()->OnMessageRead(true, BATTOR_MESSAGE_TYPE_SAMPLES,
CreateFrame(cal_frame_header, cal_frame, 1));
+ GetTaskRunner()->RunUntilIdle();
BattOrFrameHeader frame_header{0, 1};
RawBattOrSample frame[] = {RawBattOrSample{1, 1}};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698