Fix cURL example build

Fixes #76

PiperOrigin-RevId: 350728353
Change-Id: Iebc4a0a381fff379498b66dfa9238d33efa69ec1
This commit is contained in:
Wiktor Garbacz 2021-01-08 02:47:37 -08:00 committed by Copybara-Service
parent 6dd0a52561
commit e94ba3a16b
2 changed files with 16 additions and 13 deletions

View File

@ -27,8 +27,8 @@
#include "absl/status/statusor.h"
int CurlTestUtils::port_;
std::thread CurlTestUtils::server_thread_;
int curl::tests::CurlTestUtils::port_;
std::thread curl::tests::CurlTestUtils::server_thread_;
absl::Status curl::tests::CurlTestUtils::CurlTestSetUp() {
// Initialize sandbox2 and sapi

View File

@ -59,10 +59,11 @@ TEST_F(CurlTest, EffectivePort) {
ASSERT_TRUE(PerformRequest().ok());
// Get effective port
SAPI_ASSERT_OK_AND_ASSIGN(int getinfo_code, api_->curl_easy_getinfo_ptr(
curl_.get(), CURLINFO_PRIMARY_PORT,
SAPI_ASSERT_OK_AND_ASSIGN(
int getinfo_code,
api_->curl_easy_getinfo_ptr(curl_.get(), curl::CURLINFO_PRIMARY_PORT,
effective_port.PtrBoth()));
ASSERT_EQ(getinfo_code, CURLE_OK);
ASSERT_EQ(getinfo_code, curl::CURLE_OK);
// Compare effective port with port set by the mock server
ASSERT_EQ(effective_port.GetValue(), port_);
@ -90,10 +91,11 @@ TEST_F(CurlTest, ContentType) {
ASSERT_TRUE(PerformRequest().ok());
// Get effective URL
SAPI_ASSERT_OK_AND_ASSIGN(int getinfo_code, api_->curl_easy_getinfo_ptr(
curl_.get(), CURLINFO_CONTENT_TYPE,
SAPI_ASSERT_OK_AND_ASSIGN(
int getinfo_code,
api_->curl_easy_getinfo_ptr(curl_.get(), curl::CURLINFO_CONTENT_TYPE,
content_type_ptr.PtrBoth()));
ASSERT_EQ(getinfo_code, CURLE_OK);
ASSERT_EQ(getinfo_code, curl::CURLE_OK);
// Store content type in a string
SAPI_ASSERT_OK_AND_ASSIGN(std::string content_type,
@ -115,9 +117,10 @@ TEST_F(CurlTest, POSTResponse) {
sapi::v::ConstCStr post_fields("postfields");
// Set request method to POST
SAPI_ASSERT_OK_AND_ASSIGN(int setopt_post, api_->curl_easy_setopt_long(
curl_.get(), CURLOPT_POST, 1l));
ASSERT_EQ(setopt_post, CURLE_OK);
SAPI_ASSERT_OK_AND_ASSIGN(
int setopt_post,
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
SAPI_ASSERT_OK_AND_ASSIGN(