OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/threading/post_task_and_reply_impl.h" | 5 #include "base/threading/post_task_and_reply_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // Expect no reply in |reply_runner|. | 91 // Expect no reply in |reply_runner|. |
92 EXPECT_FALSE(reply_runner->HasPendingTask()); | 92 EXPECT_FALSE(reply_runner->HasPendingTask()); |
93 | 93 |
94 // Expect the task to be posted to |post_runner|. | 94 // Expect the task to be posted to |post_runner|. |
95 EXPECT_TRUE(post_runner->HasPendingTask()); | 95 EXPECT_TRUE(post_runner->HasPendingTask()); |
96 EXPECT_CALL(mock_object, Task(_)); | 96 EXPECT_CALL(mock_object, Task(_)); |
97 post_runner->RunUntilIdle(); | 97 post_runner->RunUntilIdle(); |
98 testing::Mock::VerifyAndClear(&mock_object); | 98 testing::Mock::VerifyAndClear(&mock_object); |
99 | 99 |
100 // Expect the task's argument not to have been deleted yet. | 100 // Expect the task's argument to have been deleted. |
101 EXPECT_FALSE(delete_flag); | 101 EXPECT_TRUE(delete_flag); |
102 | 102 |
103 // Expect the reply to be posted to |reply_runner|. | 103 // Expect the reply to be posted to |reply_runner|. |
104 EXPECT_FALSE(post_runner->HasPendingTask()); | 104 EXPECT_FALSE(post_runner->HasPendingTask()); |
105 EXPECT_TRUE(reply_runner->HasPendingTask()); | 105 EXPECT_TRUE(reply_runner->HasPendingTask()); |
106 EXPECT_CALL(mock_object, ReplyMock()); | 106 EXPECT_CALL(mock_object, ReplyMock()); |
107 reply_runner->RunUntilIdle(); | 107 reply_runner->RunUntilIdle(); |
108 testing::Mock::VerifyAndClear(&mock_object); | 108 testing::Mock::VerifyAndClear(&mock_object); |
109 EXPECT_TRUE(delete_flag); | 109 EXPECT_TRUE(delete_flag); |
110 | 110 |
111 // Expect no pending task in |post_runner| and |reply_runner|. | 111 // Expect no pending task in |post_runner| and |reply_runner|. |
112 EXPECT_FALSE(post_runner->HasPendingTask()); | 112 EXPECT_FALSE(post_runner->HasPendingTask()); |
113 EXPECT_FALSE(reply_runner->HasPendingTask()); | 113 EXPECT_FALSE(reply_runner->HasPendingTask()); |
114 } | 114 } |
115 | 115 |
116 } // namespace internal | 116 } // namespace internal |
117 } // namespace base | 117 } // namespace base |
OLD | NEW |