OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/bind.h" | |
Kevin M
2016/05/24 01:02:01
Not used
shaktisahu
2016/05/24 21:02:45
Done.
| |
6 #include "base/macros.h" | |
7 #include "base/message_loop/message_loop.h" | |
Kevin M
2016/05/24 01:02:01
Not used
shaktisahu
2016/05/24 21:02:45
Done.
| |
8 #include "base/run_loop.h" | |
Kevin M
2016/05/24 01:02:01
Not used
| |
9 #include "base/threading/thread.h" | |
Kevin M
2016/05/24 01:02:01
Not used
| |
10 #include "blimp/net/blimp_connection_statistics.h" | |
11 #include "testing/gmock/include/gmock/gmock.h" | |
Kevin M
2016/05/24 01:02:01
Not used
shaktisahu
2016/05/24 21:02:45
Done.
| |
12 #include "testing/gtest/include/gtest/gtest.h" | |
13 | |
14 using testing::_; | |
15 | |
16 namespace blimp { | |
17 | |
18 class BlimpConnectionStatisticsTest : public testing::Test { | |
19 public: | |
20 BlimpConnectionStatisticsTest() : stats_(new BlimpConnectionStatistics) {} | |
21 | |
22 ~BlimpConnectionStatisticsTest() override {} | |
23 | |
24 protected: | |
25 std::unique_ptr<BlimpConnectionStatistics> stats_; | |
Kevin M
2016/05/24 01:02:01
YOu can make this a regular field - no need to mak
shaktisahu
2016/05/24 21:02:45
Done.
| |
26 | |
27 private: | |
28 DISALLOW_COPY_AND_ASSIGN(BlimpConnectionStatisticsTest); | |
29 }; | |
30 | |
31 TEST_F(BlimpConnectionStatisticsTest, AddStatsAndVerify) { | |
Kevin M
2016/05/24 01:02:01
Also verify zeroes beforehand
shaktisahu
2016/05/24 21:02:45
Done.
| |
32 stats_->Add(BlimpConnectionStatistics::BYTES_SENT, 10); | |
33 stats_->Add(BlimpConnectionStatistics::BYTES_SENT, 20); | |
34 stats_->Add(BlimpConnectionStatistics::BYTES_RECEIVED, 5); | |
35 stats_->Add(BlimpConnectionStatistics::COMMIT, 1); | |
36 | |
37 DCHECK_EQ(30, stats_->Get(BlimpConnectionStatistics::BYTES_SENT)); | |
38 DCHECK_EQ(5, stats_->Get(BlimpConnectionStatistics::BYTES_RECEIVED)); | |
39 DCHECK_EQ(1, stats_->Get(BlimpConnectionStatistics::COMMIT)); | |
40 } | |
41 | |
42 } // namespace blimp | |
OLD | NEW |