Made buffer thread wait for notify when no gui #4721

This commit is contained in:
Jerry (Xinyu Hou)
2015-07-16 15:53:53 -07:00
parent 18a6f75371
commit c3d38db053
4 changed files with 26 additions and 13 deletions

View File

@@ -52,11 +52,10 @@ TEST(IpcLogOutputterTests, write_threadingEnabled_bufferIsSent)
ON_CALL(mockServer, hasClients(_)).WillByDefault(Return(true));
EXPECT_CALL(mockServer, hasClients(_)).Times(2);
EXPECT_CALL(mockServer, send(IpcLogLineMessageEq("mock 1\n"), _)).Times(1);
EXPECT_CALL(mockServer, send(IpcLogLineMessageEq("mock 2\n"), _)).Times(1);
IpcLogOutputter outputter(mockServer, true);
IpcLogOutputter outputter(mockServer, kIpcClientUnknown, true);
outputter.write(kNOTE, "mock 1");
mockServer.waitForSend();
outputter.write(kNOTE, "mock 2");
@@ -68,11 +67,10 @@ TEST(IpcLogOutputterTests, write_overBufferMaxSize_firstLineTruncated)
MockIpcServer mockServer;
ON_CALL(mockServer, hasClients(_)).WillByDefault(Return(true));
EXPECT_CALL(mockServer, hasClients(_)).Times(1);
EXPECT_CALL(mockServer, send(IpcLogLineMessageEq("mock 2\nmock 3\n"), _)).Times(1);
IpcLogOutputter outputter(mockServer, false);
IpcLogOutputter outputter(mockServer, kIpcClientUnknown, false);
outputter.bufferMaxSize(2);
// log more lines than the buffer can contain
@@ -91,7 +89,7 @@ TEST(IpcLogOutputterTests, write_underBufferMaxSize_allLinesAreSent)
EXPECT_CALL(mockServer, hasClients(_)).Times(1);
EXPECT_CALL(mockServer, send(IpcLogLineMessageEq("mock 1\nmock 2\n"), _)).Times(1);
IpcLogOutputter outputter(mockServer, false);
IpcLogOutputter outputter(mockServer, kIpcClientUnknown, false);
outputter.bufferMaxSize(2);
// log more lines than the buffer can contain
@@ -147,7 +145,7 @@ TEST(IpcLogOutputterTests, write_underBufferRateLimit_allLinesAreSent)
EXPECT_CALL(mockServer, send(IpcLogLineMessageEq("mock 1\nmock 2\n"), _)).Times(1);
EXPECT_CALL(mockServer, send(IpcLogLineMessageEq("mock 3\nmock 4\n"), _)).Times(1);
IpcLogOutputter outputter(mockServer, false);
IpcLogOutputter outputter(mockServer, kIpcClientUnknown, false);
outputter.bufferRateLimit(4, 1); // 1s (should be plenty of time)
// log 1 more line than the buffer can accept in time limit.