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/gtest/include/gtest/gtest.h" |
| 8 |
| 9 namespace blimp { |
| 10 |
| 11 class BlimpConnectionStatisticsTest : public testing::Test { |
| 12 public: |
| 13 BlimpConnectionStatisticsTest() {} |
| 14 |
| 15 ~BlimpConnectionStatisticsTest() override {} |
| 16 |
| 17 protected: |
| 18 BlimpConnectionStatistics stats_; |
| 19 |
| 20 private: |
| 21 DISALLOW_COPY_AND_ASSIGN(BlimpConnectionStatisticsTest); |
| 22 }; |
| 23 |
| 24 TEST_F(BlimpConnectionStatisticsTest, AddStatsAndVerify) { |
| 25 DCHECK_EQ(0, stats_.Get(BlimpConnectionStatistics::BYTES_SENT)); |
| 26 DCHECK_EQ(0, stats_.Get(BlimpConnectionStatistics::BYTES_RECEIVED)); |
| 27 DCHECK_EQ(0, stats_.Get(BlimpConnectionStatistics::COMMIT)); |
| 28 |
| 29 stats_.Add(BlimpConnectionStatistics::BYTES_SENT, 10); |
| 30 stats_.Add(BlimpConnectionStatistics::BYTES_SENT, 20); |
| 31 stats_.Add(BlimpConnectionStatistics::BYTES_RECEIVED, 5); |
| 32 stats_.Add(BlimpConnectionStatistics::COMMIT, 1); |
| 33 |
| 34 DCHECK_EQ(30, stats_.Get(BlimpConnectionStatistics::BYTES_SENT)); |
| 35 DCHECK_EQ(5, stats_.Get(BlimpConnectionStatistics::BYTES_RECEIVED)); |
| 36 DCHECK_EQ(1, stats_.Get(BlimpConnectionStatistics::COMMIT)); |
| 37 } |
| 38 |
| 39 } // namespace blimp |
OLD | NEW |