Update source files for bracket style

This commit is contained in:
Marshall Greenblatt
2023-01-02 17:59:03 -05:00
parent d84b07a5cb
commit 3af3eab3e4
366 changed files with 7275 additions and 3834 deletions

View File

@ -96,15 +96,17 @@ class TestServerHandler : public CefServerHandler {
if (!http_request_handler_list_.empty()) {
HttpRequestHandlerList::const_iterator it =
http_request_handler_list_.begin();
for (; it != http_request_handler_list_.end(); ++it)
for (; it != http_request_handler_list_.end(); ++it) {
delete *it;
}
}
if (!ws_request_handler_list_.empty()) {
WsRequestHandlerList::const_iterator it =
ws_request_handler_list_.begin();
for (; it != ws_request_handler_list_.end(); ++it)
for (; it != ws_request_handler_list_.end(); ++it) {
delete *it;
}
}
std::move(destroy_callback_).Run();
@ -165,8 +167,9 @@ class TestServerHandler : public CefServerHandler {
// |destroy_callback|.
void ShutdownServer() {
EXPECT_TRUE(server_);
if (server_)
if (server_) {
server_->Shutdown();
}
}
void OnServerCreated(CefRefPtr<CefServer> server) override {
@ -224,8 +227,9 @@ class TestServerHandler : public CefServerHandler {
connection_id_set_.erase(it);
ConnectionIdSet::iterator it2 = ws_connection_id_set_.find(connection_id);
if (it2 != ws_connection_id_set_.end())
if (it2 != ws_connection_id_set_.end()) {
ws_connection_id_set_.erase(it2);
}
if (connection_id_set_.empty()) {
EXPECT_TRUE(ws_connection_id_set_.empty());
@ -248,8 +252,9 @@ class TestServerHandler : public CefServerHandler {
for (; it != http_request_handler_list_.end(); ++it) {
handled =
(*it)->HandleRequest(server, connection_id, client_address, request);
if (handled)
if (handled) {
break;
}
}
EXPECT_TRUE(handled) << "missing HttpRequestHandler for "
<< request->GetURL().ToString();
@ -276,8 +281,9 @@ class TestServerHandler : public CefServerHandler {
for (; it != ws_request_handler_list_.end(); ++it) {
handled = (*it)->HandleRequest(server, connection_id, client_address,
request, callback);
if (handled)
if (handled) {
break;
}
}
EXPECT_TRUE(handled) << "missing WsRequestHandler for "
<< request->GetURL().ToString();
@ -297,8 +303,9 @@ class TestServerHandler : public CefServerHandler {
WsRequestHandlerList::const_iterator it = ws_request_handler_list_.begin();
for (; it != ws_request_handler_list_.end(); ++it) {
handled = (*it)->HandleConnected(server, connection_id);
if (handled)
if (handled) {
break;
}
}
EXPECT_TRUE(handled) << "missing WsRequestHandler for " << connection_id;
@ -321,8 +328,9 @@ class TestServerHandler : public CefServerHandler {
WsRequestHandlerList::const_iterator it = ws_request_handler_list_.begin();
for (; it != ws_request_handler_list_.end(); ++it) {
handled = (*it)->HandleMessage(server, connection_id, data, data_size);
if (handled)
if (handled) {
break;
}
}
EXPECT_TRUE(handled) << "missing WsRequestHandler for " << connection_id;
@ -497,8 +505,9 @@ class HttpTestRunner : public base::RefCountedThreadSafe<HttpTestRunner> {
next_request_id_(0) {}
virtual ~HttpTestRunner() {
if (destroy_event_)
if (destroy_event_) {
destroy_event_->Signal();
}
}
void AddRequestRunner(std::unique_ptr<RequestRunner> request_runner) {
@ -624,8 +633,9 @@ class HttpTestRunner : public base::RefCountedThreadSafe<HttpTestRunner> {
EXPECT_TRUE(request_runner_map_.empty());
// Cancel the timeout, if any.
if (ui_thread_helper_)
if (ui_thread_helper_) {
ui_thread_helper_.reset();
}
// Signal test completion.
run_event_->Signal();
@ -633,8 +643,9 @@ class HttpTestRunner : public base::RefCountedThreadSafe<HttpTestRunner> {
TestHandler::UIThreadHelper* GetUIThreadHelper() {
EXPECT_UI_THREAD();
if (!ui_thread_helper_)
if (!ui_thread_helper_) {
ui_thread_helper_.reset(new TestHandler::UIThreadHelper());
}
return ui_thread_helper_.get();
}
@ -749,8 +760,9 @@ void SendHttpServerResponse(CefRefPtr<CefServer> server,
std::string GetHeaderValue(const CefServer::HeaderMap& header_map,
const std::string& header_name) {
CefServer::HeaderMap::const_iterator it = header_map.find(header_name);
if (it != header_map.end())
if (it != header_map.end()) {
return it->second;
}
return std::string();
}
@ -811,8 +823,9 @@ CefRefPtr<CefRequest> CreateTestServerRequest(
header_map.insert(std::make_pair("content-type", content_type));
}
if (!extra_headers.empty())
if (!extra_headers.empty()) {
header_map.insert(extra_headers.begin(), extra_headers.end());
}
request->SetHeaderMap(header_map);
return request;
@ -936,8 +949,9 @@ class StaticHttpRequestRunner : public HttpTestRunner::RequestRunner {
CefRefPtr<CefRequest> request = CreateTestServerRequest(path, "GET");
HttpServerResponse response(HttpServerResponse::TYPE_200);
response.content_type = "text/html";
if (with_content)
if (with_content) {
response.content = "<html>200 response content</html>";
}
return std::make_unique<StaticHttpRequestRunner>(request, response);
}
@ -972,10 +986,12 @@ class StaticHttpRequestRunner : public HttpTestRunner::RequestRunner {
HttpServerResponse response(HttpServerResponse::TYPE_CUSTOM);
response.response_code = 202;
if (with_content)
if (with_content) {
response.content = "BlahBlahBlah";
if (!with_content_length)
}
if (!with_content_length) {
response.no_content_length = true;
}
response.content_type = "application/x-blah-blah";
response.extra_headers.insert(
std::make_pair("x-response-custom1", "My Value 1"));
@ -1028,8 +1044,9 @@ class StaticHttpRequestRunner : public HttpTestRunner::RequestRunner {
EXPECT_EQ(error, ERR_NONE)
<< "OnResponseComplete for " << request_->GetURL().ToString();
if (error == ERR_NONE)
if (error == ERR_NONE) {
VerifyHttpServerResponse(response_, response, data);
}
std::move(complete_callback_).Run();
}