Add IsCorrupt() to ProtoDatabase wrappers/clients.

Adds the ability to check for corruption via an IsCorrupt() function
that's pure virtual on the ProtoDatabase. IsCorrupt() is also introduced
in the ProtoLevelDBWrapper, and the corruption flag gets set on the Init
callback after checking status.

Unit tests changed slightly because the init callback needed to be put
into ProtoLevelDBWrapper instead of outside so it could modify
is_corrupt_, and the new use of the WeakPtr caused a race condition that
meant the test always failed to trigger the callback if we don't wait
for init to complete.

Bug: 870813
Change-Id: Ib00435dae8cdac490053fbfc6befb95094b1edec
Reviewed-on: https://chromium-review.googlesource.com/c/1355521
Commit-Queue: Troy Hildebrandt <thildebr@chromium.org>
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612434}
7 files changed