Chromium Code Reviews| 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/macros.h" | |
| 6 #include "blimp/net/blimp_connection_statistics.h" | |
| 7 #include "testing/gmock/include/gmock/gmock.h" | |
|
Kevin M
2016/05/24 21:49:00
Not used
shaktisahu
2016/05/24 22:42:14
Done.
| |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 | |
| 10 using testing::_; | |
|
Kevin M
2016/05/24 21:49:00
Not used
shaktisahu
2016/05/24 22:42:14
Done.
| |
| 11 | |
| 12 namespace blimp { | |
| 13 | |
| 14 class BlimpConnectionStatisticsTest : public testing::Test { | |
| 15 public: | |
| 16 BlimpConnectionStatisticsTest() {} | |
| 17 | |
| 18 ~BlimpConnectionStatisticsTest() override {} | |
| 19 | |
| 20 protected: | |
| 21 BlimpConnectionStatistics stats_; | |
| 22 | |
| 23 private: | |
| 24 DISALLOW_COPY_AND_ASSIGN(BlimpConnectionStatisticsTest); | |
| 25 }; | |
| 26 | |
| 27 TEST_F(BlimpConnectionStatisticsTest, AddStatsAndVerify) { | |
| 28 DCHECK_EQ(0, stats_.Get(BlimpConnectionStatistics::BYTES_SENT)); | |
| 29 DCHECK_EQ(0, stats_.Get(BlimpConnectionStatistics::BYTES_RECEIVED)); | |
| 30 DCHECK_EQ(0, stats_.Get(BlimpConnectionStatistics::COMMIT)); | |
| 31 | |
| 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 |