PM: Changes in unit tests.
* Adds macros for checking null-ness of pointers in tests. This makes it
safer and less error-prone: gtest seems to be inconsistent in its
treatment of pointer values, so having our own wrappers and making
them perform uniformly is good.
* Regulates the use of ASSERT vs EXPECT in unit tests: the former must
be used if subsequent test logic depends on the condition tested (for
example, a pointer being dereferenced later is not null, or a provider
module initialized correctly). The latter will fail the test but would
allow it to keep executing (aka non-critical failure).
* General revision of existing unit test code. Minor changes in
random_provider.h.
BUG=None
TEST=Builds and passes unit tests.
Change-Id: I2ada0fbd96db4cb0c0d631c2e350873853116fc2
Reviewed-on: https://chromium-review.googlesource.com/184449
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/policy_manager/random_provider.cc b/policy_manager/random_provider.cc
index 225b896..431e77b 100644
--- a/policy_manager/random_provider.cc
+++ b/policy_manager/random_provider.cc
@@ -10,6 +10,7 @@
#include <base/stringprintf.h>
#include "policy_manager/random_provider.h"
+#include "policy_manager/variable.h"
using std::string;
@@ -54,9 +55,9 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(RandomSeedVariable);
-
file_util::ScopedFILE fp_;
+
+ DISALLOW_COPY_AND_ASSIGN(RandomSeedVariable);
};