make the claw and fridge tests use standard infrastructure

Change-Id: I65cbc5e665ecb8099abf41e2503c2b0e80ad3f88
diff --git a/aos/common/controls/control_loop_test.cc b/aos/common/controls/control_loop_test.cc
index ab47477..a8deecf 100644
--- a/aos/common/controls/control_loop_test.cc
+++ b/aos/common/controls/control_loop_test.cc
@@ -7,6 +7,9 @@
 namespace aos {
 namespace testing {
 
+constexpr ::aos::time::Time ControlLoopTest::kTimeTick;
+constexpr ::aos::time::Time ControlLoopTest::kDSPacketTime;
+
 ControlLoopTest::ControlLoopTest() {
   ::aos::robot_state.Clear();
   ::aos::controls::sensor_generation.Clear();
@@ -29,17 +32,15 @@
   ::aos::time::Time::DisableMockTime();
 }
 
-void ControlLoopTest::SimulateTimestep(bool enabled) {
-  if (sent_robot_state_last_time_) {
-    sent_robot_state_last_time_ = false;
-  } else {
+void ControlLoopTest::SendMessages(bool enabled) {
+  if (current_time_ - last_ds_time_ >= kDSPacketTime) {
     ::aos::robot_state.MakeWithBuilder()
         .enabled(enabled)
         .autonomous(false)
         .fake(true)
         .team_id(971)
         .Send();
-    sent_robot_state_last_time_ = true;
+    last_ds_time_ = current_time_;
   }
   if (enabled) {
     // TODO(brians): Actually make this realistic once we figure out what that
@@ -49,8 +50,6 @@
         .pulse_length(0)
         .Send();
   }
-  ::aos::time::Time::SetMockTime(current_time_ +=
-                                 ::aos::time::Time::InMS(10.0));
 }
 
 }  // namespace testing
diff --git a/aos/common/controls/control_loop_test.h b/aos/common/controls/control_loop_test.h
index de048ba..76c68d3 100644
--- a/aos/common/controls/control_loop_test.h
+++ b/aos/common/controls/control_loop_test.h
@@ -17,14 +17,27 @@
 class ControlLoopTest : public ::testing::Test {
  public:
   ControlLoopTest();
-
   virtual ~ControlLoopTest();
 
-  // Simulates everything that happens during 1 time step.
-  void SimulateTimestep(bool enabled);
+  // Sends out all of the required queue messages.
+  void SendMessages(bool enabled);
+  // Ticks time for a single control loop cycle.
+  void TickTime() {
+    ::aos::time::Time::SetMockTime(current_time_ += kTimeTick);
+  }
+
+  // Simulates everything that happens during 1 loop time step.
+  void SimulateTimestep(bool enabled) {
+    SendMessages(enabled);
+    TickTime();
+  }
 
  private:
-  bool sent_robot_state_last_time_ = false;
+  static constexpr ::aos::time::Time kTimeTick = ::aos::time::Time::InUS(10000);
+  static constexpr ::aos::time::Time kDSPacketTime =
+      ::aos::time::Time::InMS(20);
+
+  ::aos::time::Time last_ds_time_ = ::aos::time::Time::InSeconds(0);
   ::aos::time::Time current_time_ = ::aos::time::Time::InSeconds(0);
 
   ::aos::common::testing::GlobalCoreInstance my_core;