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

Unified Diff: net/quic/test_tools/test_task_runner.cc

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/test_tools/test_task_runner.h ('k') | net/sdch/README.md » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/test_tools/test_task_runner.cc
diff --git a/net/quic/test_tools/test_task_runner.cc b/net/quic/test_tools/test_task_runner.cc
deleted file mode 100644
index 385fd5dfa82fe13fc4d77fe96718267fe264edcc..0000000000000000000000000000000000000000
--- a/net/quic/test_tools/test_task_runner.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "net/quic/test_tools/test_task_runner.h"
-
-#include <algorithm>
-
-#include "net/quic/test_tools/mock_clock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace net {
-namespace test {
-
-TestTaskRunner::TestTaskRunner(MockClock* clock)
- : clock_(clock) {
-}
-
-TestTaskRunner::~TestTaskRunner() {
-}
-
-bool TestTaskRunner::PostDelayedTask(const tracked_objects::Location& from_here,
- const base::Closure& task,
- base::TimeDelta delay) {
- EXPECT_GE(delay, base::TimeDelta());
- tasks_.push_back(
- PostedTask(from_here, task, clock_->NowInTicks(), delay,
- base::TestPendingTask::NESTABLE));
- return false;
-}
-
-bool TestTaskRunner::RunsTasksOnCurrentThread() const {
- return true;
-}
-
-const std::vector<PostedTask>& TestTaskRunner::GetPostedTasks() const {
- return tasks_;
-}
-
-void TestTaskRunner::RunNextTask() {
- // Find the next task to run, advance the time to the correct time
- // and then run the task.
- std::vector<PostedTask>::iterator next = FindNextTask();
- DCHECK(next != tasks_.end());
- clock_->AdvanceTime(QuicTime::Delta::FromMicroseconds(
- (next->GetTimeToRun() - clock_->NowInTicks()).InMicroseconds()));
- PostedTask task = *next;
- tasks_.erase(next);
- task.task.Run();
-}
-
-namespace {
-
-struct ShouldRunBeforeLessThan {
- bool operator()(const PostedTask& task1, const PostedTask& task2) const {
- return task1.ShouldRunBefore(task2);
- }
-};
-
-} // namespace
-
-std::vector<PostedTask>::iterator TestTaskRunner::FindNextTask() {
- return std::min_element(
- tasks_.begin(), tasks_.end(), ShouldRunBeforeLessThan());
-}
-
-} // namespace test
-} // namespace net
« no previous file with comments | « net/quic/test_tools/test_task_runner.h ('k') | net/sdch/README.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698