Chromium Code Reviews| Index: blimp/net/blimp_connection_statistics_unittest.cc |
| diff --git a/blimp/net/blimp_connection_statistics_unittest.cc b/blimp/net/blimp_connection_statistics_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3c2744f8f23a784c55ded29e25237d9b293bbd86 |
| --- /dev/null |
| +++ b/blimp/net/blimp_connection_statistics_unittest.cc |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/macros.h" |
| +#include "blimp/net/blimp_connection_statistics.h" |
| +#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.
|
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +using testing::_; |
|
Kevin M
2016/05/24 21:49:00
Not used
shaktisahu
2016/05/24 22:42:14
Done.
|
| + |
| +namespace blimp { |
| + |
| +class BlimpConnectionStatisticsTest : public testing::Test { |
| + public: |
| + BlimpConnectionStatisticsTest() {} |
| + |
| + ~BlimpConnectionStatisticsTest() override {} |
| + |
| + protected: |
| + BlimpConnectionStatistics stats_; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(BlimpConnectionStatisticsTest); |
| +}; |
| + |
| +TEST_F(BlimpConnectionStatisticsTest, AddStatsAndVerify) { |
| + DCHECK_EQ(0, stats_.Get(BlimpConnectionStatistics::BYTES_SENT)); |
| + DCHECK_EQ(0, stats_.Get(BlimpConnectionStatistics::BYTES_RECEIVED)); |
| + DCHECK_EQ(0, stats_.Get(BlimpConnectionStatistics::COMMIT)); |
| + |
| + stats_.Add(BlimpConnectionStatistics::BYTES_SENT, 10); |
| + stats_.Add(BlimpConnectionStatistics::BYTES_SENT, 20); |
| + stats_.Add(BlimpConnectionStatistics::BYTES_RECEIVED, 5); |
| + stats_.Add(BlimpConnectionStatistics::COMMIT, 1); |
| + |
| + DCHECK_EQ(30, stats_.Get(BlimpConnectionStatistics::BYTES_SENT)); |
| + DCHECK_EQ(5, stats_.Get(BlimpConnectionStatistics::BYTES_RECEIVED)); |
| + DCHECK_EQ(1, stats_.Get(BlimpConnectionStatistics::COMMIT)); |
| +} |
| + |
| +} // namespace blimp |