This source file includes following definitions.
- SetFlagTask
- TEST
#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_loop.h"
#include "remoting/base/auto_thread_task_runner.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
void SetFlagTask(bool* success) {
*success = true;
}
}
namespace remoting {
TEST(AutoThreadTaskRunnerTest, StartAndStop) {
base::MessageLoop message_loop;
scoped_refptr<AutoThreadTaskRunner> task_runner = new AutoThreadTaskRunner(
message_loop.message_loop_proxy(), base::MessageLoop::QuitClosure());
bool success = false;
message_loop.PostTask(FROM_HERE, base::Bind(&SetFlagTask, &success));
task_runner = NULL;
message_loop.Run();
EXPECT_TRUE(success);
}
}