Revised GPIO module interface + GPIO discovery logic

* The GpioHandler class is no longer a static singleton, rather an
  ordinary object with a dynamic guard against multiple instances. This
  makes testing/mocking a lot easier and simplifies implementation.

* It uses a basic, mockable udev interface; the module comes with
  complete unit testing of the discovery mechanism.

* Corresponding changes to user classes, including UpdateAttempter and
  UpdateCheckScheduler.

Note that the implementation of the test mode signaling protocol is
currently a no-op, always returning false, and hence has no effect on
the update process yet. This mechanism will be implemented in a later
CL.

BUG=chromium-os:25397
TEST=Builds and passes unit tests (including new ones)

Change-Id: I2f6254db6799ff5ef8616314890833f6e3269ff6
Reviewed-on: https://gerrit.chromium.org/gerrit/22869
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
16 files changed
tree: 6020d4f900a1b4bf797694071771e06b8dfa4822
  1. .gitignore
  2. 99-gpio-dutflag.rules
  3. action.h
  4. action_mock.h
  5. action_pipe.h
  6. action_pipe_unittest.cc
  7. action_processor.cc
  8. action_processor.h
  9. action_processor_mock.h
  10. action_processor_unittest.cc
  11. action_unittest.cc
  12. bzip.cc
  13. bzip.h
  14. bzip_extent_writer.cc
  15. bzip_extent_writer.h
  16. bzip_extent_writer_unittest.cc
  17. certificate_checker.cc
  18. certificate_checker.h
  19. certificate_checker_mock.h
  20. certificate_checker_unittest.cc
  21. chrome_browser_proxy_resolver.cc
  22. chrome_browser_proxy_resolver.h
  23. chrome_browser_proxy_resolver_unittest.cc
  24. chrome_proxy_resolver.cc
  25. chrome_proxy_resolver.h
  26. chrome_proxy_resolver_unittest.cc
  27. cycle_breaker.cc
  28. cycle_breaker.h
  29. cycle_breaker_unittest.cc
  30. dbus_constants.h
  31. dbus_interface.h
  32. dbus_service.cc
  33. dbus_service.h
  34. delta_diff_generator.cc
  35. delta_diff_generator.h
  36. delta_diff_generator_unittest.cc
  37. delta_performer.cc
  38. delta_performer.h
  39. delta_performer_unittest.cc
  40. download_action.cc
  41. download_action.h
  42. download_action_unittest.cc
  43. extent_mapper.cc
  44. extent_mapper.h
  45. extent_mapper_unittest.cc
  46. extent_ranges.cc
  47. extent_ranges.h
  48. extent_ranges_unittest.cc
  49. extent_writer.cc
  50. extent_writer.h
  51. extent_writer_unittest.cc
  52. file_descriptor.cc
  53. file_descriptor.h
  54. file_writer.cc
  55. file_writer.h
  56. file_writer_mock.h
  57. file_writer_unittest.cc
  58. filesystem_copier_action.cc
  59. filesystem_copier_action.h
  60. filesystem_copier_action_unittest.cc
  61. filesystem_iterator.cc
  62. filesystem_iterator.h
  63. filesystem_iterator_unittest.cc
  64. flimflam_proxy.cc
  65. flimflam_proxy.h
  66. flimflam_proxy_unittest.cc
  67. full_update_generator.cc
  68. full_update_generator.h
  69. full_update_generator_unittest.cc
  70. gen_coverage_html.sh
  71. generate_delta_main.cc
  72. gpio_handler.cc
  73. gpio_handler.h
  74. gpio_handler_unittest.cc
  75. gpio_handler_unittest.h
  76. gpio_mock_udev_interface.cc
  77. gpio_mock_udev_interface.h
  78. graph_types.h
  79. graph_utils.cc
  80. graph_utils.h
  81. graph_utils_unittest.cc
  82. http_common.cc
  83. http_common.h
  84. http_fetcher.cc
  85. http_fetcher.h
  86. http_fetcher_unittest.cc
  87. http_fetcher_unittest.h
  88. inherit-review-settings-ok
  89. install_plan.h
  90. integration_unittest.cc
  91. libcurl_http_fetcher.cc
  92. libcurl_http_fetcher.h
  93. LICENSE
  94. local_coverage_rate.sh
  95. main.cc
  96. marshal.list
  97. metadata.cc
  98. metadata.h
  99. metadata_unittest.cc
  100. mock_dbus_interface.h
  101. mock_file_writer.h
  102. mock_http_fetcher.cc
  103. mock_http_fetcher.h
  104. multi_range_http_fetcher.cc
  105. multi_range_http_fetcher.h
  106. omaha_hash_calculator.cc
  107. omaha_hash_calculator.h
  108. omaha_hash_calculator_unittest.cc
  109. omaha_request_action.cc
  110. omaha_request_action.h
  111. omaha_request_action_unittest.cc
  112. omaha_request_params.cc
  113. omaha_request_params.h
  114. omaha_request_params_unittest.cc
  115. omaha_response_handler_action.cc
  116. omaha_response_handler_action.h
  117. omaha_response_handler_action_unittest.cc
  118. org.chromium.UpdateEngine.service
  119. payload_signer.cc
  120. payload_signer.h
  121. payload_signer_unittest.cc
  122. postinstall_runner_action.cc
  123. postinstall_runner_action.h
  124. postinstall_runner_action_unittest.cc
  125. prefs.cc
  126. prefs.h
  127. prefs_interface.h
  128. prefs_mock.h
  129. prefs_unittest.cc
  130. proxy_resolver.cc
  131. proxy_resolver.h
  132. SConstruct
  133. setup_dev_packages
  134. simple_key_value_store.cc
  135. simple_key_value_store.h
  136. simple_key_value_store_unittest.cc
  137. subprocess.cc
  138. subprocess.h
  139. subprocess_unittest.cc
  140. tarjan.cc
  141. tarjan.h
  142. tarjan_unittest.cc
  143. terminator.cc
  144. terminator.h
  145. terminator_unittest.cc
  146. test_http_server.cc
  147. test_utils.cc
  148. test_utils.h
  149. testrunner.cc
  150. topological_sort.cc
  151. topological_sort.h
  152. topological_sort_unittest.cc
  153. udev_interface.h
  154. unittest_key.pem
  155. unittest_key2.pem
  156. update_attempter.cc
  157. update_attempter.h
  158. update_attempter_mock.h
  159. update_attempter_unittest.cc
  160. update_check_scheduler.cc
  161. update_check_scheduler.h
  162. update_check_scheduler_unittest.cc
  163. update_engine.xml
  164. update_engine_client.cc
  165. update_metadata.proto
  166. UpdateEngine.conf
  167. utils.cc
  168. utils.h
  169. utils_unittest.cc
  170. WATCHLISTS
  171. zip_unittest.cc