summaryrefslogtreecommitdiffstats
path: root/base/test
diff options
context:
space:
mode:
authorbinjin <binjin@chromium.org>2015-03-18 03:53:20 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-18 10:53:57 +0000
commitefa8017cfd57b38d0126e994a5e29aba7fbf98e8 (patch)
treed30670c7c6b5e6165c5fe3097a9cd7dff9c3aa99 /base/test
parentaf05a02a821e30f72e7497a633da4f8c1dec4737 (diff)
downloadchromium_src-efa8017cfd57b38d0126e994a5e29aba7fbf98e8.zip
chromium_src-efa8017cfd57b38d0126e994a5e29aba7fbf98e8.tar.gz
chromium_src-efa8017cfd57b38d0126e994a5e29aba7fbf98e8.tar.bz2
Initial RemoteCommandService
This CL adds initial implementation of RemoteCommandService. RemoteCommandService contains a RemoteCommandsQueue and will interacts with DMServer to fetch and run commands in sequence. Protocol modification is made to protobuf as well. BUG=None Review URL: https://codereview.chromium.org/879233003 Cr-Commit-Position: refs/heads/master@{#321103}
Diffstat (limited to 'base/test')
-rw-r--r--base/test/test_mock_time_task_runner.cc6
-rw-r--r--base/test/test_mock_time_task_runner.h5
2 files changed, 10 insertions, 1 deletions
diff --git a/base/test/test_mock_time_task_runner.cc b/base/test/test_mock_time_task_runner.cc
index 6bcab8b..8cc2e6d 100644
--- a/base/test/test_mock_time_task_runner.cc
+++ b/base/test/test_mock_time_task_runner.cc
@@ -164,6 +164,10 @@ bool TestMockTimeTaskRunner::PostNonNestableDelayedTask(
return PostDelayedTask(from_here, task, delay);
}
+bool TestMockTimeTaskRunner::IsElapsingStopped() {
+ return false;
+}
+
void TestMockTimeTaskRunner::OnBeforeSelectingTask() {
// Empty default implementation.
}
@@ -179,7 +183,7 @@ void TestMockTimeTaskRunner::OnAfterTaskRun() {
void TestMockTimeTaskRunner::ProcessAllTasksNoLaterThan(TimeDelta max_delta) {
DCHECK_GE(max_delta, TimeDelta());
const TimeTicks original_now_ticks = now_ticks_;
- while (true) {
+ while (!IsElapsingStopped()) {
OnBeforeSelectingTask();
TestPendingTask task_info;
if (!DequeueNextTask(original_now_ticks, max_delta, &task_info))
diff --git a/base/test/test_mock_time_task_runner.h b/base/test/test_mock_time_task_runner.h
index c38fd6d..705af10 100644
--- a/base/test/test_mock_time_task_runner.h
+++ b/base/test/test_mock_time_task_runner.h
@@ -94,6 +94,11 @@ class TestMockTimeTaskRunner : public SingleThreadTaskRunner {
protected:
~TestMockTimeTaskRunner() override;
+ // Whether the elapsing of virtual time is stopped or not. Subclasses can
+ // override this method to perform early exits from a running task runner.
+ // Defaults to always return false.
+ virtual bool IsElapsingStopped();
+
// Called before the next task to run is selected, so that subclasses have a
// last chance to make sure all tasks are posted.
virtual void OnBeforeSelectingTask();