Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: media/base/decoder_buffer_unittest.cc

Issue 757953002: Add SubsampleEntry constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/base/decrypt_config.h » ('j') | media/base/decrypt_config.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/strings/string_util.h" 5 #include "base/strings/string_util.h"
6 #include "media/base/decoder_buffer.h" 6 #include "media/base/decoder_buffer.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace media { 9 namespace media {
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 uint8* data = buffer->writable_data(); 92 uint8* data = buffer->writable_data();
93 ASSERT_TRUE(data); 93 ASSERT_TRUE(data);
94 ASSERT_EQ(kDataSize, buffer->data_size()); 94 ASSERT_EQ(kDataSize, buffer->data_size());
95 memcpy(data, kData, kDataSize); 95 memcpy(data, kData, kDataSize);
96 const uint8* read_only_data = buffer->data(); 96 const uint8* read_only_data = buffer->data();
97 ASSERT_EQ(data, read_only_data); 97 ASSERT_EQ(data, read_only_data);
98 ASSERT_EQ(0, memcmp(read_only_data, kData, kDataSize)); 98 ASSERT_EQ(0, memcmp(read_only_data, kData, kDataSize));
99 EXPECT_FALSE(buffer->end_of_stream()); 99 EXPECT_FALSE(buffer->end_of_stream());
100 } 100 }
101 101
102 TEST(DecoderBufferTest, GetDecryptConfig) { 102 TEST(DecoderBufferTest, DecryptConfig) {
103 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0)); 103 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0));
104 EXPECT_FALSE(buffer->decrypt_config()); 104 EXPECT_FALSE(buffer->decrypt_config());
105
106 const char kKeyId[] = "key id";
107 const char kIv[] = "0123456789abcdef";
108 std::vector<SubsampleEntry> subsamples;
109 subsamples.push_back(SubsampleEntry(10, 20));
110 subsamples.push_back(SubsampleEntry(30, 40));
ddorwin 2014/11/25 20:47:48 nit: This example could imply some relation betwee
xhwang 2014/11/25 22:13:44 Done.
111
112 DecryptConfig decrypt_config(kKeyId, kIv, subsamples);
113
114 buffer->set_decrypt_config(
115 make_scoped_ptr(new DecryptConfig(kKeyId, kIv, subsamples)));
116
117 EXPECT_TRUE(buffer->decrypt_config());
118 EXPECT_TRUE(buffer->decrypt_config()->Matches(decrypt_config));
105 } 119 }
106 120
107 TEST(DecoderBufferTest, IsKeyFrame) { 121 TEST(DecoderBufferTest, IsKeyFrame) {
108 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0)); 122 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0));
109 EXPECT_FALSE(buffer->is_key_frame()); 123 EXPECT_FALSE(buffer->is_key_frame());
110 124
111 buffer->set_is_key_frame(false); 125 buffer->set_is_key_frame(false);
112 EXPECT_FALSE(buffer->is_key_frame()); 126 EXPECT_FALSE(buffer->is_key_frame());
113 127
114 buffer->set_is_key_frame(true); 128 buffer->set_is_key_frame(true);
115 EXPECT_TRUE(buffer->is_key_frame()); 129 EXPECT_TRUE(buffer->is_key_frame());
116 } 130 }
117 131
118 } // namespace media 132 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/base/decrypt_config.h » ('j') | media/base/decrypt_config.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698