OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
6 | 6 |
7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
8 #include "base/test/simple_test_tick_clock.h" | 8 #include "base/test/simple_test_tick_clock.h" |
9 #include "base/time/tick_clock.h" | 9 #include "base/time/tick_clock.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "media/cast/logging/logging_impl.h" | 11 #include "media/cast/logging/logging_impl.h" |
12 #include "media/cast/test/fake_task_runner.h" | 12 #include "media/cast/test/fake_task_runner.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 namespace cast { | 15 namespace cast { |
16 | 16 |
17 // Insert frame duration- one second. | 17 // Insert frame duration- one second. |
18 const int64 kIntervalTime1S = 1; | 18 const int64 kIntervalTime1S = 1; |
19 // Test frame rate goal - 30fps. | 19 // Test frame rate goal - 30fps. |
20 const int kFrameIntervalMs = 33; | 20 const int kFrameIntervalMs = 33; |
21 | 21 |
22 static const int64 kStartMillisecond = GG_INT64_C(12345678900000); | 22 static const int64 kStartMillisecond = GG_INT64_C(12345678900000); |
23 | 23 |
24 class TestLogging : public ::testing::Test { | 24 class TestLogging : public ::testing::Test { |
25 protected: | 25 protected: |
26 TestLogging() { | 26 TestLogging() { |
27 // Enable logging, disable tracing and uma. | 27 // Enable all logging types. |
28 config_.enable_data_collection = true; | 28 config_.enable_raw_data_collection = true; |
| 29 config_.enable_stats_data_collection = true; |
| 30 config_.enable_uma_stats = true; |
| 31 config_.enable_tracing = true; |
29 | 32 |
30 testing_clock_.Advance( | 33 testing_clock_.Advance( |
31 base::TimeDelta::FromMilliseconds(kStartMillisecond)); | 34 base::TimeDelta::FromMilliseconds(kStartMillisecond)); |
32 task_runner_ = new test::FakeTaskRunner(&testing_clock_); | 35 task_runner_ = new test::FakeTaskRunner(&testing_clock_); |
33 logging_.reset(new LoggingImpl(task_runner_, config_)); | 36 logging_.reset(new LoggingImpl(task_runner_, config_)); |
34 } | 37 } |
35 | 38 |
36 virtual ~TestLogging() {} | 39 virtual ~TestLogging() {} |
37 | 40 |
38 CastLoggingConfig config_; | 41 CastLoggingConfig config_; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 EXPECT_EQ(kNumRuns / 4, rit->second.timestamp.size()); | 253 EXPECT_EQ(kNumRuns / 4, rit->second.timestamp.size()); |
251 // Stats - one value per event. | 254 // Stats - one value per event. |
252 GenericStatsMap::const_iterator sit = stats_map->find(kRttMs); | 255 GenericStatsMap::const_iterator sit = stats_map->find(kRttMs); |
253 EXPECT_NEAR(kBaseValue, sit->second, 2.5); | 256 EXPECT_NEAR(kBaseValue, sit->second, 2.5); |
254 sit = stats_map->find(kPacketLoss); | 257 sit = stats_map->find(kPacketLoss); |
255 EXPECT_NEAR(kBaseValue, sit->second, 2.5); | 258 EXPECT_NEAR(kBaseValue, sit->second, 2.5); |
256 sit = stats_map->find(kJitterMs); | 259 sit = stats_map->find(kJitterMs); |
257 EXPECT_NEAR(kBaseValue, sit->second, 2.5); | 260 EXPECT_NEAR(kBaseValue, sit->second, 2.5); |
258 } | 261 } |
259 | 262 |
| 263 |
260 } // namespace cast | 264 } // namespace cast |
261 } // namespace media | 265 } // namespace media |
OLD | NEW |