Source release v2.2.0-0-903 + third_party libs
Change-Id: I03f670eaeb052bc741abb347be06f8ddc58418e7
This commit is contained in:
31
cdm/test/test_host_4_file_io.cpp
Normal file
31
cdm/test/test_host_4_file_io.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
|
||||
// Review the TestHost_4 class below to observe how the CDM interfaces with
|
||||
// the host application.
|
||||
|
||||
#include "test_host_4_file_io.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
void TestHost_4_FileIO::Open(const char* file_name, uint32_t file_name_size) {
|
||||
ASSERT_EQ(0, file_name_.size());
|
||||
file_name_.assign(file_name, file_name_size);
|
||||
client_->OnOpenComplete(cdm::FileIOClient::kSuccess);
|
||||
}
|
||||
|
||||
void TestHost_4_FileIO::Read() {
|
||||
ASSERT_NE(0, file_name_.size());
|
||||
const std::string& data = host_->file_store[file_name_];
|
||||
client_->OnReadComplete(cdm::FileIOClient::kSuccess,
|
||||
reinterpret_cast<const uint8_t*>(data.data()),
|
||||
data.size());
|
||||
}
|
||||
|
||||
void TestHost_4_FileIO::Write(const uint8_t* data, uint32_t data_size) {
|
||||
ASSERT_NE(0, file_name_.size());
|
||||
host_->file_store[file_name_].assign(reinterpret_cast<const char*>(data),
|
||||
data_size);
|
||||
client_->OnWriteComplete(cdm::FileIOClient::kSuccess);
|
||||
}
|
||||
|
||||
void TestHost_4_FileIO::Close() { delete this; }
|
||||
Reference in New Issue
Block a user