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/task_scheduler/task_tracker.h" | 5 #include "base/task_scheduler/task_tracker.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 // Set the singleton allowed bit to the opposite of what it is expected to be | 375 // Set the singleton allowed bit to the opposite of what it is expected to be |
376 // when |tracker| runs |task| to verify that |tracker| actually sets the | 376 // when |tracker| runs |task| to verify that |tracker| actually sets the |
377 // correct value. | 377 // correct value. |
378 ScopedSetSingletonAllowed scoped_singleton_allowed(!can_use_singletons); | 378 ScopedSetSingletonAllowed scoped_singleton_allowed(!can_use_singletons); |
379 | 379 |
380 // Running the task should fail iff the task isn't allowed to use singletons. | 380 // Running the task should fail iff the task isn't allowed to use singletons. |
381 if (can_use_singletons) { | 381 if (can_use_singletons) { |
382 tracker.RunNextTaskInSequence( | 382 tracker.RunNextTaskInSequence( |
383 CreateSequenceWithTask(std::move(task)).get()); | 383 CreateSequenceWithTask(std::move(task)).get()); |
384 } else { | 384 } else { |
385 #if !defined(OS_LINUX) // http://crbug.com/634552 | |
386 EXPECT_DCHECK_DEATH( | 385 EXPECT_DCHECK_DEATH( |
387 { | 386 { |
388 tracker.RunNextTaskInSequence( | 387 tracker.RunNextTaskInSequence( |
389 CreateSequenceWithTask(std::move(task)).get()); | 388 CreateSequenceWithTask(std::move(task)).get()); |
390 }); | 389 }); |
391 #endif // !defined(OS_LINUX) | |
392 } | 390 } |
393 } | 391 } |
394 | 392 |
395 static void RunTaskRunnerHandleVerificationTask( | 393 static void RunTaskRunnerHandleVerificationTask( |
396 TaskTracker* tracker, | 394 TaskTracker* tracker, |
397 std::unique_ptr<Task> verify_task) { | 395 std::unique_ptr<Task> verify_task) { |
398 // Pretend |verify_task| is posted to respect TaskTracker's contract. | 396 // Pretend |verify_task| is posted to respect TaskTracker's contract. |
399 EXPECT_TRUE(tracker->WillPostTask(verify_task.get())); | 397 EXPECT_TRUE(tracker->WillPostTask(verify_task.get())); |
400 | 398 |
401 // Confirm that the test conditions are right (no TaskRunnerHandles set | 399 // Confirm that the test conditions are right (no TaskRunnerHandles set |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 | 638 |
641 // Unblock shutdown by running |block_shutdown_task|. | 639 // Unblock shutdown by running |block_shutdown_task|. |
642 tracker_.RunNextTaskInSequence( | 640 tracker_.RunNextTaskInSequence( |
643 CreateSequenceWithTask(std::move(block_shutdown_task)).get()); | 641 CreateSequenceWithTask(std::move(block_shutdown_task)).get()); |
644 EXPECT_EQ(kLoadTestNumIterations + 1, NumTasksExecuted()); | 642 EXPECT_EQ(kLoadTestNumIterations + 1, NumTasksExecuted()); |
645 WAIT_FOR_ASYNC_SHUTDOWN_COMPLETED(); | 643 WAIT_FOR_ASYNC_SHUTDOWN_COMPLETED(); |
646 } | 644 } |
647 | 645 |
648 } // namespace internal | 646 } // namespace internal |
649 } // namespace base | 647 } // namespace base |
OLD | NEW |