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

Side by Side Diff: base/task_scheduler/task_tracker_unittest.cc

Issue 2812073002: Reduce the number of threads created by the load TaskTracker tests. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | 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 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 <utility> 10 #include <utility>
(...skipping 25 matching lines...) Expand all
36 #include "base/threading/simple_thread.h" 36 #include "base/threading/simple_thread.h"
37 #include "base/threading/thread_restrictions.h" 37 #include "base/threading/thread_restrictions.h"
38 #include "base/threading/thread_task_runner_handle.h" 38 #include "base/threading/thread_task_runner_handle.h"
39 #include "testing/gtest/include/gtest/gtest.h" 39 #include "testing/gtest/include/gtest/gtest.h"
40 40
41 namespace base { 41 namespace base {
42 namespace internal { 42 namespace internal {
43 43
44 namespace { 44 namespace {
45 45
46 constexpr size_t kLoadTestNumIterations = 100; 46 constexpr size_t kLoadTestNumIterations = 75;
47 47
48 // Invokes a closure asynchronously. 48 // Invokes a closure asynchronously.
49 class CallbackThread : public SimpleThread { 49 class CallbackThread : public SimpleThread {
50 public: 50 public:
51 explicit CallbackThread(const Closure& closure) 51 explicit CallbackThread(const Closure& closure)
52 : SimpleThread("CallbackThread"), closure_(closure) {} 52 : SimpleThread("CallbackThread"), closure_(closure) {}
53 53
54 // Returns true once the callback returns. 54 // Returns true once the callback returns.
55 bool has_returned() { return has_returned_.IsSet(); } 55 bool has_returned() { return has_returned_.IsSet(); }
56 56
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 ASSERT_TRUE(tracker.WillPostTask(task.get())); 943 ASSERT_TRUE(tracker.WillPostTask(task.get()));
944 944
945 HistogramTester tester; 945 HistogramTester tester;
946 EXPECT_TRUE(tracker.RunTask(std::move(task), SequenceToken::Create())); 946 EXPECT_TRUE(tracker.RunTask(std::move(task), SequenceToken::Create()));
947 tester.ExpectTotalCount(test.expected_histogram, 1); 947 tester.ExpectTotalCount(test.expected_histogram, 1);
948 } 948 }
949 } 949 }
950 950
951 } // namespace internal 951 } // namespace internal
952 } // namespace base 952 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698