// Copyright 2013 Google Inc. All Rights Reserved. #include "test_util.h" TestBuffer* TestBuffer::Create(uint32_t capacity) { return new TestBuffer(capacity); } void TestBuffer::Destroy() { delete this; } int32_t TestBuffer::Capacity() const { return capacity_; } uint8_t* TestBuffer::Data() { return buffer_; } void TestBuffer::SetSize(int32_t size) { size_ = size; } int32_t TestBuffer::Size() const { return size_; } TestBuffer::TestBuffer(uint32_t capacity) : buffer_(new uint8_t[capacity]), capacity_(capacity) {} TestBuffer::~TestBuffer() { if (buffer_) { delete[] buffer_; buffer_ = NULL; } } TestDecryptedBlock::TestDecryptedBlock() : buffer_(NULL), timestamp_(0) {} TestDecryptedBlock::~TestDecryptedBlock() { if (buffer_) { buffer_->Destroy(); buffer_ = NULL; } } void TestDecryptedBlock::SetDecryptedBuffer(cdm::Buffer* buffer) { if (buffer_) buffer_->Destroy(); buffer_ = buffer; } cdm::Buffer* TestDecryptedBlock::DecryptedBuffer() { return buffer_; } void TestDecryptedBlock::SetTimestamp(int64_t timestamp) { timestamp_ = timestamp; } int64_t TestDecryptedBlock::Timestamp() const { return timestamp_; }