| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/socket_stream/socket_stream_metrics.h" | 5 #include "net/socket_stream/socket_stream_metrics.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/metrics/histogram_samples.h" | 10 #include "base/metrics/histogram_samples.h" |
| 11 #include "base/metrics/statistics_recorder.h" | 11 #include "base/metrics/statistics_recorder.h" |
| 12 #include "googleurl/src/gurl.h" | |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
| 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 using base::Histogram; | 16 using base::Histogram; |
| 17 using base::HistogramBase; | 17 using base::HistogramBase; |
| 18 using base::HistogramSamples; | 18 using base::HistogramSamples; |
| 19 using base::StatisticsRecorder; | 19 using base::StatisticsRecorder; |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 TEST(SocketStreamMetricsTest, ProtocolType) { | 23 TEST(SocketStreamMetricsTest, ProtocolType) { |
| 24 // First we'll preserve the original values. We need to do this | 24 // First we'll preserve the original values. We need to do this |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // SentCounts. | 212 // SentCounts. |
| 213 histogram = | 213 histogram = |
| 214 StatisticsRecorder::FindHistogram("Net.SocketStream.SentCounts"); | 214 StatisticsRecorder::FindHistogram("Net.SocketStream.SentCounts"); |
| 215 ASSERT_TRUE(histogram != NULL); | 215 ASSERT_TRUE(histogram != NULL); |
| 216 EXPECT_EQ(HistogramBase::kUmaTargetedHistogramFlag, histogram->flags()); | 216 EXPECT_EQ(HistogramBase::kUmaTargetedHistogramFlag, histogram->flags()); |
| 217 samples = histogram->SnapshotSamples(); | 217 samples = histogram->SnapshotSamples(); |
| 218 EXPECT_EQ(3, samples->sum() - original_sent_counts); // 3 write requests. | 218 EXPECT_EQ(3, samples->sum() - original_sent_counts); // 3 write requests. |
| 219 } | 219 } |
| 220 | 220 |
| 221 } // namespace net | 221 } // namespace net |
| OLD | NEW |