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

Unified Diff: net/tools/quic/quic_epoll_connection_helper_test.cc

Issue 1908103002: Landing Recent QUIC changes until 4/15/2016 17:20 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/quic_epoll_connection_helper.cc ('k') | net/tools/quic/quic_in_memory_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_epoll_connection_helper_test.cc
diff --git a/net/tools/quic/quic_epoll_connection_helper_test.cc b/net/tools/quic/quic_epoll_connection_helper_test.cc
index caa44a833a81e16a30cb486a0f62280ea84ee316..cdd3757d8d45cb9a04ce5c2f8d425ae5264f7985 100644
--- a/net/tools/quic/quic_epoll_connection_helper_test.cc
+++ b/net/tools/quic/quic_epoll_connection_helper_test.cc
@@ -50,121 +50,6 @@ TEST_F(QuicEpollConnectionHelperTest, GetRandomGenerator) {
EXPECT_EQ(QuicRandom::GetInstance(), random);
}
-// The boolean parameter denotes whether or not to use an arena.
-class QuicEpollConnectionHelperAlarmTest
- : public QuicEpollConnectionHelperTest,
- public ::testing::WithParamInterface<bool> {
- protected:
- QuicConnectionArena* GetArenaParam() {
- return GetParam() ? &arena_ : nullptr;
- }
-
- private:
- QuicConnectionArena arena_;
-};
-
-INSTANTIATE_TEST_CASE_P(QuicEpollConnectionHelperAlarmTest,
- QuicEpollConnectionHelperAlarmTest,
- ::testing::Bool());
-
-TEST_P(QuicEpollConnectionHelperAlarmTest, CreateAlarm) {
- QuicArenaScopedPtr<TestDelegate> delegate =
- QuicArenaScopedPtr<TestDelegate>(new TestDelegate());
- QuicArenaScopedPtr<QuicAlarm> alarm(
- helper_.CreateAlarm(std::move(delegate), GetArenaParam()));
-
- const QuicClock* clock = helper_.GetClock();
- QuicTime start = clock->Now();
- QuicTime::Delta delta = QuicTime::Delta::FromMicroseconds(1);
- alarm->Set(start.Add(delta));
-
- epoll_server_.AdvanceByAndWaitForEventsAndExecuteCallbacks(
- delta.ToMicroseconds());
- EXPECT_EQ(start.Add(delta), clock->Now());
-}
-
-TEST_P(QuicEpollConnectionHelperAlarmTest, CreateAlarmAndCancel) {
- QuicArenaScopedPtr<TestDelegate> delegate =
- QuicArenaScopedPtr<TestDelegate>(new TestDelegate());
- TestDelegate* unowned_delegate = delegate.get();
- QuicArenaScopedPtr<QuicAlarm> alarm(
- helper_.CreateAlarm(std::move(delegate), GetArenaParam()));
-
- const QuicClock* clock = helper_.GetClock();
- QuicTime start = clock->Now();
- QuicTime::Delta delta = QuicTime::Delta::FromMicroseconds(1);
- alarm->Set(start.Add(delta));
- alarm->Cancel();
-
- epoll_server_.AdvanceByExactlyAndCallCallbacks(delta.ToMicroseconds());
- EXPECT_EQ(start.Add(delta), clock->Now());
- EXPECT_FALSE(unowned_delegate->fired());
-}
-
-TEST_P(QuicEpollConnectionHelperAlarmTest, CreateAlarmAndReset) {
- QuicArenaScopedPtr<TestDelegate> delegate =
- QuicArenaScopedPtr<TestDelegate>(new TestDelegate());
- TestDelegate* unowned_delegate = delegate.get();
- QuicArenaScopedPtr<QuicAlarm> alarm(
- helper_.CreateAlarm(std::move(delegate), GetArenaParam()));
-
- const QuicClock* clock = helper_.GetClock();
- QuicTime start = clock->Now();
- QuicTime::Delta delta = QuicTime::Delta::FromMicroseconds(1);
- alarm->Set(clock->Now().Add(delta));
- alarm->Cancel();
- QuicTime::Delta new_delta = QuicTime::Delta::FromMicroseconds(3);
- alarm->Set(clock->Now().Add(new_delta));
-
- epoll_server_.AdvanceByExactlyAndCallCallbacks(delta.ToMicroseconds());
- EXPECT_EQ(start.Add(delta), clock->Now());
- EXPECT_FALSE(unowned_delegate->fired());
-
- epoll_server_.AdvanceByExactlyAndCallCallbacks(
- new_delta.Subtract(delta).ToMicroseconds());
- EXPECT_EQ(start.Add(new_delta), clock->Now());
- EXPECT_TRUE(unowned_delegate->fired());
-}
-
-TEST_P(QuicEpollConnectionHelperAlarmTest, CreateAlarmAndUpdate) {
- QuicArenaScopedPtr<TestDelegate> delegate =
- QuicArenaScopedPtr<TestDelegate>(new TestDelegate());
- TestDelegate* unowned_delegate = delegate.get();
- QuicArenaScopedPtr<QuicAlarm> alarm(
- helper_.CreateAlarm(std::move(delegate), GetArenaParam()));
-
- const QuicClock* clock = helper_.GetClock();
- QuicTime start = clock->Now();
- QuicTime::Delta delta = QuicTime::Delta::FromMicroseconds(1);
- alarm->Set(clock->Now().Add(delta));
- QuicTime::Delta new_delta = QuicTime::Delta::FromMicroseconds(3);
- alarm->Update(clock->Now().Add(new_delta),
- QuicTime::Delta::FromMicroseconds(1));
-
- epoll_server_.AdvanceByExactlyAndCallCallbacks(delta.ToMicroseconds());
- EXPECT_EQ(start.Add(delta), clock->Now());
- EXPECT_FALSE(unowned_delegate->fired());
-
- // Move the alarm forward 1us and ensure it doesn't move forward.
- alarm->Update(clock->Now().Add(new_delta),
- QuicTime::Delta::FromMicroseconds(2));
-
- epoll_server_.AdvanceByExactlyAndCallCallbacks(
- new_delta.Subtract(delta).ToMicroseconds());
- EXPECT_EQ(start.Add(new_delta), clock->Now());
- EXPECT_TRUE(unowned_delegate->fired());
-
- // Set the alarm via an update call.
- new_delta = QuicTime::Delta::FromMicroseconds(5);
- alarm->Update(clock->Now().Add(new_delta),
- QuicTime::Delta::FromMicroseconds(1));
- EXPECT_TRUE(alarm->IsSet());
-
- // Update it with an uninitialized time and ensure it's cancelled.
- alarm->Update(QuicTime::Zero(), QuicTime::Delta::FromMicroseconds(1));
- EXPECT_FALSE(alarm->IsSet());
-}
-
} // namespace
} // namespace test
} // namespace net
« no previous file with comments | « net/tools/quic/quic_epoll_connection_helper.cc ('k') | net/tools/quic/quic_in_memory_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698