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

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

Issue 149573: Refactor WritableBuffer interface for more useful ptr management. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/buffers.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/scoped_ptr.h" 5 #include "base/scoped_ptr.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "media/base/buffer_queue.h" 8 #include "media/base/buffer_queue.h"
9 #include "media/base/data_buffer.h" 9 #include "media/base/data_buffer.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace media { 12 namespace media {
13 13
14 class BufferQueueTest : public testing::Test { 14 class BufferQueueTest : public testing::Test {
15 protected: 15 protected:
16 BufferQueueTest() { 16 BufferQueueTest() {
17 buffer1 = new DataBuffer(); 17 buffer1 = new DataBuffer(kDataSize);
18 data1 = buffer1->GetWritableData(kDataSize); 18 buffer1->SetDataSize(kDataSize);
19 data1 = buffer1->GetWritableData();
19 20
20 buffer2 = new DataBuffer(); 21 buffer2 = new DataBuffer(kNewDataSize);
21 data2 = buffer2->GetWritableData(kNewDataSize); 22 buffer2->SetDataSize(kNewDataSize);
23 data2 = buffer2->GetWritableData();
22 24
23 bufferBig = new DataBuffer(); 25 bufferBig = new DataBuffer(2 * (kDataSize + kNewDataSize));
24 dataBig = bufferBig->GetWritableData(2 * (kDataSize + kNewDataSize)); 26 bufferBig->SetDataSize(2 * (kDataSize + kNewDataSize));
27 dataBig = bufferBig->GetWritableData();
25 28
26 memcpy(data1, kData, kDataSize); 29 memcpy(data1, kData, kDataSize);
27 memcpy(data2, kNewData, kNewDataSize); 30 memcpy(data2, kNewData, kNewDataSize);
28 } 31 }
29 32
30 BufferQueue queue_; 33 BufferQueue queue_;
31 34
32 static const char kData[]; 35 static const char kData[];
33 static const size_t kDataSize; 36 static const size_t kDataSize;
34 static const char kNewData[]; 37 static const char kNewData[];
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 161
159 EXPECT_EQ(expected, actual) << "With test = {" 162 EXPECT_EQ(expected, actual) << "With test = {"
160 << tests[i].first_time_seconds << ", " << tests[i].consume_bytes 163 << tests[i].first_time_seconds << ", " << tests[i].consume_bytes
161 << ", " << tests[i].bytes_to_seconds << "}\n"; 164 << ", " << tests[i].bytes_to_seconds << "}\n";
162 165
163 queue_.Clear(); 166 queue_.Clear();
164 } 167 }
165 } 168 }
166 169
167 } // namespace media 170 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/base/buffers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698