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

Side by Side Diff: media/cast/net/cast_transport_sender_impl_unittest.cc

Issue 1178423008: Provision to start base::SimpleTestTickClock at initial ticks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/cast/net/cast_transport_sender_impl.h" 5 #include "media/cast/net/cast_transport_sender_impl.h"
6 6
7 #include <gtest/gtest.h> 7 #include <gtest/gtest.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 base::Closure callback_; 61 base::Closure callback_;
62 PacketRef stored_packet_; 62 PacketRef stored_packet_;
63 int packets_sent_; 63 int packets_sent_;
64 int64_t bytes_sent_; 64 int64_t bytes_sent_;
65 65
66 DISALLOW_COPY_AND_ASSIGN(FakePacketSender); 66 DISALLOW_COPY_AND_ASSIGN(FakePacketSender);
67 }; 67 };
68 68
69 class CastTransportSenderImplTest : public ::testing::Test { 69 class CastTransportSenderImplTest : public ::testing::Test {
70 protected: 70 protected:
71 CastTransportSenderImplTest() : num_times_logging_callback_called_(0) { 71 CastTransportSenderImplTest()
72 testing_clock_.Advance( 72 : testing_clock_(base::TimeTicks() +
73 base::TimeDelta::FromMilliseconds(kStartMillisecond)); 73 base::TimeDelta::FromMilliseconds(kStartMillisecond)),
74 num_times_logging_callback_called_(0) {
74 task_runner_ = new test::FakeSingleThreadTaskRunner(&testing_clock_); 75 task_runner_ = new test::FakeSingleThreadTaskRunner(&testing_clock_);
75 } 76 }
76 77
77 ~CastTransportSenderImplTest() override {} 78 ~CastTransportSenderImplTest() override {}
78 79
79 void InitWithoutLogging() { 80 void InitWithoutLogging() {
80 transport_sender_.reset( 81 transport_sender_.reset(
81 new CastTransportSenderImpl(NULL, 82 new CastTransportSenderImpl(NULL,
82 &testing_clock_, 83 &testing_clock_,
83 net::IPEndPoint(), 84 net::IPEndPoint(),
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 task_runner_->RunTasks(); 383 task_runner_->RunTasks();
383 EXPECT_EQ(7, transport_.packets_sent()); 384 EXPECT_EQ(7, transport_.packets_sent());
384 EXPECT_EQ(1, num_times_logging_callback_called_); // Only 8 ms since last. 385 EXPECT_EQ(1, num_times_logging_callback_called_); // Only 8 ms since last.
385 386
386 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); 387 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2));
387 EXPECT_EQ(2, num_times_logging_callback_called_); 388 EXPECT_EQ(2, num_times_logging_callback_called_);
388 } 389 }
389 390
390 } // namespace cast 391 } // namespace cast
391 } // namespace media 392 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/logging/stats_event_subscriber_unittest.cc ('k') | media/cast/net/pacing/paced_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698