Move image_write_read_test helper function to .cc file. am: f1ddc20f37
am: 7a032b2d51

Change-Id: I56ed215768f53ab5efc2225cc3d080cfa81741c8