Add unit tests for public interfaces.

This refactors the code to unit test the public interfaces of the
ImageLoader class. It also fixes a bug in GetComponentVersion, caught by
the new tests.

BUG=chromium:630421
TEST=FEATURES="test" emerge-${BOARD} imageloader, and run the client

Change-Id: I62657ee9127586389677bf5a3b1a65766ec2a038
Reviewed-on: https://chromium-review.googlesource.com/363520
Commit-Ready: Greg Kerr <kerrnel@chromium.org>
Tested-by: Greg Kerr <kerrnel@chromium.org>
Reviewed-by: Ricky Zhou <rickyz@chromium.org>
15 files changed
tree: 0392e7a096b2eff5c774c30b34f4dff67358aeb3
  1. .presubmitignore
  2. README.md
  3. imageloadclient-glue.xml
  4. imageloadclient.cc
  5. imageloadclient.h
  6. imageloader-glue.xml
  7. imageloader.gyp
  8. imageloader.h
  9. imageloader_common.cc
  10. imageloader_common.h
  11. imageloader_impl.cc
  12. imageloader_impl.h
  13. imageloader_main.cc
  14. imageloader_unittest.cc
  15. org.chromium.ImageLoader.conf
  16. org.chromium.ImageLoader.service
  17. public_keys/
  18. run_tests.cc
  19. test/
README.md

src/platform/imageloader

This aims to provide a generic utility to load (mount) and unload (unmount) verified disk images through DBus IPC.

Binaries

  • imageloader
  • imageloadclient

imageloader can be run as root and can handle mounting and unmounting of disk images. imageloadclient is a simple client (intended to be run as chronos) that can talk to imageloader and ask it to mount and unmount stuff. When imageloader is not running, DBus can invoke it via the one time run option (imageloader -o) and get the task done.