extend file_handler to support reads

Problem: the upcomming version handler will need to read from files.
Currently file hander (image handler) does not support reads.

Solution: Add read support by providing an optional mode parameter.

Tests added:
FileHanderTest added to
- Test out open for reads
- Test out reading out bytes and verifying size and content
- Test out trying to read beyond EOF
- Test out offset reads that go beyond EOF

Tested:
Existing unit tests pass
New unit tests for reading all pass

Signed-off-by: Jason Ling <jasonling@google.com>
Change-Id: Ie416a6b4b452d8d04fa158bd55989d07a891896f
diff --git a/bmc/firmware-handler/test/firmware_write_unittest.cpp b/bmc/firmware-handler/test/firmware_write_unittest.cpp
index e9b70ba..27899db 100644
--- a/bmc/firmware-handler/test/firmware_write_unittest.cpp
+++ b/bmc/firmware-handler/test/firmware_write_unittest.cpp
@@ -29,7 +29,7 @@
 TEST_F(FirmwareHandlerWriteTestIpmiOnly, DataTypeIpmiWriteSuccess)
 {
     /* Verify if data type ipmi, it calls write with the bytes. */
-    EXPECT_CALL(*imageMock, open("asdf")).WillOnce(Return(true));
+    EXPECT_CALL(*imageMock, open("asdf", std::ios::out)).WillOnce(Return(true));
 
     EXPECT_TRUE(handler->open(
         0, blobs::OpenFlags::write | FirmwareFlags::UpdateFlags::ipmi, "asdf"));
@@ -44,7 +44,7 @@
 {
     /* Verify if data type non-ipmi, it calls write with the length. */
     EXPECT_CALL(*dataMock, open()).WillOnce(Return(true));
-    EXPECT_CALL(*imageMock, open("asdf")).WillOnce(Return(true));
+    EXPECT_CALL(*imageMock, open("asdf", std::ios::out)).WillOnce(Return(true));
 
     EXPECT_TRUE(handler->open(
         0, blobs::OpenFlags::write | FirmwareFlags::UpdateFlags::lpc, "asdf"));
@@ -67,7 +67,7 @@
     /* Verify the data type non-ipmi, if the request's structure doesn't match,
      * return failure. */
     EXPECT_CALL(*dataMock, open()).WillOnce(Return(true));
-    EXPECT_CALL(*imageMock, open("asdf")).WillOnce(Return(true));
+    EXPECT_CALL(*imageMock, open("asdf", std::ios::out)).WillOnce(Return(true));
 
     EXPECT_TRUE(handler->open(
         0, blobs::OpenFlags::write | FirmwareFlags::UpdateFlags::lpc, "asdf"));