[recipe_modules/test_results] Refactor the logic of generating full json results files to a single method (RELAND)

The motivation is we will add logic to not generate full
json results files if the json already has full JSON
results format.

This CL is a pure refactoring CL, there is no intended
behavior change.

*Reland: this includes the fix & unittest that would catch the error.

BUG=649762

Review-Url: https://codereview.chromium.org/2469233003
2 files changed