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 "base/string_util.h" | 5 #include "base/strings/string_util.h" |
6 #include "media/base/data_buffer.h" | 6 #include "media/base/data_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 |
11 TEST(DataBufferTest, Constructor_ZeroSize) { | 11 TEST(DataBufferTest, Constructor_ZeroSize) { |
12 // Zero-sized buffers are valid. In practice they aren't used very much but it | 12 // Zero-sized buffers are valid. In practice they aren't used very much but it |
13 // eliminates clients from worrying about null data pointers. | 13 // eliminates clients from worrying about null data pointers. |
14 scoped_refptr<DataBuffer> buffer = new DataBuffer(0); | 14 scoped_refptr<DataBuffer> buffer = new DataBuffer(0); |
15 EXPECT_TRUE(buffer->GetData()); | 15 EXPECT_TRUE(buffer->GetData()); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 ASSERT_TRUE(data); | 115 ASSERT_TRUE(data); |
116 memcpy(data, kNewData, kNewDataSize); | 116 memcpy(data, kNewData, kNewDataSize); |
117 buffer2->SetDataSize(kNewDataSize); | 117 buffer2->SetDataSize(kNewDataSize); |
118 read_only_data = buffer2->GetData(); | 118 read_only_data = buffer2->GetData(); |
119 EXPECT_EQ(kNewDataSize, buffer2->GetDataSize()); | 119 EXPECT_EQ(kNewDataSize, buffer2->GetDataSize()); |
120 ASSERT_EQ(data, read_only_data); | 120 ASSERT_EQ(data, read_only_data); |
121 EXPECT_EQ(0, memcmp(read_only_data, kNewData, kNewDataSize)); | 121 EXPECT_EQ(0, memcmp(read_only_data, kNewData, kNewDataSize)); |
122 } | 122 } |
123 | 123 |
124 } // namespace media | 124 } // namespace media |
OLD | NEW |