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/scheduler_worker_pool_impl.h" | 5 #include "base/task_scheduler/scheduler_worker_pool_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <unordered_set> | 10 #include <unordered_set> |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 // beginning of the test. | 591 // beginning of the test. |
592 EXPECT_EQ(static_cast<int>(kNumWorkersInWorkerPool), | 592 EXPECT_EQ(static_cast<int>(kNumWorkersInWorkerPool), |
593 histogram->SnapshotSamples()->GetCount(1)); | 593 histogram->SnapshotSamples()->GetCount(1)); |
594 EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(10)); | 594 EXPECT_EQ(0, histogram->SnapshotSamples()->GetCount(10)); |
595 | 595 |
596 tasks_can_exit_event.Signal(); | 596 tasks_can_exit_event.Signal(); |
597 worker_pool_->WaitForAllWorkersIdleForTesting(); | 597 worker_pool_->WaitForAllWorkersIdleForTesting(); |
598 worker_pool_->DisallowWorkerDetachmentForTesting(); | 598 worker_pool_->DisallowWorkerDetachmentForTesting(); |
599 } | 599 } |
600 | 600 |
601 // TODO(crbug.com/698046): disabled due to flakyness. | |
602 TEST_F(TaskSchedulerWorkerPoolHistogramTest, NumTasksBeforeDetach) { | 601 TEST_F(TaskSchedulerWorkerPoolHistogramTest, NumTasksBeforeDetach) { |
603 InitializeWorkerPool(kReclaimTimeForDetachTests, kNumWorkersInWorkerPool); | 602 InitializeWorkerPool(kReclaimTimeForDetachTests, kNumWorkersInWorkerPool); |
604 | 603 |
605 auto histogrammed_thread_task_runner = | 604 auto histogrammed_thread_task_runner = |
606 worker_pool_->CreateSequencedTaskRunnerWithTraits( | 605 worker_pool_->CreateSequencedTaskRunnerWithTraits( |
607 TaskTraits().WithBaseSyncPrimitives()); | 606 TaskTraits().WithBaseSyncPrimitives()); |
608 | 607 |
609 // Post 3 tasks and hold the thread for idle thread stack ordering. | 608 // Post 3 tasks and hold the thread for idle thread stack ordering. |
610 // This test assumes |histogrammed_thread_task_runner| gets assigned the same | 609 // This test assumes |histogrammed_thread_task_runner| gets assigned the same |
611 // thread for each of its tasks. | 610 // thread for each of its tasks. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 StandbyThreadPolicy::ONE, 8U, TimeDelta::Max()), | 734 StandbyThreadPolicy::ONE, 8U, TimeDelta::Max()), |
736 Bind(&NotReachedReEnqueueSequenceCallback), &task_tracker, | 735 Bind(&NotReachedReEnqueueSequenceCallback), &task_tracker, |
737 &delayed_task_manager); | 736 &delayed_task_manager); |
738 ASSERT_TRUE(worker_pool); | 737 ASSERT_TRUE(worker_pool); |
739 EXPECT_EQ(1U, worker_pool->NumberOfAliveWorkersForTesting()); | 738 EXPECT_EQ(1U, worker_pool->NumberOfAliveWorkersForTesting()); |
740 worker_pool->JoinForTesting(); | 739 worker_pool->JoinForTesting(); |
741 } | 740 } |
742 | 741 |
743 } // namespace internal | 742 } // namespace internal |
744 } // namespace base | 743 } // namespace base |
OLD | NEW |