Use google::GLOG_WARNING instead of WARNING in tests to support MSVC. - GLOG_NO_ABBREVIATED_SEVERITIES is the default on Windows, in which case google::WARNING is not defined. - Remove Ceres-specific redefinition of WARNING in mock-log.h fork in place of using non-abbreviated severity in the one place in levenberg_marquardt_strategy_test where ScopedMockLog is actually used. - Remove unnecessary dependency of gradient_checking_cost_function_test on ScopedMockLog. Change-Id: I9fb540f638037b6015fd264cfc618c9d60f5686c
diff --git a/internal/ceres/gmock/mock-log.h b/internal/ceres/gmock/mock-log.h index bce54ab..54669b7 100644 --- a/internal/ceres/gmock/mock-log.h +++ b/internal/ceres/gmock/mock-log.h
@@ -44,13 +44,6 @@ #include "glog/logging.h" -// Needed to make the scoped mock log tests work without modification. -namespace ceres { -namespace internal { -using google::WARNING; -} // namespace internal -} // namespace ceres - namespace testing { // A ScopedMockLog object intercepts LOG() messages issued during its
diff --git a/internal/ceres/gradient_checking_cost_function_test.cc b/internal/ceres/gradient_checking_cost_function_test.cc index e7238c6..887922e 100644 --- a/internal/ceres/gradient_checking_cost_function_test.cc +++ b/internal/ceres/gradient_checking_cost_function_test.cc
@@ -45,7 +45,6 @@ #include "ceres/types.h" #include "glog/logging.h" #include "gmock/gmock.h" -#include "gmock/mock-log.h" #include "gtest/gtest.h" namespace ceres { @@ -55,7 +54,6 @@ using testing::AllOf; using testing::AnyNumber; using testing::HasSubstr; -using testing::ScopedMockLog; using testing::_; // Pick a (non-quadratic) function whose derivative are easy:
diff --git a/internal/ceres/levenberg_marquardt_strategy_test.cc b/internal/ceres/levenberg_marquardt_strategy_test.cc index 9a7bcb4..950ca23 100644 --- a/internal/ceres/levenberg_marquardt_strategy_test.cc +++ b/internal/ceres/levenberg_marquardt_strategy_test.cc
@@ -145,7 +145,9 @@ { ScopedMockLog log; EXPECT_CALL(log, Log(_, _, _)).Times(AnyNumber()); - EXPECT_CALL(log, Log(WARNING, _, + // Use GLOG_WARNING to support MSVC if GLOG_NO_ABBREVIATED_SEVERITIES + // is defined. + EXPECT_CALL(log, Log(google::GLOG_WARNING, _, HasSubstr("Failed to compute a step"))); TrustRegionStrategy::Summary summary =