title: How can I test a call is made after a delay in google test using a mocking framework
body: <p>I'm currently trying to evaluate different testing frameworks.  When using mocking frameworks (I'm leaning towards FakeIt, but google mock is good too), I know that you can roll your own "performance" testing by using the OS's timer calls before and after calling a function to verify the function's performance.  This is not what I'm after.</p>
  
  <p>What I do have are classes that implement delays on outputs given certain inputs.  For example:</p>
  
  <ul>
  <li>input 1 goes from low to high</li>
  <li>output 1 goes from low to high <strong>after</strong> 1.5 seconds.</li>
  </ul>
  
  <p>I'd like to be able to do something where I specify a boundary: </p>
  
  <pre><code>myMock.theInput();
  EXPECT_CALL(myMock, theDelayedOutput())
    .Times(1)
    .Before(1.6sec)
    .After(1.4sec);
  </code></pre>
  
  <p>For clarification, the <code>Before</code> and <code>After</code> lines are not supported.  This is just an example of what I'd prefer as an easy syntax.</p>
  
  <p>Is it possible to just implement a "delay" function within windows between making the input call and before checking <code>EXPECT_CALL</code>?</p>
  
  <p>That's part of the way - I'd still have to then start a proprietary timer.  Something like this?</p>
  
  <pre><code>myMock.theInput();
  windowSleep(1.4);
  startTimer();
  EXPECT_CALL(myMock, theDelayedOutput())
    .Times(1)
  endTimer();
  ASSERT_TRUE(elapsedTime() &lt;= 0.2);
  </code></pre>