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

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

Issue 734063004: Update from https://crrev.com/304418 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « cc/PRESUBMIT.py ('k') | cc/base/unique_notifier_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 17 matching lines...) Expand all
28 void SetNow(base::TimeTicks now) { now_ = now; } 28 void SetNow(base::TimeTicks now) { now_ = now; }
29 29
30 private: 30 private:
31 base::TimeTicks now_; 31 base::TimeTicks now_;
32 }; 32 };
33 33
34 class DelayedUniqueNotifierTest : public testing::Test { 34 class DelayedUniqueNotifierTest : public testing::Test {
35 public: 35 public:
36 DelayedUniqueNotifierTest() : notification_count_(0) {} 36 DelayedUniqueNotifierTest() : notification_count_(0) {}
37 37
38 virtual 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 std::deque<base::TestPendingTask> tasks = task_runner_->GetPendingTasks();
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 ASSERT_EQ(0u, tasks.size()); 326 ASSERT_EQ(0u, tasks.size());
327 327
328 // Verify after the scheduled time happens there is still no task. 328 // Verify after the scheduled time happens there is still no task.
329 notifier.SetNow(notifier.Now() + delay); 329 notifier.SetNow(notifier.Now() + delay);
330 tasks = TakePendingTasks(); 330 tasks = TakePendingTasks();
331 ASSERT_EQ(0u, tasks.size()); 331 ASSERT_EQ(0u, tasks.size());
332 } 332 }
333 333
334 } // namespace 334 } // namespace
335 } // namespace cc 335 } // namespace cc
OLDNEW
« no previous file with comments | « cc/PRESUBMIT.py ('k') | cc/base/unique_notifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698