Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(285)

Side by Side Diff: base/threading/sequenced_worker_pool_unittest.cc

Issue 146833008: Threading: Remove TaskRunnerHandlesNonZeroDelays from TaskRunnerTestDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/test/task_runner_test_template.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 825
826 void StopTaskRunner() { 826 void StopTaskRunner() {
827 // Make sure all tasks are run before shutting down. Delayed tasks are 827 // Make sure all tasks are run before shutting down. Delayed tasks are
828 // not run, they're simply deleted. 828 // not run, they're simply deleted.
829 pool_owner_->pool()->FlushForTesting(); 829 pool_owner_->pool()->FlushForTesting();
830 pool_owner_->pool()->Shutdown(); 830 pool_owner_->pool()->Shutdown();
831 // Don't reset |pool_owner_| here, as the test may still hold a 831 // Don't reset |pool_owner_| here, as the test may still hold a
832 // reference to the pool. 832 // reference to the pool.
833 } 833 }
834 834
835 bool TaskRunnerHandlesNonZeroDelays() const {
836 return true;
837 }
838
839 private: 835 private:
840 MessageLoop message_loop_; 836 MessageLoop message_loop_;
841 scoped_ptr<SequencedWorkerPoolOwner> pool_owner_; 837 scoped_ptr<SequencedWorkerPoolOwner> pool_owner_;
842 }; 838 };
843 839
844 INSTANTIATE_TYPED_TEST_CASE_P( 840 INSTANTIATE_TYPED_TEST_CASE_P(
845 SequencedWorkerPool, TaskRunnerTest, 841 SequencedWorkerPool, TaskRunnerTest,
846 SequencedWorkerPoolTaskRunnerTestDelegate); 842 SequencedWorkerPoolTaskRunnerTestDelegate);
847 843
848 class SequencedWorkerPoolTaskRunnerWithShutdownBehaviorTestDelegate { 844 class SequencedWorkerPoolTaskRunnerWithShutdownBehaviorTestDelegate {
(...skipping 16 matching lines...) Expand all
865 861
866 void StopTaskRunner() { 862 void StopTaskRunner() {
867 // Make sure all tasks are run before shutting down. Delayed tasks are 863 // Make sure all tasks are run before shutting down. Delayed tasks are
868 // not run, they're simply deleted. 864 // not run, they're simply deleted.
869 pool_owner_->pool()->FlushForTesting(); 865 pool_owner_->pool()->FlushForTesting();
870 pool_owner_->pool()->Shutdown(); 866 pool_owner_->pool()->Shutdown();
871 // Don't reset |pool_owner_| here, as the test may still hold a 867 // Don't reset |pool_owner_| here, as the test may still hold a
872 // reference to the pool. 868 // reference to the pool.
873 } 869 }
874 870
875 bool TaskRunnerHandlesNonZeroDelays() const {
876 return true;
877 }
878
879 private: 871 private:
880 MessageLoop message_loop_; 872 MessageLoop message_loop_;
881 scoped_ptr<SequencedWorkerPoolOwner> pool_owner_; 873 scoped_ptr<SequencedWorkerPoolOwner> pool_owner_;
882 scoped_refptr<TaskRunner> task_runner_; 874 scoped_refptr<TaskRunner> task_runner_;
883 }; 875 };
884 876
885 INSTANTIATE_TYPED_TEST_CASE_P( 877 INSTANTIATE_TYPED_TEST_CASE_P(
886 SequencedWorkerPoolTaskRunner, TaskRunnerTest, 878 SequencedWorkerPoolTaskRunner, TaskRunnerTest,
887 SequencedWorkerPoolTaskRunnerWithShutdownBehaviorTestDelegate); 879 SequencedWorkerPoolTaskRunnerWithShutdownBehaviorTestDelegate);
888 880
(...skipping 17 matching lines...) Expand all
906 898
907 void StopTaskRunner() { 899 void StopTaskRunner() {
908 // Make sure all tasks are run before shutting down. Delayed tasks are 900 // Make sure all tasks are run before shutting down. Delayed tasks are
909 // not run, they're simply deleted. 901 // not run, they're simply deleted.
910 pool_owner_->pool()->FlushForTesting(); 902 pool_owner_->pool()->FlushForTesting();
911 pool_owner_->pool()->Shutdown(); 903 pool_owner_->pool()->Shutdown();
912 // Don't reset |pool_owner_| here, as the test may still hold a 904 // Don't reset |pool_owner_| here, as the test may still hold a
913 // reference to the pool. 905 // reference to the pool.
914 } 906 }
915 907
916 bool TaskRunnerHandlesNonZeroDelays() const {
917 return true;
918 }
919
920 private: 908 private:
921 MessageLoop message_loop_; 909 MessageLoop message_loop_;
922 scoped_ptr<SequencedWorkerPoolOwner> pool_owner_; 910 scoped_ptr<SequencedWorkerPoolOwner> pool_owner_;
923 scoped_refptr<SequencedTaskRunner> task_runner_; 911 scoped_refptr<SequencedTaskRunner> task_runner_;
924 }; 912 };
925 913
926 INSTANTIATE_TYPED_TEST_CASE_P( 914 INSTANTIATE_TYPED_TEST_CASE_P(
927 SequencedWorkerPoolSequencedTaskRunner, TaskRunnerTest, 915 SequencedWorkerPoolSequencedTaskRunner, TaskRunnerTest,
928 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); 916 SequencedWorkerPoolSequencedTaskRunnerTestDelegate);
929 917
930 INSTANTIATE_TYPED_TEST_CASE_P( 918 INSTANTIATE_TYPED_TEST_CASE_P(
931 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, 919 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest,
932 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); 920 SequencedWorkerPoolSequencedTaskRunnerTestDelegate);
933 921
934 } // namespace 922 } // namespace
935 923
936 } // namespace base 924 } // namespace base
OLDNEW
« no previous file with comments | « base/test/task_runner_test_template.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698