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/threading/sequenced_worker_pool.h" | 5 #include "base/threading/sequenced_worker_pool.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 size_t started_events_; | 176 size_t started_events_; |
177 }; | 177 }; |
178 | 178 |
179 class SequencedWorkerPoolTest : public testing::Test { | 179 class SequencedWorkerPoolTest : public testing::Test { |
180 public: | 180 public: |
181 SequencedWorkerPoolTest() | 181 SequencedWorkerPoolTest() |
182 : tracker_(new TestTracker) { | 182 : tracker_(new TestTracker) { |
183 ResetPool(); | 183 ResetPool(); |
184 } | 184 } |
185 | 185 |
186 virtual ~SequencedWorkerPoolTest() {} | 186 void TearDown() override { pool()->Shutdown(); } |
187 | |
188 virtual void SetUp() override {} | |
189 | |
190 virtual void TearDown() override { | |
191 pool()->Shutdown(); | |
192 } | |
193 | 187 |
194 const scoped_refptr<SequencedWorkerPool>& pool() { | 188 const scoped_refptr<SequencedWorkerPool>& pool() { |
195 return pool_owner_->pool(); | 189 return pool_owner_->pool(); |
196 } | 190 } |
197 TestTracker* tracker() { return tracker_.get(); } | 191 TestTracker* tracker() { return tracker_.get(); } |
198 | 192 |
199 // Destroys the SequencedWorkerPool instance, blocking until it is fully shut | 193 // Destroys the SequencedWorkerPool instance, blocking until it is fully shut |
200 // down, and creates a new instance. | 194 // down, and creates a new instance. |
201 void ResetPool() { | 195 void ResetPool() { |
202 pool_owner_.reset(new SequencedWorkerPoolOwner(kNumWorkerThreads, "test")); | 196 pool_owner_.reset(new SequencedWorkerPoolOwner(kNumWorkerThreads, "test")); |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 SequencedWorkerPoolSequencedTaskRunner, TaskRunnerTest, | 909 SequencedWorkerPoolSequencedTaskRunner, TaskRunnerTest, |
916 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 910 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
917 | 911 |
918 INSTANTIATE_TYPED_TEST_CASE_P( | 912 INSTANTIATE_TYPED_TEST_CASE_P( |
919 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, | 913 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, |
920 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 914 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
921 | 915 |
922 } // namespace | 916 } // namespace |
923 | 917 |
924 } // namespace base | 918 } // namespace base |
OLD | NEW |