| 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 "media/base/decoder_buffer.h" |
| 6 |
| 5 #include <stdint.h> | 7 #include <stdint.h> |
| 6 | 8 |
| 7 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 9 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 10 #include "media/base/decoder_buffer.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 14 |
| 13 namespace media { | 15 namespace media { |
| 14 | 16 |
| 15 TEST(DecoderBufferTest, Constructors) { | 17 TEST(DecoderBufferTest, Constructors) { |
| 16 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0)); | 18 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0)); |
| 17 EXPECT_TRUE(buffer->data()); | 19 EXPECT_TRUE(buffer->data()); |
| 18 EXPECT_EQ(0u, buffer->data_size()); | 20 EXPECT_EQ(0u, buffer->data_size()); |
| 19 EXPECT_FALSE(buffer->end_of_stream()); | 21 EXPECT_FALSE(buffer->end_of_stream()); |
| 20 EXPECT_FALSE(buffer->is_key_frame()); | 22 EXPECT_FALSE(buffer->is_key_frame()); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 111 |
| 110 const char kKeyId[] = "key id"; | 112 const char kKeyId[] = "key id"; |
| 111 const char kIv[] = "0123456789abcdef"; | 113 const char kIv[] = "0123456789abcdef"; |
| 112 std::vector<SubsampleEntry> subsamples; | 114 std::vector<SubsampleEntry> subsamples; |
| 113 subsamples.push_back(SubsampleEntry(10, 5)); | 115 subsamples.push_back(SubsampleEntry(10, 5)); |
| 114 subsamples.push_back(SubsampleEntry(15, 7)); | 116 subsamples.push_back(SubsampleEntry(15, 7)); |
| 115 | 117 |
| 116 DecryptConfig decrypt_config(kKeyId, kIv, subsamples); | 118 DecryptConfig decrypt_config(kKeyId, kIv, subsamples); |
| 117 | 119 |
| 118 buffer->set_decrypt_config( | 120 buffer->set_decrypt_config( |
| 119 make_scoped_ptr(new DecryptConfig(kKeyId, kIv, subsamples))); | 121 base::WrapUnique(new DecryptConfig(kKeyId, kIv, subsamples))); |
| 120 | 122 |
| 121 EXPECT_TRUE(buffer->decrypt_config()); | 123 EXPECT_TRUE(buffer->decrypt_config()); |
| 122 EXPECT_TRUE(buffer->decrypt_config()->Matches(decrypt_config)); | 124 EXPECT_TRUE(buffer->decrypt_config()->Matches(decrypt_config)); |
| 123 } | 125 } |
| 124 | 126 |
| 125 TEST(DecoderBufferTest, IsKeyFrame) { | 127 TEST(DecoderBufferTest, IsKeyFrame) { |
| 126 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0)); | 128 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0)); |
| 127 EXPECT_FALSE(buffer->is_key_frame()); | 129 EXPECT_FALSE(buffer->is_key_frame()); |
| 128 | 130 |
| 129 buffer->set_is_key_frame(false); | 131 buffer->set_is_key_frame(false); |
| 130 EXPECT_FALSE(buffer->is_key_frame()); | 132 EXPECT_FALSE(buffer->is_key_frame()); |
| 131 | 133 |
| 132 buffer->set_is_key_frame(true); | 134 buffer->set_is_key_frame(true); |
| 133 EXPECT_TRUE(buffer->is_key_frame()); | 135 EXPECT_TRUE(buffer->is_key_frame()); |
| 134 } | 136 } |
| 135 | 137 |
| 136 } // namespace media | 138 } // namespace media |
| OLD | NEW |