commit | 1059e59ba99809a03a245e7f55a98efba63567d6 | [log] [tgz] |
---|---|---|
author | pmarko <pmarko@chromium.org> | Fri May 19 13:23:01 2017 |
committer | Commit bot <commit-bot@chromium.org> | Fri May 19 13:23:01 2017 |
tree | 15153141cf7fcd3f287693373fcf48104d06bf94 | |
parent | 08b8ccad61fb9dd45f25aac7aab06dd8bbdb1856 [diff] |
Fail tests fast if Windows registry key override fails policy_loader_win_unittest uses RegOverridePredefKey to remap registry keys to a temporary key for the duration of the test. If this remapping fails, the test should fail fast to avoid accidentally creating persistent changes in the machine's registry. This is done by moving the remap step into the test's SetUp() method. gtest documentation says that the test will not continue if an ASSERT fails in SetUp()[1][2]. Also, we now delete the temporary registry keys if they already exist. These are keyed by the process id, so a subsequent test could reuse an existing temporary key if the previous test (with the same process id) crashed and failed to clean up. [1] https://github.com/google/googletest/blob/master/googletest/docs/Primer.md#invoking-the-tests [2] https://cs.chromium.org/chromium/src/third_party/mesa/src/src/gtest/src/gtest.cc?rcl=ef811c6bd4de74e13e7035ca882cc77f85793fef&l=2159 BUG=721691 Review-Url: https://codereview.chromium.org/2893803005 Cr-Commit-Position: refs/heads/master@{#473174}