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

Side by Side Diff: blimp/net/blimp_connection_statistics_unittest.cc

Issue 1962393004: Added a debug info UI for Blimp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed implementation to receive synchronous calls Created 4 years, 7 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
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698