Move to clang-format-6.0
This commit moves the codebase to the lastest clang-format file from
upstream, as well as clang-format-6.0.
Change-Id: Ice8313468097c0c42317fbb9e10ddf036e8cff4c
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/src/kvm_websocket_test.cpp b/src/kvm_websocket_test.cpp
index b5e1bdc..1ddaad9 100644
--- a/src/kvm_websocket_test.cpp
+++ b/src/kvm_websocket_test.cpp
@@ -1,9 +1,12 @@
+#include "gzip_helper.hpp"
+#include "web_kvm.hpp"
+
#include <iostream>
#include <sstream>
#include <vector>
-#include "gzip_helper.hpp"
-#include "web_kvm.hpp"
+
#include "crow.h"
+
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -11,93 +14,101 @@
using namespace testing;
// Tests static files are loaded correctly
-TEST(Kvm, BasicRfb) {
- return; // TODO(ed) Make hte code below work again
- SimpleApp app;
+TEST(Kvm, BasicRfb)
+{
+ return; // TODO(ed) Make hte code below work again
+ SimpleApp app;
- crow::kvm::requestRoutes(app);
- app.bindaddr("127.0.0.1").port(45451);
- BMCWEB_ROUTE(app, "/")([]() { return boost::beast::http::status::ok; });
- auto _ = async(std::launch::async, [&] { app.run(); });
- auto routes = app.getRoutes();
- asio::io_service is;
+ crow::kvm::requestRoutes(app);
+ app.bindaddr("127.0.0.1").port(45451);
+ BMCWEB_ROUTE(app, "/")([]() { return boost::beast::http::status::ok; });
+ auto _ = async(std::launch::async, [&] { app.run(); });
+ auto routes = app.getRoutes();
+ asio::io_service is;
- {
- // Retry a couple of times waiting for the server to come up
- // TODO(ed) This is really unfortunate, and should use some form of mock
- asio::ip::tcp::socket c(is);
- for (int i = 0; i < 200; i++) {
- try {
- c.connect(asio::ip::tcp::endpoint(
- asio::ip::address::from_string("127.0.0.1"), 45451));
- c.close();
- break;
- } catch (std::exception e) {
- // do nothing. We expect this to fail while the server is starting up
- }
+ {
+ // Retry a couple of times waiting for the server to come up
+ // TODO(ed) This is really unfortunate, and should use some form of
+ // mock
+ asio::ip::tcp::socket c(is);
+ for (int i = 0; i < 200; i++)
+ {
+ try
+ {
+ c.connect(asio::ip::tcp::endpoint(
+ asio::ip::address::from_string("127.0.0.1"), 45451));
+ c.close();
+ break;
+ }
+ catch (std::exception e)
+ {
+ // do nothing. We expect this to fail while the server is
+ // starting up
+ }
+ }
}
- }
- // Get the websocket
- std::string sendmsg =
- ("GET /kvmws HTTP/1.1\r\n"
- "Host: localhost:45451\r\n"
- "Connection: Upgrade\r\n"
- "Upgrade: websocket\r\n"
- "Sec-WebSocket-Version: 13\r\n"
- "Sec-WebSocket-Key: aLeGkmLPZmdv5tTyEpJ3jQ==\r\n"
- "Sec-WebSocket-Extensions: permessage-deflate; "
- "client_max_window_bits\r\n"
- "Sec-WebSocket-Protocol: binary\r\n"
- "\r\n");
+ // Get the websocket
+ std::string sendmsg = ("GET /kvmws HTTP/1.1\r\n"
+ "Host: localhost:45451\r\n"
+ "Connection: Upgrade\r\n"
+ "Upgrade: websocket\r\n"
+ "Sec-WebSocket-Version: 13\r\n"
+ "Sec-WebSocket-Key: aLeGkmLPZmdv5tTyEpJ3jQ==\r\n"
+ "Sec-WebSocket-Extensions: permessage-deflate; "
+ "client_max_window_bits\r\n"
+ "Sec-WebSocket-Protocol: binary\r\n"
+ "\r\n");
- asio::ip::tcp::socket socket(is);
- socket.connect(asio::ip::tcp::endpoint(
- asio::ip::address::from_string("127.0.0.1"), 45451));
- socket.send(asio::buffer(sendmsg));
+ asio::ip::tcp::socket socket(is);
+ socket.connect(asio::ip::tcp::endpoint(
+ asio::ip::address::from_string("127.0.0.1"), 45451));
+ socket.send(asio::buffer(sendmsg));
- // Read the Response status line. The Response streambuf will automatically
- // grow to accommodate the entire line. The growth may be limited by passing
- // a maximum size to the streambuf constructor.
- boost::asio::streambuf response;
- boost::asio::read_until(socket, response, "\r\n");
+ // Read the Response status line. The Response streambuf will automatically
+ // grow to accommodate the entire line. The growth may be limited by passing
+ // a maximum size to the streambuf constructor.
+ boost::asio::streambuf response;
+ boost::asio::read_until(socket, response, "\r\n");
- // Check that Response is OK.
- std::istream response_stream(&response);
- std::string http_response;
- std::getline(response_stream, http_response);
+ // Check that Response is OK.
+ std::istream response_stream(&response);
+ std::string http_response;
+ std::getline(response_stream, http_response);
- EXPECT_EQ(http_response, "HTTP/1.1 101 Switching Protocols\r");
+ EXPECT_EQ(http_response, "HTTP/1.1 101 Switching Protocols\r");
- // Read the Response headers, which are terminated by a blank line.
- boost::asio::read_until(socket, response, "\r\n\r\n");
+ // Read the Response headers, which are terminated by a blank line.
+ boost::asio::read_until(socket, response, "\r\n\r\n");
- // Process the Response headers.
- std::string header;
- std::vector<std::string> headers;
- while (std::getline(response_stream, header) && header != "\r") {
- headers.push_back(header);
- }
+ // Process the Response headers.
+ std::string header;
+ std::vector<std::string> headers;
+ while (std::getline(response_stream, header) && header != "\r")
+ {
+ headers.push_back(header);
+ }
- EXPECT_THAT(headers, Contains("Upgrade: websocket\r"));
- EXPECT_THAT(headers, Contains("Connection: Upgrade\r"));
- EXPECT_THAT(headers, Contains("Sec-WebSocket-Protocol: binary\r"));
- // TODO(ed) This is the result that it gives today. Need to check websocket
- // docs and make
- // sure that this calclution is actually being done to spec
- EXPECT_THAT(headers,
- Contains("Sec-WebSocket-Accept: /CnDM3l79rIxniLNyxMryXbtLEU=\r"));
- std::array<char, 13> rfb_open_string;
+ EXPECT_THAT(headers, Contains("Upgrade: websocket\r"));
+ EXPECT_THAT(headers, Contains("Connection: Upgrade\r"));
+ EXPECT_THAT(headers, Contains("Sec-WebSocket-Protocol: binary\r"));
+ // TODO(ed) This is the result that it gives today. Need to check websocket
+ // docs and make
+ // sure that this calclution is actually being done to spec
+ EXPECT_THAT(
+ headers,
+ Contains("Sec-WebSocket-Accept: /CnDM3l79rIxniLNyxMryXbtLEU=\r"));
+ std::array<char, 13> rfb_open_string;
- //
- // socket.receive(rfb_open_string.data(), rfb_open_string.size());
- boost::asio::read(socket, boost::asio::buffer(rfb_open_string));
- auto open_string =
- std::string(std::begin(rfb_open_string), std::end(rfb_open_string));
- // Todo(ed) find out what the two characters at the end of the websocket
- // stream are
- open_string = open_string.substr(2);
- EXPECT_EQ(open_string, "RFB 003.008");
+ //
+ // socket.receive(rfb_open_string.data(), rfb_open_string.size());
+ boost::asio::read(socket, boost::asio::buffer(rfb_open_string));
+ auto open_string =
+ std::string(std::begin(rfb_open_string), std::end(rfb_open_string));
+ // Todo(ed) find out what the two characters at the end of the websocket
+ // stream are
+ open_string = open_string.substr(2);
+ EXPECT_EQ(open_string, "RFB 003.008");
- app.stop();
+ app.stop();
}
\ No newline at end of file