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

Side by Side Diff: cc/base/delayed_unique_notifier_unittest.cc

Issue 2331423002: Replace TestSimpleTaskRunner::GetPendingTasks with TakePendingTasks (Closed)
Patch Set: split test Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <deque> 5 #include <deque>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/test/test_pending_task.h" 9 #include "base/test/test_pending_task.h"
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
(...skipping 27 matching lines...) Expand all
38 void SetUp() override { 38 void SetUp() override {
39 notification_count_ = 0; 39 notification_count_ = 0;
40 task_runner_ = make_scoped_refptr(new base::TestSimpleTaskRunner); 40 task_runner_ = make_scoped_refptr(new base::TestSimpleTaskRunner);
41 } 41 }
42 42
43 void Notify() { ++notification_count_; } 43 void Notify() { ++notification_count_; }
44 44
45 int NotificationCount() const { return notification_count_; } 45 int NotificationCount() const { return notification_count_; }
46 46
47 std::deque<base::TestPendingTask> TakePendingTasks() { 47 std::deque<base::TestPendingTask> TakePendingTasks() {
48 std::deque<base::TestPendingTask> tasks = task_runner_->GetPendingTasks(); 48 return task_runner_->TakePendingTasks();
49 task_runner_->ClearPendingTasks();
50 return tasks;
51 } 49 }
52 50
53 protected: 51 protected:
54 int notification_count_; 52 int notification_count_;
55 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; 53 scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
56 }; 54 };
57 55
58 TEST_F(DelayedUniqueNotifierTest, ZeroDelay) { 56 TEST_F(DelayedUniqueNotifierTest, ZeroDelay) {
59 base::TimeDelta delay = base::TimeDelta::FromInternalValue(0); 57 base::TimeDelta delay = base::TimeDelta::FromInternalValue(0);
60 TestNotifier notifier( 58 TestNotifier notifier(
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 ASSERT_EQ(0u, tasks.size()); 324 ASSERT_EQ(0u, tasks.size());
327 325
328 // Verify after the scheduled time happens there is still no task. 326 // Verify after the scheduled time happens there is still no task.
329 notifier.SetNow(notifier.Now() + delay); 327 notifier.SetNow(notifier.Now() + delay);
330 tasks = TakePendingTasks(); 328 tasks = TakePendingTasks();
331 ASSERT_EQ(0u, tasks.size()); 329 ASSERT_EQ(0u, tasks.size());
332 } 330 }
333 331
334 } // namespace 332 } // namespace
335 } // namespace cc 333 } // namespace cc
OLDNEW
« no previous file with comments | « base/test/test_simple_task_runner.cc ('k') | chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698