Chromium Code Reviews| Index: util/win/time_test.cc |
| diff --git a/util/test/executable_path_win.cc b/util/win/time_test.cc |
| similarity index 69% |
| copy from util/test/executable_path_win.cc |
| copy to util/win/time_test.cc |
| index 024478d7552d5a0a3cdb03e5f686d193549b2ee3..a53c140fd82efb016b88419a83a5f87cdb6ef0d6 100644 |
| --- a/util/test/executable_path_win.cc |
| +++ b/util/win/time_test.cc |
| @@ -12,18 +12,23 @@ |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| -#include "util/test/executable_path.h" |
| +#include "util/win/time.h" |
| -#include <windows.h> |
| +#include "gtest/gtest.h" |
| namespace crashpad { |
| namespace test { |
| +namespace { |
| -base::FilePath ExecutablePath() { |
| - wchar_t executable_path[_MAX_PATH]; |
| - GetModuleFileName(nullptr, executable_path, sizeof(executable_path)); |
| - return base::FilePath(executable_path); |
| +TEST(Time, Reasonable) { |
| + timeval t; |
| + GetTimeOfDay(&t); |
| + // Assume that time's time_t return is seconds from 1970. |
| + time_t approx_now = time(nullptr); |
| + EXPECT_GT(approx_now + 100, t.tv_sec); |
|
Mark Mentovai
2015/02/20 18:15:33
approx_now should always be strictly >= t.tv_sec.
scottmg
2015/02/20 19:27:56
Done.
|
| + EXPECT_LT(approx_now - 100, t.tv_sec); |
| } |
| +} // namespace |
| } // namespace test |
| } // namespace crashpad |