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

Unified Diff: tools/battor_agent/battor_agent_unittest.cc

Issue 1586173002: tools/battor_agent: Prints real BattOr samples instead of raw ones (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_eeprom
Patch Set: Fixed size_t build error 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 | « tools/battor_agent/battor_agent.cc ('k') | tools/battor_agent/battor_protocol_types.h » ('j') | 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 b65e647a7b8a305d941fd6378e91dfbd53965e23..ad86f4879206fc84c059755bf271b7e80b0da9c5 100644
--- a/tools/battor_agent/battor_agent_unittest.cc
+++ b/tools/battor_agent/battor_agent_unittest.cc
@@ -104,6 +104,7 @@ class BattOrAgentTest : public testing::Test, public BattOrAgent::Listener {
BattOrError error) override {
is_command_complete_ = true;
command_error_ = error;
+ trace_ = trace;
}
protected:
@@ -216,8 +217,17 @@ class BattOrAgentTest : public testing::Test, public BattOrAgent::Listener {
if (end_state == BattOrAgentState::EEPROM_REQUEST_SENT)
return;
+ BattOrEEPROM eeprom;
+ eeprom.r1 = 1;
+ eeprom.r2 = 1;
+ eeprom.r3 = 1;
+ eeprom.low_gain = 1;
+ eeprom.low_gain_correction_offset = 0;
+ eeprom.low_gain_correction_factor = 1;
+ eeprom.sd_sample_rate = 1000;
+
GetAgent()->OnMessageRead(true, BATTOR_MESSAGE_TYPE_CONTROL_ACK,
- ToCharVector(BattOrEEPROM()));
+ ToCharVector(eeprom));
GetTaskRunner()->RunUntilIdle();
if (end_state == BattOrAgentState::EEPROM_RECEIVED)
@@ -246,6 +256,7 @@ class BattOrAgentTest : public testing::Test, public BattOrAgent::Listener {
bool IsCommandComplete() { return is_command_complete_; }
BattOrError GetCommandError() { return command_error_; }
+ std::string GetTrace() { return trace_; }
private:
scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
@@ -255,7 +266,7 @@ class BattOrAgentTest : public testing::Test, public BattOrAgent::Listener {
scoped_ptr<TestableBattOrAgent> agent_;
bool is_command_complete_;
BattOrError command_error_;
- std::string stop_tracing_trace_;
+ std::string trace_;
};
TEST_F(BattOrAgentTest, StartTracing) {
@@ -467,6 +478,8 @@ TEST_F(BattOrAgentTest, StopTracing) {
EXPECT_TRUE(IsCommandComplete());
EXPECT_EQ(BATTOR_ERROR_NONE, GetCommandError());
+ EXPECT_EQ("0.00 -0.3 -0.6\n1.00 0.3 0.6\n2.00 0.9 1.8\n3.00 -0.3 -0.6\n",
+ GetTrace());
}
TEST_F(BattOrAgentTest, StopTracingFailsWithoutConnection) {
« no previous file with comments | « tools/battor_agent/battor_agent.cc ('k') | tools/battor_agent/battor_protocol_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698