13 #include <gmock/gmock.h> 14 #include <gtest/gtest.h> 25 : OnSuccessCallCount(0)
30 virtual void OnSuccess()
override 35 virtual void OnError(
const std::exception & exc)
override 41 volatile unsigned OnSuccessCallCount;
42 volatile unsigned OnErrorCallCount;
49 void ThrowsException()
51 throw std::logic_error(
"oppps!");
56 TEST(Thread, CallsOnSuccess)
58 TestThreadObserver observer;
60 Common::Thread thread(std::function<
void()>(DoNothing), &observer);
62 EXPECT_EQ(observer.OnSuccessCallCount, 1);
68 TestThreadObserver observer;
70 Common::Thread thread(std::function<
void()>(ThrowsException), &observer);
72 EXPECT_EQ(observer.OnSuccessCallCount, 0);
void Join()
Wait until started thread stop.
TEST(GTestEnvVarTest, Dummy)
#define EXPECT_EQ(expected, actual)