tools: add progress implementation
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I9da1674d6cbc688efc7bab0e033788d6ee4694f7
diff --git a/tools/test/tools_bt_unittest.cpp b/tools/test/tools_bt_unittest.cpp
index 1a364d3..cca0b34 100644
--- a/tools/test/tools_bt_unittest.cpp
+++ b/tools/test/tools_bt_unittest.cpp
@@ -1,5 +1,6 @@
#include "bt.hpp"
#include "internal_sys_mock.hpp"
+#include "progress_mock.hpp"
#include <cstring>
#include <ipmiblob/test/blob_interface_mock.hpp>
@@ -8,6 +9,8 @@
namespace host_tool
{
+namespace
+{
using ::testing::_;
using ::testing::ContainerEq;
@@ -23,14 +26,17 @@
*/
internal::InternalSysMock sysMock;
ipmiblob::BlobInterfaceMock blobMock;
+ ProgressMock progMock;
- BtDataHandler handler(&blobMock, &sysMock);
+ BtDataHandler handler(&blobMock, &progMock, &sysMock);
std::string filePath = "/asdf";
int fd = 1;
std::uint16_t session = 0xbeef;
std::vector<std::uint8_t> bytes = {'1', '2', '3', '4'};
+ const int fakeFileSize = 100;
EXPECT_CALL(sysMock, open(Eq(filePath), _)).WillOnce(Return(fd));
+ EXPECT_CALL(sysMock, getSize(Eq(filePath))).WillOnce(Return(fakeFileSize));
EXPECT_CALL(sysMock, read(fd, NotNull(), _))
.WillOnce(Invoke([&](int fd, void* buf, std::size_t count) {
EXPECT_TRUE(count > bytes.size());
@@ -45,4 +51,5 @@
EXPECT_TRUE(handler.sendContents(filePath, session));
}
+} // namespace
} // namespace host_tool