Index: extensions/common/one_shot_event_unittest.cc |
diff --git a/extensions/common/one_shot_event_unittest.cc b/extensions/common/one_shot_event_unittest.cc |
index db0bca9fc8846c62f84b6a6b2c85d21b15cffc95..6393f9a640ce2bf0e152b235eb1e6e0169022e42 100644 |
--- a/extensions/common/one_shot_event_unittest.cc |
+++ b/extensions/common/one_shot_event_unittest.cc |
@@ -23,6 +23,23 @@ TEST(OneShotEventTest, RecordsSignal) { |
EXPECT_TRUE(event.is_signaled()); |
} |
+TEST(OneShotEventTest, CallsQueueAsDistinctTask) { |
+ OneShotEvent event; |
+ scoped_refptr<base::TestSimpleTaskRunner> runner( |
+ new base::TestSimpleTaskRunner); |
+ int i = 0; |
+ event.Post(FROM_HERE, base::Bind(&Increment, &i), runner); |
+ event.Post(FROM_HERE, base::Bind(&Increment, &i), runner); |
+ EXPECT_EQ(0U, runner->NumPendingTasks()); |
+ event.Signal(); |
+ |
+ auto pending_tasks = runner->TakePendingTasks(); |
+ ASSERT_EQ(2U, pending_tasks.size()); |
+ EXPECT_NE(pending_tasks[0].location.line_number(), |
+ pending_tasks[1].location.line_number()) |
+ << "Make sure FROM_HERE is propagated."; |
+} |
+ |
TEST(OneShotEventTest, CallsQueue) { |
OneShotEvent event; |
scoped_refptr<base::TestSimpleTaskRunner> runner( |
@@ -33,9 +50,7 @@ TEST(OneShotEventTest, CallsQueue) { |
EXPECT_EQ(0U, runner->NumPendingTasks()); |
event.Signal(); |
ASSERT_EQ(2U, runner->NumPendingTasks()); |
- EXPECT_NE(runner->GetPendingTasks()[0].location.line_number(), |
- runner->GetPendingTasks()[1].location.line_number()) |
- << "Make sure FROM_HERE is propagated."; |
+ |
EXPECT_EQ(0, i); |
runner->RunPendingTasks(); |
EXPECT_EQ(2, i); |