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

Unified Diff: net/tools/quic/test_tools/mock_epoll_server.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/tools/quic/test_tools/mock_epoll_server.h ('k') | net/tools/quic/test_tools/mock_quic_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/test_tools/mock_epoll_server.cc
diff --git a/net/tools/quic/test_tools/mock_epoll_server.cc b/net/tools/quic/test_tools/mock_epoll_server.cc
deleted file mode 100644
index 4101c5e9ab023a0f5624e989065ca993be3b3eff..0000000000000000000000000000000000000000
--- a/net/tools/quic/test_tools/mock_epoll_server.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/tools/quic/test_tools/mock_epoll_server.h"
-
-namespace net {
-namespace tools {
-namespace test {
-
-FakeTimeEpollServer::FakeTimeEpollServer(): now_in_usec_(0) {
-}
-
-FakeTimeEpollServer::~FakeTimeEpollServer() {
-}
-
-int64 FakeTimeEpollServer::NowInUsec() const {
- return now_in_usec_;
-}
-
-MockEpollServer::MockEpollServer() : until_in_usec_(-1) {
-}
-
-MockEpollServer::~MockEpollServer() {
-}
-
-int MockEpollServer::epoll_wait_impl(int epfd,
- struct epoll_event* events,
- int max_events,
- int timeout_in_ms) {
- int num_events = 0;
- while (!event_queue_.empty() &&
- num_events < max_events &&
- event_queue_.begin()->first <= NowInUsec() &&
- ((until_in_usec_ == -1) ||
- (event_queue_.begin()->first < until_in_usec_))
- ) {
- int64 event_time_in_usec = event_queue_.begin()->first;
- events[num_events] = event_queue_.begin()->second;
- if (event_time_in_usec > NowInUsec()) {
- set_now_in_usec(event_time_in_usec);
- }
- event_queue_.erase(event_queue_.begin());
- ++num_events;
- }
- if (num_events == 0) { // then we'd have waited 'till the timeout.
- if (until_in_usec_ < 0) { // then we don't care what the final time is.
- if (timeout_in_ms > 0) {
- AdvanceBy(timeout_in_ms * 1000);
- }
- } else { // except we assume that we don't wait for the timeout
- // period if until_in_usec_ is a positive number.
- set_now_in_usec(until_in_usec_);
- // And reset until_in_usec_ to signal no waiting (as
- // the AdvanceByExactly* stuff is meant to be one-shot,
- // as are all similar EpollServer functions)
- until_in_usec_ = -1;
- }
- }
- if (until_in_usec_ >= 0) {
- CHECK(until_in_usec_ >= NowInUsec());
- }
- return num_events;
-}
-
-} // namespace test
-} // namespace tools
-} // namespace net
« no previous file with comments | « net/tools/quic/test_tools/mock_epoll_server.h ('k') | net/tools/quic/test_tools/mock_quic_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698