| Index: base/message_loop_unittest.cc
|
| diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
|
| index 15f825b7ac992eb791ecc2332819e7a03b160896..6d264fd0dd50597f781a0f6d991424ce36a5f45a 100644
|
| --- a/base/message_loop_unittest.cc
|
| +++ b/base/message_loop_unittest.cc
|
| @@ -1689,3 +1689,24 @@ TEST(MessageLoopTest, DestructionObserverTest) {
|
| EXPECT_TRUE(task_destroyed);
|
| EXPECT_TRUE(destruction_observer_called);
|
| }
|
| +
|
| +// Verify that MessageLoop sets ThreadMainTaskRunner::current() and it
|
| +// posts tasks on that message loop.
|
| +TEST(MessageLoopTest, ThreadMainTaskRunner) {
|
| + MessageLoop loop;
|
| +
|
| + scoped_refptr<Foo> foo(new Foo());
|
| + std::string a("a");
|
| + base::ThreadMainTaskRunner::current()->PostTask(FROM_HERE, base::Bind(
|
| + &Foo::Test1ConstRef, foo.get(), a));
|
| +
|
| + // Post quit task;
|
| + MessageLoop::current()->PostTask(FROM_HERE, base::Bind(
|
| + &MessageLoop::Quit, base::Unretained(MessageLoop::current())));
|
| +
|
| + // Now kick things off
|
| + MessageLoop::current()->Run();
|
| +
|
| + EXPECT_EQ(foo->test_count(), 1);
|
| + EXPECT_EQ(foo->result(), "a");
|
| +}
|
|
|