summaryrefslogtreecommitdiffstats
path: root/cc/test/scheduler_test_common.h
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-18 17:39:51 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-18 17:39:51 +0000
commitdfd15d1a2facf6a47473ee9da97993dbfd075b4d (patch)
treee76aa995dde441e89025d2b7c15c2065a6d2f261 /cc/test/scheduler_test_common.h
parentbed29f042d424c95bad10263358bd65a36491c20 (diff)
downloadchromium_src-dfd15d1a2facf6a47473ee9da97993dbfd075b4d.zip
chromium_src-dfd15d1a2facf6a47473ee9da97993dbfd075b4d.tar.gz
chromium_src-dfd15d1a2facf6a47473ee9da97993dbfd075b4d.tar.bz2
cc: Remove FakeThread, use SingleThreadTaskRunner in scheduling classes.
This changes from using cc::Thread to base::SingleThreadTaskRunner in FrameRateController, DelayBasedTimeSource, and ResourceUpdateController. Then all unit tests for these classes are switched from using cc::FakeThread to base::TestSimpleTaskRunner. This is a step toward deleting cc::Thread and moving to using MessageLoopProxy directly in cc. R=piman BUG=251134 Review URL: https://chromiumcodereview.appspot.com/17362002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207027 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/scheduler_test_common.h')
-rw-r--r--cc/test/scheduler_test_common.h44
1 files changed, 6 insertions, 38 deletions
diff --git a/cc/test/scheduler_test_common.h b/cc/test/scheduler_test_common.h
index 8834e62..e268020 100644
--- a/cc/test/scheduler_test_common.h
+++ b/cc/test/scheduler_test_common.h
@@ -28,53 +28,21 @@ class FakeTimeSourceClient : public cc::TimeSourceClient {
bool tick_called_;
};
-class FakeThread : public cc::Thread {
- public:
- FakeThread();
- virtual ~FakeThread();
-
- void Reset() {
- pending_task_delay_ = 0;
- pending_task_.reset();
- run_pending_task_on_overwrite_ = false;
- }
-
- void RunPendingTaskOnOverwrite(bool enable) {
- run_pending_task_on_overwrite_ = enable;
- }
-
- bool HasPendingTask() const { return pending_task_; }
- void RunPendingTask();
-
- int64 PendingDelayMs() const {
- EXPECT_TRUE(HasPendingTask());
- return pending_task_delay_;
- }
-
- virtual void PostTask(base::Closure cb) OVERRIDE;
- virtual void PostDelayedTask(base::Closure cb, base::TimeDelta delay)
- OVERRIDE;
- virtual bool BelongsToCurrentThread() const OVERRIDE;
-
- protected:
- scoped_ptr<base::Closure> pending_task_;
- int64 pending_task_delay_;
- bool run_pending_task_on_overwrite_;
-};
-
class FakeDelayBasedTimeSource : public cc::DelayBasedTimeSource {
public:
static scoped_refptr<FakeDelayBasedTimeSource> Create(
- base::TimeDelta interval, cc::Thread* thread) {
- return make_scoped_refptr(new FakeDelayBasedTimeSource(interval, thread));
+ base::TimeDelta interval, base::SingleThreadTaskRunner* task_runner) {
+ return make_scoped_refptr(new FakeDelayBasedTimeSource(interval,
+ task_runner));
}
void SetNow(base::TimeTicks time) { now_ = time; }
virtual base::TimeTicks Now() const OVERRIDE;
protected:
- FakeDelayBasedTimeSource(base::TimeDelta interval, cc::Thread* thread)
- : DelayBasedTimeSource(interval, thread) {}
+ FakeDelayBasedTimeSource(base::TimeDelta interval,
+ base::SingleThreadTaskRunner* task_runner)
+ : DelayBasedTimeSource(interval, task_runner) {}
virtual ~FakeDelayBasedTimeSource() {}
base::TimeTicks now_;