Index: webrtc/base/stream_unittest.cc |
diff --git a/webrtc/base/stream_unittest.cc b/webrtc/base/stream_unittest.cc |
index 8cfd052fe5ebbf4e1603d264f86af17bea0f7bb5..0fbb6ab835f0bd5a1be1689796acd448f942b459 100644 |
--- a/webrtc/base/stream_unittest.cc |
+++ b/webrtc/base/stream_unittest.cc |
@@ -79,7 +79,7 @@ void SeekTest(StreamInterface* stream, const unsigned char value) { |
unsigned char buffer[13] = { 0 }; |
const size_t kBufSize = sizeof(buffer); |
- EXPECT_EQ(stream->Read(buffer, kBufSize, &bytes, NULL), SR_SUCCESS); |
+ EXPECT_EQ(stream->Read(buffer, kBufSize, &bytes, nullptr), SR_SUCCESS); |
EXPECT_EQ(bytes, kBufSize); |
EXPECT_TRUE(VerifyTestBuffer(buffer, kBufSize, value)); |
EXPECT_TRUE(stream->GetPosition(&bytes)); |
@@ -87,7 +87,7 @@ void SeekTest(StreamInterface* stream, const unsigned char value) { |
EXPECT_TRUE(stream->SetPosition(7)); |
- EXPECT_EQ(stream->Read(buffer, kBufSize, &bytes, NULL), SR_SUCCESS); |
+ EXPECT_EQ(stream->Read(buffer, kBufSize, &bytes, nullptr), SR_SUCCESS); |
EXPECT_EQ(bytes, kBufSize); |
EXPECT_TRUE(VerifyTestBuffer(buffer, kBufSize, value + 7)); |
EXPECT_TRUE(stream->GetPosition(&bytes)); |
@@ -106,52 +106,52 @@ TEST(FifoBufferTest, TestAll) { |
// Test assumptions about base state |
EXPECT_EQ(SS_OPEN, stream->GetState()); |
- EXPECT_EQ(SR_BLOCK, stream->Read(out, kSize, &bytes, NULL)); |
- EXPECT_TRUE(NULL != stream->GetReadData(&bytes)); |
+ EXPECT_EQ(SR_BLOCK, stream->Read(out, kSize, &bytes, nullptr)); |
+ EXPECT_TRUE(nullptr != stream->GetReadData(&bytes)); |
EXPECT_EQ((size_t)0, bytes); |
stream->ConsumeReadData(0); |
- EXPECT_TRUE(NULL != stream->GetWriteBuffer(&bytes)); |
+ EXPECT_TRUE(nullptr != stream->GetWriteBuffer(&bytes)); |
EXPECT_EQ(kSize, bytes); |
stream->ConsumeWriteBuffer(0); |
// Try a full write |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, nullptr)); |
EXPECT_EQ(kSize, bytes); |
// Try a write that should block |
- EXPECT_EQ(SR_BLOCK, stream->Write(in, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_BLOCK, stream->Write(in, kSize, &bytes, nullptr)); |
// Try a full read |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize, &bytes, nullptr)); |
EXPECT_EQ(kSize, bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize)); |
// Try a read that should block |
- EXPECT_EQ(SR_BLOCK, stream->Read(out, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_BLOCK, stream->Read(out, kSize, &bytes, nullptr)); |
// Try a too-big write |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize * 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize * 2, &bytes, nullptr)); |
EXPECT_EQ(bytes, kSize); |
// Try a too-big read |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize * 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize * 2, &bytes, nullptr)); |
EXPECT_EQ(kSize, bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize)); |
// Try some small writes and reads |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(kSize / 2, bytes); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(kSize / 2, bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize / 2)); |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(kSize / 2, bytes); |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(kSize / 2, bytes); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(kSize / 2, bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize / 2)); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(kSize / 2, bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize / 2)); |
@@ -163,22 +163,22 @@ TEST(FifoBufferTest, TestAll) { |
// XXXXWWWWWWWWXXXX 4567012345670123 |
// RRRRXXXXXXXXRRRR ....01234567.... |
// ....RRRRRRRR.... ................ |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize * 3 / 4, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize * 3 / 4, &bytes, nullptr)); |
EXPECT_EQ(kSize * 3 / 4, bytes); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(kSize / 2, bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize / 2)); |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(kSize / 2, bytes); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 4, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 4, &bytes, nullptr)); |
EXPECT_EQ(kSize / 4 , bytes); |
EXPECT_EQ(0, memcmp(in + kSize / 2, out, kSize / 4)); |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(kSize / 2, bytes); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(kSize / 2 , bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize / 2)); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(kSize / 2 , bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize / 2)); |
@@ -187,27 +187,27 @@ TEST(FifoBufferTest, TestAll) { |
stream->ConsumeWriteBuffer(0); |
// Try using GetReadData to do a full read |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, nullptr)); |
q = stream->GetReadData(&bytes); |
- EXPECT_TRUE(NULL != q); |
+ EXPECT_TRUE(nullptr != q); |
EXPECT_EQ(kSize, bytes); |
EXPECT_EQ(0, memcmp(q, in, kSize)); |
stream->ConsumeReadData(kSize); |
- EXPECT_EQ(SR_BLOCK, stream->Read(out, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_BLOCK, stream->Read(out, kSize, &bytes, nullptr)); |
// Try using GetReadData to do some small reads |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, nullptr)); |
q = stream->GetReadData(&bytes); |
- EXPECT_TRUE(NULL != q); |
+ EXPECT_TRUE(nullptr != q); |
EXPECT_EQ(kSize, bytes); |
EXPECT_EQ(0, memcmp(q, in, kSize / 2)); |
stream->ConsumeReadData(kSize / 2); |
q = stream->GetReadData(&bytes); |
- EXPECT_TRUE(NULL != q); |
+ EXPECT_TRUE(nullptr != q); |
EXPECT_EQ(kSize / 2, bytes); |
EXPECT_EQ(0, memcmp(q, in + kSize / 2, kSize / 2)); |
stream->ConsumeReadData(kSize / 2); |
- EXPECT_EQ(SR_BLOCK, stream->Read(out, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_BLOCK, stream->Read(out, kSize, &bytes, nullptr)); |
// Try using GetReadData in a wraparound case |
// WWWWWWWWWWWWWWWW 0123456789ABCDEF |
@@ -215,16 +215,16 @@ TEST(FifoBufferTest, TestAll) { |
// WWWWWWWW....XXXX 01234567....CDEF |
// ............RRRR 01234567........ |
// RRRRRRRR........ ................ |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, NULL)); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize * 3 / 4, &bytes, NULL)); |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, nullptr)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize * 3 / 4, &bytes, nullptr)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, nullptr)); |
q = stream->GetReadData(&bytes); |
- EXPECT_TRUE(NULL != q); |
+ EXPECT_TRUE(nullptr != q); |
EXPECT_EQ(kSize / 4, bytes); |
EXPECT_EQ(0, memcmp(q, in + kSize * 3 / 4, kSize / 4)); |
stream->ConsumeReadData(kSize / 4); |
q = stream->GetReadData(&bytes); |
- EXPECT_TRUE(NULL != q); |
+ EXPECT_TRUE(nullptr != q); |
EXPECT_EQ(kSize / 2, bytes); |
EXPECT_EQ(0, memcmp(q, in, kSize / 2)); |
stream->ConsumeReadData(kSize / 2); |
@@ -235,26 +235,26 @@ TEST(FifoBufferTest, TestAll) { |
// Try using GetWriteBuffer to do a full write |
p = stream->GetWriteBuffer(&bytes); |
- EXPECT_TRUE(NULL != p); |
+ EXPECT_TRUE(nullptr != p); |
EXPECT_EQ(kSize, bytes); |
memcpy(p, in, kSize); |
stream->ConsumeWriteBuffer(kSize); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize, &bytes, nullptr)); |
EXPECT_EQ(kSize, bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize)); |
// Try using GetWriteBuffer to do some small writes |
p = stream->GetWriteBuffer(&bytes); |
- EXPECT_TRUE(NULL != p); |
+ EXPECT_TRUE(nullptr != p); |
EXPECT_EQ(kSize, bytes); |
memcpy(p, in, kSize / 2); |
stream->ConsumeWriteBuffer(kSize / 2); |
p = stream->GetWriteBuffer(&bytes); |
- EXPECT_TRUE(NULL != p); |
+ EXPECT_TRUE(nullptr != p); |
EXPECT_EQ(kSize / 2, bytes); |
memcpy(p, in + kSize / 2, kSize / 2); |
stream->ConsumeWriteBuffer(kSize / 2); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize, &bytes, nullptr)); |
EXPECT_EQ(kSize, bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize)); |
@@ -264,53 +264,53 @@ TEST(FifoBufferTest, TestAll) { |
// ........XXXXWWWW ........89AB0123 |
// WWWW....XXXXXXXX 4567....89AB0123 |
// RRRR....RRRRRRRR ................ |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize * 3 / 4, &bytes, NULL)); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize * 3 / 4, &bytes, nullptr)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, nullptr)); |
p = stream->GetWriteBuffer(&bytes); |
- EXPECT_TRUE(NULL != p); |
+ EXPECT_TRUE(nullptr != p); |
EXPECT_EQ(kSize / 4, bytes); |
memcpy(p, in, kSize / 4); |
stream->ConsumeWriteBuffer(kSize / 4); |
p = stream->GetWriteBuffer(&bytes); |
- EXPECT_TRUE(NULL != p); |
+ EXPECT_TRUE(nullptr != p); |
EXPECT_EQ(kSize / 2, bytes); |
memcpy(p, in + kSize / 4, kSize / 4); |
stream->ConsumeWriteBuffer(kSize / 4); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize * 3 / 4, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize * 3 / 4, &bytes, nullptr)); |
EXPECT_EQ(kSize * 3 / 4, bytes); |
EXPECT_EQ(0, memcmp(in + kSize / 2, out, kSize / 4)); |
EXPECT_EQ(0, memcmp(in, out + kSize / 4, kSize / 4)); |
// Check that the stream is now empty |
- EXPECT_EQ(SR_BLOCK, stream->Read(out, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_BLOCK, stream->Read(out, kSize, &bytes, nullptr)); |
// Try growing the buffer |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, nullptr)); |
EXPECT_EQ(kSize, bytes); |
EXPECT_TRUE(buf.SetCapacity(kSize * 2)); |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in + kSize, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in + kSize, kSize, &bytes, nullptr)); |
EXPECT_EQ(kSize, bytes); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize * 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize * 2, &bytes, nullptr)); |
EXPECT_EQ(kSize * 2, bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize * 2)); |
// Try shrinking the buffer |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize, &bytes, nullptr)); |
EXPECT_EQ(kSize, bytes); |
EXPECT_TRUE(buf.SetCapacity(kSize)); |
- EXPECT_EQ(SR_BLOCK, stream->Write(in, kSize, &bytes, NULL)); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize, &bytes, NULL)); |
+ EXPECT_EQ(SR_BLOCK, stream->Write(in, kSize, &bytes, nullptr)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize, &bytes, nullptr)); |
EXPECT_EQ(kSize, bytes); |
EXPECT_EQ(0, memcmp(in, out, kSize)); |
// Write to the stream, close it, read the remaining bytes |
- EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Write(in, kSize / 2, &bytes, nullptr)); |
stream->Close(); |
EXPECT_EQ(SS_CLOSED, stream->GetState()); |
- EXPECT_EQ(SR_EOS, stream->Write(in, kSize / 2, &bytes, NULL)); |
- EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_EOS, stream->Write(in, kSize / 2, &bytes, nullptr)); |
+ EXPECT_EQ(SR_SUCCESS, stream->Read(out, kSize / 2, &bytes, nullptr)); |
EXPECT_EQ(0, memcmp(in, out, kSize / 2)); |
- EXPECT_EQ(SR_EOS, stream->Read(out, kSize / 2, &bytes, NULL)); |
+ EXPECT_EQ(SR_EOS, stream->Read(out, kSize / 2, &bytes, nullptr)); |
} |
TEST(FifoBufferTest, FullBufferCheck) { |
@@ -318,7 +318,7 @@ TEST(FifoBufferTest, FullBufferCheck) { |
buff.ConsumeWriteBuffer(10); |
size_t free; |
- EXPECT_TRUE(buff.GetWriteBuffer(&free) != NULL); |
+ EXPECT_TRUE(buff.GetWriteBuffer(&free) != nullptr); |
EXPECT_EQ(0U, free); |
} |
@@ -329,7 +329,7 @@ TEST(FifoBufferTest, WriteOffsetAndReadOffset) { |
FifoBuffer buf(kSize); |
// Write 14 bytes. |
- EXPECT_EQ(SR_SUCCESS, buf.Write(in, 14, NULL, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, buf.Write(in, 14, nullptr, nullptr)); |
// Make sure data is in |buf|. |
size_t buffered; |
@@ -345,10 +345,10 @@ TEST(FifoBufferTest, WriteOffsetAndReadOffset) { |
EXPECT_EQ(12u, remaining); |
// Write at offset 12, this should fail. |
- EXPECT_EQ(SR_BLOCK, buf.WriteOffset(in, 10, 12, NULL)); |
+ EXPECT_EQ(SR_BLOCK, buf.WriteOffset(in, 10, 12, nullptr)); |
// Write 8 bytes at offset 4, this wraps around the buffer. |
- EXPECT_EQ(SR_SUCCESS, buf.WriteOffset(in, 8, 4, NULL)); |
+ EXPECT_EQ(SR_SUCCESS, buf.WriteOffset(in, 8, 4, nullptr)); |
// Number of available space remains the same until we call |
// ConsumeWriteBuffer(). |
@@ -368,7 +368,7 @@ TEST(FifoBufferTest, WriteOffsetAndReadOffset) { |
EXPECT_EQ(16u, buffered); |
// Read at offset 16, this should fail since we don't have that much data. |
- EXPECT_EQ(SR_BLOCK, buf.ReadOffset(out, 10, 16, NULL)); |
+ EXPECT_EQ(SR_BLOCK, buf.ReadOffset(out, 10, 16, nullptr)); |
} |
} // namespace rtc |