Permalink
Browse files

test: fix failing inspector cctest

Test was updated to wait till the inspector processes socket closure.

Fixes: #8006
PR-URL: #8019
Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information...
Eugene Ostroukhov authored and ofrobots committed Aug 8, 2016
1 parent c628982 commit 49e473a45fb3e13fdd4588c6241b71bbac4fe5ab
Showing with 9 additions and 7 deletions.
  1. +9 −7 test/cctest/test_inspector_socket.cc
@@ -731,8 +731,11 @@ TEST_F(InspectorSocketTest, GetThenHandshake) {
manual_inspector_socket_cleanup();
}
static void WriteBeforeHandshake_close_cb(uv_handle_t* handle) {
*(static_cast<bool *>(handle->data)) = true;
static void WriteBeforeHandshake_inspector_delegate(inspector_handshake_event e,
const std::string& path,
bool* cont) {
if (e == kInspectorHandshakeFailed)
inspector_closed = 1;
}
TEST_F(InspectorSocketTest, WriteBeforeHandshake) {
@@ -743,11 +746,10 @@ TEST_F(InspectorSocketTest, WriteBeforeHandshake) {
inspector_write(&inspector, MESSAGE1, sizeof(MESSAGE1) - 1);
inspector_write(&inspector, MESSAGE2, sizeof(MESSAGE2) - 1);
expect_on_client(EXPECTED, sizeof(EXPECTED) - 1);
bool flag = false;
client_socket.data = &flag;
uv_close(reinterpret_cast<uv_handle_t*>(&client_socket),
WriteBeforeHandshake_close_cb);
SPIN_WHILE(!flag);
inspector_closed = 0;
handshake_delegate = WriteBeforeHandshake_inspector_delegate;
really_close(reinterpret_cast<uv_handle_t*>(&client_socket));
SPIN_WHILE(inspector_closed == 0);
}
static void CleanupSocketAfterEOF_close_cb(inspector_socket_t* inspector,

0 comments on commit 49e473a

Please sign in to comment.