Source release 17.1.0

This commit is contained in:
John "Juce" Bruce
2022-07-07 17:14:31 -07:00
parent 8c17574083
commit 694cf6fb25
2233 changed files with 272026 additions and 223371 deletions

View File

@@ -1,6 +1,6 @@
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine Master
// License Agreement.
// source code may only be used and distributed under the Widevine License
// Agreement.
#include <errno.h>
#include <memory>
@@ -30,13 +30,13 @@ const int kTimeout = 3000;
class HttpSocketTest : public testing::Test {
public:
HttpSocketTest() {}
~HttpSocketTest() {}
~HttpSocketTest() override {}
protected:
bool Connect(const std::string& server_url) {
socket_.reset(new HttpSocket(server_url));
if (socket_->Connect(kTimeout)) {
if (socket_->ConnectAndLogErrors(kTimeout)) {
LOGD("connected to %s", socket_->domain_name().c_str());
return true;
} else {
@@ -73,7 +73,8 @@ class HttpSocketTest : public testing::Test {
// append data
request.append(data);
socket_->Write(request.c_str(), request.size(), kTimeout);
socket_->WriteAndLogErrors(request.c_str(),
static_cast<int>(request.size()), kTimeout);
LOGD("request: %s", request.c_str());
return true;
@@ -81,7 +82,7 @@ class HttpSocketTest : public testing::Test {
bool GetResponse(std::string* response) {
char buffer[kHttpBufferSize];
int bytes = socket_->Read(buffer, sizeof(buffer), kTimeout);
int bytes = socket_->ReadAndLogErrors(buffer, sizeof(buffer), kTimeout);
if (bytes < 0) {
LOGE("read error, errno = %d", errno);
return false;
@@ -163,7 +164,7 @@ ParseUrlTests parse_url_tests[] = {
"8888", // port
"/", // path
},
{nullptr, nullptr, false, nullptr, 0, nullptr} // list terminator
{} // list terminator
};
TEST_F(HttpSocketTest, ParseUrlTest) {
@@ -206,43 +207,3 @@ TEST_F(HttpSocketTest, RoundTripTest) {
}
} // namespace wvcdm
int main(int argc, char** argv) {
using namespace wvcdm;
::testing::InitGoogleTest(&argc, argv);
std::string temp;
std::string test_server(kHttpsTestServer);
std::string test_data(gTestData);
for (int i = 1; i < argc; i++) {
temp.assign(argv[i]);
if (temp.find("--server=") == 0) {
gTestServer.assign(temp.substr(strlen("--server=")));
} else if (temp.find("--data=") == 0) {
gTestData.assign(temp.substr(strlen("--data=")));
} else {
std::cout << "error: unknown option '" << argv[i] << "'" << std::endl;
std::cout << "usage: http_socket_test [options]" << std::endl
<< std::endl;
std::cout << std::setw(30) << std::left << " --server=<server_url>";
std::cout
<< "configure the test server url, please include http[s] in the url"
<< std::endl;
std::cout << std::setw(30) << std::left << " ";
std::cout << "default: " << test_server << std::endl;
std::cout << std::setw(30) << std::left << " --data=<data>";
std::cout << "configure data to send, in ascii string format"
<< std::endl;
std::cout << std::setw(30) << std::left << " ";
std::cout << "default: " << test_data << std::endl << std::endl;
return 0;
}
}
std::cout << std::endl;
std::cout << "Server: " << gTestServer << std::endl;
std::cout << "Data: " << gTestData << std::endl;
return RUN_ALL_TESTS();
}