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