PolicyManager: Add a new State class grouping the state providers.

The policy implementations need access to the providers to discover
the variables exposed by them. Instead of having global variables to
access each providers, we add a new State interface that groups all
the providers in the same way a provider groups all the variables.

This interface class allows to create a mock/fake class for testing
the policies.

Other minor fixes to the fakes are included in this patch.

BUG=chromium:338591
TEST=Simple unit test passes.

Change-Id: I7fe46dfc8416ee39ace3290628b7bae440213b29
Reviewed-on: https://chromium-review.googlesource.com/187705
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
18 files changed
tree: 43d716ed498b4c6ecf4b7fad4a7bacb71b3b662e
  1. policy_manager/
  2. .gitignore
  3. 99-gpio-dutflag.rules
  4. action.h
  5. action_mock.h
  6. action_pipe.h
  7. action_pipe_unittest.cc
  8. action_processor.cc
  9. action_processor.h
  10. action_processor_mock.h
  11. action_processor_unittest.cc
  12. action_unittest.cc
  13. build
  14. bzip.cc
  15. bzip.h
  16. bzip_extent_writer.cc
  17. bzip_extent_writer.h
  18. bzip_extent_writer_unittest.cc
  19. certificate_checker.cc
  20. certificate_checker.h
  21. certificate_checker_mock.h
  22. certificate_checker_unittest.cc
  23. chrome_browser_proxy_resolver.cc
  24. chrome_browser_proxy_resolver.h
  25. chrome_browser_proxy_resolver_unittest.cc
  26. clock.cc
  27. clock.h
  28. clock_interface.h
  29. connection_manager.cc
  30. connection_manager.h
  31. connection_manager_unittest.cc
  32. constants.cc
  33. constants.h
  34. cycle_breaker.cc
  35. cycle_breaker.h
  36. cycle_breaker_unittest.cc
  37. dbus_constants.h
  38. dbus_interface.h
  39. dbus_service.cc
  40. dbus_service.h
  41. delta_diff_generator.cc
  42. delta_diff_generator.h
  43. delta_diff_generator_unittest.cc
  44. delta_performer.cc
  45. delta_performer.h
  46. delta_performer_unittest.cc
  47. download_action.cc
  48. download_action.h
  49. download_action_unittest.cc
  50. error_code.h
  51. extent_mapper.cc
  52. extent_mapper.h
  53. extent_mapper_unittest.cc
  54. extent_ranges.cc
  55. extent_ranges.h
  56. extent_ranges_unittest.cc
  57. extent_writer.cc
  58. extent_writer.h
  59. extent_writer_unittest.cc
  60. fake_clock.h
  61. fake_hardware.h
  62. fake_p2p_manager.h
  63. fake_p2p_manager_configuration.h
  64. file_descriptor.cc
  65. file_descriptor.h
  66. file_writer.cc
  67. file_writer.h
  68. file_writer_mock.h
  69. file_writer_unittest.cc
  70. filesystem_copier_action.cc
  71. filesystem_copier_action.h
  72. filesystem_copier_action_unittest.cc
  73. filesystem_iterator.cc
  74. filesystem_iterator.h
  75. filesystem_iterator_unittest.cc
  76. full_update_generator.cc
  77. full_update_generator.h
  78. full_update_generator_unittest.cc
  79. gen_coverage_html
  80. generate_delta_main.cc
  81. gpio_handler.cc
  82. gpio_handler.h
  83. gpio_handler_unittest.cc
  84. gpio_handler_unittest.h
  85. gpio_mock_file_descriptor.cc
  86. gpio_mock_file_descriptor.h
  87. gpio_mock_udev_interface.cc
  88. gpio_mock_udev_interface.h
  89. graph_types.h
  90. graph_utils.cc
  91. graph_utils.h
  92. graph_utils_unittest.cc
  93. hardware.cc
  94. hardware.h
  95. hardware_interface.h
  96. http_common.cc
  97. http_common.h
  98. http_fetcher.cc
  99. http_fetcher.h
  100. http_fetcher_unittest.cc
  101. hwid_override.cc
  102. hwid_override.h
  103. hwid_override_unittest.cc
  104. inherit-review-settings-ok
  105. install_plan.cc
  106. install_plan.h
  107. libcurl_http_fetcher.cc
  108. libcurl_http_fetcher.h
  109. LICENSE
  110. local_coverage_rate
  111. main.cc
  112. metadata.cc
  113. metadata.h
  114. metadata_unittest.cc
  115. mock_connection_manager.h
  116. mock_dbus_interface.h
  117. mock_file_writer.h
  118. mock_gpio_handler.h
  119. mock_hardware.h
  120. mock_http_fetcher.cc
  121. mock_http_fetcher.h
  122. mock_p2p_manager.h
  123. mock_payload_state.h
  124. mock_system_state.cc
  125. mock_system_state.h
  126. multi_range_http_fetcher.cc
  127. multi_range_http_fetcher.h
  128. omaha_hash_calculator.cc
  129. omaha_hash_calculator.h
  130. omaha_hash_calculator_unittest.cc
  131. omaha_request_action.cc
  132. omaha_request_action.h
  133. omaha_request_action_unittest.cc
  134. omaha_request_params.cc
  135. omaha_request_params.h
  136. omaha_request_params_unittest.cc
  137. omaha_response.h
  138. omaha_response_handler_action.cc
  139. omaha_response_handler_action.h
  140. omaha_response_handler_action_unittest.cc
  141. p2p_manager.cc
  142. p2p_manager.h
  143. p2p_manager_unittest.cc
  144. payload_signer.cc
  145. payload_signer.h
  146. payload_signer_unittest.cc
  147. payload_state.cc
  148. payload_state.h
  149. payload_state_interface.h
  150. payload_state_unittest.cc
  151. postinstall_runner_action.cc
  152. postinstall_runner_action.h
  153. postinstall_runner_action_unittest.cc
  154. prefs.cc
  155. prefs.h
  156. prefs_interface.h
  157. prefs_mock.h
  158. prefs_unittest.cc
  159. proxy_resolver.cc
  160. proxy_resolver.h
  161. real_system_state.h
  162. run_unittests
  163. sample_omaha_v3_response.xml
  164. SConstruct
  165. setup_dev_packages
  166. simple_key_value_store.cc
  167. simple_key_value_store.h
  168. simple_key_value_store_unittest.cc
  169. subprocess.cc
  170. subprocess.h
  171. subprocess_unittest.cc
  172. system_state.cc
  173. system_state.h
  174. tarjan.cc
  175. tarjan.h
  176. tarjan_unittest.cc
  177. terminator.cc
  178. terminator.h
  179. terminator_unittest.cc
  180. test_http_server.cc
  181. test_utils.cc
  182. test_utils.h
  183. testrunner.cc
  184. topological_sort.cc
  185. topological_sort.h
  186. topological_sort_unittest.cc
  187. udev_interface.h
  188. unittest_key.pem
  189. unittest_key2.pem
  190. update_attempter.cc
  191. update_attempter.h
  192. update_attempter_mock.h
  193. update_attempter_unittest.cc
  194. update_check_scheduler.cc
  195. update_check_scheduler.h
  196. update_check_scheduler_unittest.cc
  197. update_engine.xml
  198. update_engine_client.cc
  199. update_metadata.proto
  200. UpdateEngine.conf
  201. utils.cc
  202. utils.h
  203. utils_unittest.cc
  204. WATCHLISTS
  205. zip_unittest.cc