| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Joint LogSerializer and LogDeserializer testing to make sure they stay in | 5 // Joint LogSerializer and LogDeserializer testing to make sure they stay in |
| 6 // sync. | 6 // sync. |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "media/cast/logging/log_deserializer.h" | 9 #include "media/cast/logging/log_deserializer.h" |
| 10 #include "media/cast/logging/log_serializer.h" | 10 #include "media/cast/logging/log_serializer.h" |
| 11 #include "media/cast/logging/logging_defines.h" | 11 #include "media/cast/logging/logging_defines.h" |
| 12 #include "media/cast/logging/proto/proto_utils.h" | 12 #include "media/cast/logging/proto/proto_utils.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 using media::cast::proto::AggregatedFrameEvent; | 15 using media::cast::proto::AggregatedFrameEvent; |
| 16 using media::cast::proto::AggregatedPacketEvent; | 16 using media::cast::proto::AggregatedPacketEvent; |
| 17 using media::cast::proto::BasePacketEvent; | 17 using media::cast::proto::BasePacketEvent; |
| 18 using media::cast::proto::LogMetadata; | 18 using media::cast::proto::LogMetadata; |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 const media::cast::CastLoggingEvent kVideoFrameEvents[] = { | 22 const media::cast::CastLoggingEvent kVideoFrameEvents[] = { |
| 23 media::cast::kVideoFrameCaptureBegin, media::cast::kVideoFrameCaptureEnd, | 23 media::cast::FRAME_CAPTURE_BEGIN, media::cast::FRAME_CAPTURE_END, |
| 24 media::cast::kVideoFrameSentToEncoder, media::cast::kVideoFrameEncoded, | 24 media::cast::FRAME_ENCODED, media::cast::FRAME_DECODED, |
| 25 media::cast::kVideoFrameDecoded, media::cast::kVideoRenderDelay}; | 25 media::cast::FRAME_PLAYOUT }; |
| 26 | 26 |
| 27 const media::cast::CastLoggingEvent kVideoPacketEvents[] = { | 27 const media::cast::CastLoggingEvent kVideoPacketEvents[] = { |
| 28 media::cast::kVideoPacketSentToNetwork, media::cast::kVideoPacketReceived}; | 28 media::cast::PACKET_SENT_TO_NETWORK, media::cast::PACKET_RECEIVED}; |
| 29 | 29 |
| 30 // The frame event fields cycle through these numbers. | 30 // The frame event fields cycle through these numbers. |
| 31 const int kEncodedFrameSize[] = {512, 425, 399, 400, 237}; | 31 const int kEncodedFrameSize[] = {512, 425, 399, 400, 237}; |
| 32 const int kDelayMillis[] = {15, 4, 8, 42, 23, 16}; | 32 const int kDelayMillis[] = {15, 4, 8, 42, 23, 16}; |
| 33 | 33 |
| 34 const int kMaxSerializedBytes = 10000; | 34 const int kMaxSerializedBytes = 10000; |
| 35 |
| 35 } | 36 } |
| 36 | 37 |
| 37 namespace media { | 38 namespace media { |
| 38 namespace cast { | 39 namespace cast { |
| 39 | 40 |
| 40 class SerializeDeserializeTest : public ::testing::Test { | 41 class SerializeDeserializeTest : public ::testing::Test { |
| 41 protected: | 42 protected: |
| 42 SerializeDeserializeTest() | 43 SerializeDeserializeTest() |
| 43 : serialized_(new char[kMaxSerializedBytes]), output_bytes_(0) {} | 44 : serialized_(new char[kMaxSerializedBytes]), output_bytes_(0) {} |
| 44 | 45 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 compressed, | 205 compressed, |
| 205 100, | 206 100, |
| 206 serialized_.get(), | 207 serialized_.get(), |
| 207 &output_bytes_); | 208 &output_bytes_); |
| 208 EXPECT_FALSE(success); | 209 EXPECT_FALSE(success); |
| 209 EXPECT_EQ(0, output_bytes_); | 210 EXPECT_EQ(0, output_bytes_); |
| 210 } | 211 } |
| 211 | 212 |
| 212 } // namespace cast | 213 } // namespace cast |
| 213 } // namespace media | 214 } // namespace media |
| OLD | NEW |