cesium-native/CesiumAsync/test/MockAssetRequest.h

40 lines
1.0 KiB
C
Raw Permalink Normal View History

2021-01-21 04:23:54 +08:00
#pragma once
2024-12-21 01:00:09 +08:00
#include <CesiumAsync/HttpHeaders.h>
#include <CesiumAsync/IAssetRequest.h>
#include <CesiumAsync/IAssetResponse.h>
2024-12-21 03:54:51 +08:00
#include <memory>
2021-01-21 04:23:54 +08:00
#include <string>
class MockAssetRequest : public CesiumAsync::IAssetRequest {
public:
2021-03-09 08:37:45 +08:00
MockAssetRequest(
const std::string& method,
const std::string& url,
const CesiumAsync::HttpHeaders& headers,
std::unique_ptr<CesiumAsync::IAssetResponse> response)
: _method{method},
_url{url},
_headers{headers},
_pResponse{std::move(response)} {}
2021-02-02 05:31:56 +08:00
2021-03-09 08:37:45 +08:00
virtual const std::string& method() const override { return this->_method; }
2021-02-02 05:31:56 +08:00
2021-03-09 08:37:45 +08:00
virtual const std::string& url() const override { return this->_url; }
2021-02-02 05:31:56 +08:00
2021-03-09 08:37:45 +08:00
virtual const CesiumAsync::HttpHeaders& headers() const override {
return this->_headers;
}
2021-02-02 05:31:56 +08:00
2021-03-09 08:37:45 +08:00
virtual const CesiumAsync::IAssetResponse* response() const override {
return this->_pResponse.get();
}
2021-01-21 04:23:54 +08:00
private:
2021-03-09 08:37:45 +08:00
std::string _method;
std::string _url;
CesiumAsync::HttpHeaders _headers;
std::unique_ptr<CesiumAsync::IAssetResponse> _pResponse;
2021-01-21 04:23:54 +08:00
};