cesium-native/Cesium3DTilesSelection/test/SimpleAssetResponse.h

38 lines
1.0 KiB
C
Raw Permalink Normal View History

2021-07-01 14:34:08 +08:00
#pragma once
#include "CesiumAsync/IAssetResponse.h"
#include <cstddef>
#include <vector>
class SimpleAssetResponse : public CesiumAsync::IAssetResponse {
public:
SimpleAssetResponse(
uint16_t statusCode,
const std::string& contentType,
const CesiumAsync::HttpHeaders& headers,
const std::vector<std::byte>& data)
: mockStatusCode{statusCode},
mockContentType{contentType},
mockHeaders{headers},
mockData{data} {}
virtual uint16_t statusCode() const override { return this->mockStatusCode; }
virtual std::string contentType() const override {
return this->mockContentType;
}
virtual const CesiumAsync::HttpHeaders& headers() const override {
return this->mockHeaders;
}
virtual gsl::span<const std::byte> data() const override {
return gsl::span<const std::byte>(mockData.data(), mockData.size());
}
uint16_t mockStatusCode;
std::string mockContentType;
CesiumAsync::HttpHeaders mockHeaders;
std::vector<std::byte> mockData;
};