| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mac/libdispatch_task_runner.h" | 5 #include "base/mac/libdispatch_task_runner.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/mac/bind_objc_block.h" | 8 #include "base/mac/bind_objc_block.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 })); | 119 })); |
| 120 DispatchLastTask(); | 120 DispatchLastTask(); |
| 121 | 121 |
| 122 const char* const expectations[] = { | 122 const char* const expectations[] = { |
| 123 "BEGIN MessageLoop = 0x0", | 123 "BEGIN MessageLoop = 0x0", |
| 124 "END MessageLoop = 0x0" | 124 "END MessageLoop = 0x0" |
| 125 }; | 125 }; |
| 126 VerifyTaskOrder(expectations, arraysize(expectations)); | 126 VerifyTaskOrder(expectations, arraysize(expectations)); |
| 127 } | 127 } |
| 128 | 128 |
| 129 TEST_F(LibDispatchTaskRunnerTest, DispatchAndPostTasks) { | 129 // This test is flaky, see http://crbug.com/165117. |
| 130 TEST_F(LibDispatchTaskRunnerTest, FLAKY_DispatchAndPostTasks) { |
| 130 dispatch_async(task_runner_->GetDispatchQueue(), ^{ | 131 dispatch_async(task_runner_->GetDispatchQueue(), ^{ |
| 131 TaskOrderMarker marker(this, "First Block"); | 132 TaskOrderMarker marker(this, "First Block"); |
| 132 task_runner_->PostTask(FROM_HERE, | 133 task_runner_->PostTask(FROM_HERE, |
| 133 BoundRecordTaskOrder(this, "Second Task")); | 134 BoundRecordTaskOrder(this, "Second Task")); |
| 134 }); | 135 }); |
| 135 task_runner_->PostTask(FROM_HERE, BoundRecordTaskOrder(this, "First Task")); | 136 task_runner_->PostTask(FROM_HERE, BoundRecordTaskOrder(this, "First Task")); |
| 136 dispatch_async(task_runner_->GetDispatchQueue(), ^{ | 137 dispatch_async(task_runner_->GetDispatchQueue(), ^{ |
| 137 TaskOrderMarker marker(this, "Second Block"); | 138 TaskOrderMarker marker(this, "Second Block"); |
| 138 }); | 139 }); |
| 139 DispatchLastTask(); | 140 DispatchLastTask(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 "END First", | 193 "END First", |
| 193 "BEGIN Second", | 194 "BEGIN Second", |
| 194 "END Second", | 195 "END Second", |
| 195 "BEGIN Timed", | 196 "BEGIN Timed", |
| 196 "END Timed", | 197 "END Timed", |
| 197 }; | 198 }; |
| 198 VerifyTaskOrder(expectations, arraysize(expectations)); | 199 VerifyTaskOrder(expectations, arraysize(expectations)); |
| 199 | 200 |
| 200 EXPECT_GE(run_time, post_time + delta); | 201 EXPECT_GE(run_time, post_time + delta); |
| 201 } | 202 } |
| OLD | NEW |