fd08064ec7ca120b3501c341c8dfde9fdd757316 |
|
08-Oct-2016 |
mukesh agrawal <quiche@google.com> |
CommandProcessor: start dump implementation Update CommandProcessor, to support dumping existing logs. In order to keep the CL size reasonable, this CL only implements dumping of the timestamps of each message. Dumping the payload will be added in a follow-on CL. Note that the new unit tests use ::testing::Invoke(), in a way that mixes the mocking and faking test strategies in a single object. The GMock documentation discourages this kind of mixing, in favor of splitting a class into one piece that is to be mocked, and another that is to be faked [1]. The reason we mix the strategies, despite the recommendation to the contrary, is that we don't always want to fake Os::Write(). Some times, we just want to mock that method. Along the way: - add a ScopedRewinder to MessageBuffer - add the kDumpBuffers command to protocol::Opcode. This command is numbered 0x20, to leave room for addition kWrite<MessageType> commands. [1] https://github.com/google/googletest/blob/master/googlemock/docs/v1_6/CookBook.md Specifically, "Having to mix a mock and a fake..." Bug: 32098312 Test: ./runtests.sh Change-Id: If221b47ae5615bbc114db5755ce9eb46b9934b6e
/system/connectivity/wifilogd/tests/protocol_unittest.cpp
|