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

Side by Side Diff: base/task/cancelable_task_tracker_unittest.cc

Issue 1048373003: CancelableTaskTracker::PostDelayedTask() support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unnecessary base:: Created 5 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 | « base/task/cancelable_task_tracker.cc ('k') | base/task_runner.h » ('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 "base/task/cancelable_task_tracker.h" 5 #include "base/task/cancelable_task_tracker.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 423
424 bad_thread.message_loop_proxy()->PostTask( 424 bad_thread.message_loop_proxy()->PostTask(
425 FROM_HERE, 425 FROM_HERE,
426 Bind(&MaybeRunDeadlyTaskTrackerMemberFunction, 426 Bind(&MaybeRunDeadlyTaskTrackerMemberFunction,
427 Unretained(&task_tracker_), 427 Unretained(&task_tracker_),
428 Bind(&CancelableTaskTracker::TryCancelAll))); 428 Bind(&CancelableTaskTracker::TryCancelAll)));
429 429
430 test_task_runner->RunUntilIdle(); 430 test_task_runner->RunUntilIdle();
431 } 431 }
432 432
433 TEST_F(CancelableTaskTrackerTest, PostDelayedTask) {
434 scoped_refptr<TestSimpleTaskRunner> test_task_runner(
435 new TestSimpleTaskRunner());
436
437 EXPECT_FALSE(task_tracker_.HasTrackedTasks());
438
439 EXPECT_NE(CancelableTaskTracker::kBadTaskId, task_tracker_.PostDelayedTask(
440 test_task_runner.get(),
441 FROM_HERE,
442 MakeExpectedRunClosure(FROM_HERE),
443 TimeDelta()));
444
445 EXPECT_NE(CancelableTaskTracker::kBadTaskId, task_tracker_.PostDelayedTask(
446 test_task_runner.get(),
447 FROM_HERE,
448 MakeExpectedRunClosure(FROM_HERE),
449 TimeDelta(TimeDelta::FromMilliseconds(1))));
450
451 test_task_runner->RunUntilIdle();
452
453 EXPECT_TRUE(task_tracker_.HasTrackedTasks());
454
455 RunCurrentLoopUntilIdle();
456
457 EXPECT_FALSE(task_tracker_.HasTrackedTasks());
458 }
459
433 } // namespace base 460 } // namespace base
OLDNEW
« no previous file with comments | « base/task/cancelable_task_tracker.cc ('k') | base/task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698