summaryrefslogtreecommitdiff
path: root/update_manager/update_manager_unittest.cc
diff options
context:
space:
mode:
authorAlex Deymo <deymo@chromium.org>2014-10-30 13:02:49 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-10-31 20:55:41 +0000
commite1e3afe30a214b3661a36474c1448f520662f33c (patch)
treef57f8060128fd6e9907f6473d26987091dbd5a89 /update_manager/update_manager_unittest.cc
parentccd0957b359136aca2d4d5c7728535d8a2e33c51 (diff)
update_engine: Cleanup omaha_request_action_unittest.cc.
This patch is a cleanup of the omaha_request_action_unittest. First it moves members common to all test from the global scope to the OmahaRequestActionTest class, including the global scope FakeSystemState instance used on all tests. This fake_system_state is initialized with a default OmahaRequestParams that is used by many tests not caring about that parameter. It also sets the default prefs to a FakePrefs instance, removing the need to create a temp directory and initialize it in every test. Some tests still replace it with a MockPrefs when they need to test that some prefs are checked by the code (testing interaction), but most of them just want to provide a working Prefs class. With this change, also the test helper functions were moved to the OmahaRequestActionTest class, removing the need to pass the optional classes such as PrefsIterface, PayloadStateInterface, P2PManager and ConnectionManager which in most tests were passed as nullptr meaning that the default is used. Instead, with this change, tests that require a different P2PManager instance for example just create it and replace it on the fake_system_state_. This change removes a lot of redundant default code that was hard to maintain. Now a test requiring to manipulate other classes in the FakeSystemState class, such as mocking out the HardwareInterface, can just replace that without adding another parameter to the helper functions. BUG=chromium:428792 TEST=Unittest still pass. Change-Id: Ia3306b11af867d2a1a09be8efae66f6b0326f030 Reviewed-on: https://chromium-review.googlesource.com/226715 Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
Diffstat (limited to 'update_manager/update_manager_unittest.cc')
0 files changed, 0 insertions, 0 deletions