mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Fix cURL example build
Fixes #76 PiperOrigin-RevId: 350728353 Change-Id: Iebc4a0a381fff379498b66dfa9238d33efa69ec1
This commit is contained in:
parent
6dd0a52561
commit
e94ba3a16b
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
|
|
||||||
int CurlTestUtils::port_;
|
int curl::tests::CurlTestUtils::port_;
|
||||||
std::thread CurlTestUtils::server_thread_;
|
std::thread curl::tests::CurlTestUtils::server_thread_;
|
||||||
|
|
||||||
absl::Status curl::tests::CurlTestUtils::CurlTestSetUp() {
|
absl::Status curl::tests::CurlTestUtils::CurlTestSetUp() {
|
||||||
// Initialize sandbox2 and sapi
|
// Initialize sandbox2 and sapi
|
||||||
|
|
|
@ -59,10 +59,11 @@ TEST_F(CurlTest, EffectivePort) {
|
||||||
ASSERT_TRUE(PerformRequest().ok());
|
ASSERT_TRUE(PerformRequest().ok());
|
||||||
|
|
||||||
// Get effective port
|
// Get effective port
|
||||||
SAPI_ASSERT_OK_AND_ASSIGN(int getinfo_code, api_->curl_easy_getinfo_ptr(
|
SAPI_ASSERT_OK_AND_ASSIGN(
|
||||||
curl_.get(), CURLINFO_PRIMARY_PORT,
|
int getinfo_code,
|
||||||
effective_port.PtrBoth()));
|
api_->curl_easy_getinfo_ptr(curl_.get(), curl::CURLINFO_PRIMARY_PORT,
|
||||||
ASSERT_EQ(getinfo_code, CURLE_OK);
|
effective_port.PtrBoth()));
|
||||||
|
ASSERT_EQ(getinfo_code, curl::CURLE_OK);
|
||||||
|
|
||||||
// Compare effective port with port set by the mock server
|
// Compare effective port with port set by the mock server
|
||||||
ASSERT_EQ(effective_port.GetValue(), port_);
|
ASSERT_EQ(effective_port.GetValue(), port_);
|
||||||
|
@ -90,10 +91,11 @@ TEST_F(CurlTest, ContentType) {
|
||||||
ASSERT_TRUE(PerformRequest().ok());
|
ASSERT_TRUE(PerformRequest().ok());
|
||||||
|
|
||||||
// Get effective URL
|
// Get effective URL
|
||||||
SAPI_ASSERT_OK_AND_ASSIGN(int getinfo_code, api_->curl_easy_getinfo_ptr(
|
SAPI_ASSERT_OK_AND_ASSIGN(
|
||||||
curl_.get(), CURLINFO_CONTENT_TYPE,
|
int getinfo_code,
|
||||||
content_type_ptr.PtrBoth()));
|
api_->curl_easy_getinfo_ptr(curl_.get(), curl::CURLINFO_CONTENT_TYPE,
|
||||||
ASSERT_EQ(getinfo_code, CURLE_OK);
|
content_type_ptr.PtrBoth()));
|
||||||
|
ASSERT_EQ(getinfo_code, curl::CURLE_OK);
|
||||||
|
|
||||||
// Store content type in a string
|
// Store content type in a string
|
||||||
SAPI_ASSERT_OK_AND_ASSIGN(std::string content_type,
|
SAPI_ASSERT_OK_AND_ASSIGN(std::string content_type,
|
||||||
|
@ -115,9 +117,10 @@ TEST_F(CurlTest, POSTResponse) {
|
||||||
sapi::v::ConstCStr post_fields("postfields");
|
sapi::v::ConstCStr post_fields("postfields");
|
||||||
|
|
||||||
// Set request method to POST
|
// Set request method to POST
|
||||||
SAPI_ASSERT_OK_AND_ASSIGN(int setopt_post, api_->curl_easy_setopt_long(
|
SAPI_ASSERT_OK_AND_ASSIGN(
|
||||||
curl_.get(), CURLOPT_POST, 1l));
|
int setopt_post,
|
||||||
ASSERT_EQ(setopt_post, CURLE_OK);
|
api_->curl_easy_setopt_long(curl_.get(), curl::CURLOPT_POST, 1l));
|
||||||
|
ASSERT_EQ(setopt_post, curl::CURLE_OK);
|
||||||
|
|
||||||
// Set the size of the POST fields
|
// Set the size of the POST fields
|
||||||
SAPI_ASSERT_OK_AND_ASSIGN(
|
SAPI_ASSERT_OK_AND_ASSIGN(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user