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

Side by Side Diff: media/mojo/common/mojo_decoder_buffer_converter_unittest.cc

Issue 2484763005: media: Support transporting 0-byte DecoderBuffer over mojo (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
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 #include "media/mojo/common/mojo_decoder_buffer_converter.h" 5 #include "media/mojo/common/mojo_decoder_buffer_converter.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 TEST(MojoDecoderBufferConverterTest, ConvertDecoderBuffer_EOS) { 91 TEST(MojoDecoderBufferConverterTest, ConvertDecoderBuffer_EOS) {
92 base::MessageLoop message_loop; 92 base::MessageLoop message_loop;
93 scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CreateEOSBuffer()); 93 scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CreateEOSBuffer());
94 94
95 MojoDecoderBufferConverter converter; 95 MojoDecoderBufferConverter converter;
96 converter.ConvertAndVerify(buffer); 96 converter.ConvertAndVerify(buffer);
97 } 97 }
98 98
99 // TODO(xhwang): Investigate whether we can get rid of zero-byte-buffer.
100 // See http://crbug.com/663438
101 TEST(MojoDecoderBufferConverterTest, ConvertDecoderBuffer_ZeroByteBuffer) {
102 base::MessageLoop message_loop;
103 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0));
104
105 MojoDecoderBufferConverter converter;
106 converter.ConvertAndVerify(buffer);
107 }
108
99 TEST(MojoDecoderBufferConverterTest, ConvertDecoderBuffer_KeyFrame) { 109 TEST(MojoDecoderBufferConverterTest, ConvertDecoderBuffer_KeyFrame) {
100 base::MessageLoop message_loop; 110 base::MessageLoop message_loop;
101 const uint8_t kData[] = "hello, world"; 111 const uint8_t kData[] = "hello, world";
102 const size_t kDataSize = arraysize(kData); 112 const size_t kDataSize = arraysize(kData);
103 113
104 scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CopyFrom( 114 scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CopyFrom(
105 reinterpret_cast<const uint8_t*>(&kData), kDataSize)); 115 reinterpret_cast<const uint8_t*>(&kData), kDataSize));
106 buffer->set_is_key_frame(true); 116 buffer->set_is_key_frame(true);
107 EXPECT_TRUE(buffer->is_key_frame()); 117 EXPECT_TRUE(buffer->is_key_frame());
108 118
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 std::move(mojo_buffer), 204 std::move(mojo_buffer),
195 base::BindOnce(&MockReadCB::Run, base::Unretained(&mock_cb))); 205 base::BindOnce(&MockReadCB::Run, base::Unretained(&mock_cb)));
196 206
197 // Before the entire data is transmitted, close the handle on writer side. 207 // Before the entire data is transmitted, close the handle on writer side.
198 // The reader side will get notified and report the error. 208 // The reader side will get notified and report the error.
199 converter.writer.reset(); 209 converter.writer.reset();
200 run_loop.Run(); 210 run_loop.Run();
201 } 211 }
202 212
203 } // namespace media 213 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698