shill: Add NiceScopedMockLog

Add a variant to ScopedMockLog that automatically expects any Log
message.  This allows us to expect only unique messages that are
specific to the test at hand.

BUG=None
TEST=Unit test that contains an explicit call to log.Log()

Change-Id: I19567b8cfa331daf48367ff8cfc1c266d0618159
Reviewed-on: https://gerrit.chromium.org/gerrit/48154
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/mock_log.h b/mock_log.h
index 2f90c5e..beb516b 100644
--- a/mock_log.h
+++ b/mock_log.h
@@ -60,7 +60,7 @@
 class ScopedMockLog {
  public:
   ScopedMockLog();
-  ~ScopedMockLog();
+  virtual ~ScopedMockLog();
 
   // Users set expecations on this method.  |severity| is defined in
   // base/logging.h, like logging:::LOG_INFO.  |file| is the filename which
@@ -90,6 +90,15 @@
   ::logging::LogMessageHandlerFunction previous_handler_;
 };
 
+// A NiceScopedMockLog is the same as ScopedMockLog, except it creates an
+// implicit expectation on any Log() call.  This allows tests to avoid having
+// to explictly expect log messages they don't care about.
+class NiceScopedMockLog : public ScopedMockLog {
+ public:
+  NiceScopedMockLog();
+  virtual ~NiceScopedMockLog();
+};
+
 }  // namespace shill
 
 #endif  // SHILL_MOCK_LOG_H_