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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "media/cast/logging/log_deserializer.h" | 13 #include "media/cast/logging/log_deserializer.h" |
13 #include "media/cast/logging/log_serializer.h" | 14 #include "media/cast/logging/log_serializer.h" |
14 #include "media/cast/logging/logging_defines.h" | 15 #include "media/cast/logging/logging_defines.h" |
15 #include "media/cast/logging/proto/proto_utils.h" | 16 #include "media/cast/logging/proto/proto_utils.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 using media::cast::proto::AggregatedFrameEvent; | 19 using media::cast::proto::AggregatedFrameEvent; |
19 using media::cast::proto::AggregatedPacketEvent; | 20 using media::cast::proto::AggregatedPacketEvent; |
20 using media::cast::proto::BasePacketEvent; | 21 using media::cast::proto::BasePacketEvent; |
21 using media::cast::proto::LogMetadata; | 22 using media::cast::proto::LogMetadata; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 EXPECT_EQ((*original_it)->SerializeAsString(), | 139 EXPECT_EQ((*original_it)->SerializeAsString(), |
139 packet_it->second->SerializeAsString()); | 140 packet_it->second->SerializeAsString()); |
140 packet_event_list_.erase(packet_event_list_.begin()); | 141 packet_event_list_.erase(packet_event_list_.begin()); |
141 } | 142 } |
142 EXPECT_TRUE(packet_event_list_.empty()); | 143 EXPECT_TRUE(packet_event_list_.empty()); |
143 } | 144 } |
144 | 145 |
145 LogMetadata metadata_; | 146 LogMetadata metadata_; |
146 FrameEventList frame_event_list_; | 147 FrameEventList frame_event_list_; |
147 PacketEventList packet_event_list_; | 148 PacketEventList packet_event_list_; |
148 scoped_ptr<char[]> serialized_; | 149 std::unique_ptr<char[]> serialized_; |
149 int output_bytes_; | 150 int output_bytes_; |
150 }; | 151 }; |
151 | 152 |
152 TEST_F(SerializeDeserializeTest, Uncompressed) { | 153 TEST_F(SerializeDeserializeTest, Uncompressed) { |
153 bool compressed = false; | 154 bool compressed = false; |
154 Init(); | 155 Init(); |
155 | 156 |
156 bool success = SerializeEvents(metadata_, | 157 bool success = SerializeEvents(metadata_, |
157 frame_event_list_, | 158 frame_event_list_, |
158 packet_event_list_, | 159 packet_event_list_, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 compressed, | 219 compressed, |
219 100, | 220 100, |
220 serialized_.get(), | 221 serialized_.get(), |
221 &output_bytes_); | 222 &output_bytes_); |
222 EXPECT_FALSE(success); | 223 EXPECT_FALSE(success); |
223 EXPECT_EQ(0, output_bytes_); | 224 EXPECT_EQ(0, output_bytes_); |
224 } | 225 } |
225 | 226 |
226 } // namespace cast | 227 } // namespace cast |
227 } // namespace media | 228 } // namespace media |
OLD | NEW |