Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: util/win/time_test.cc

Issue 940793002: win: add equivalent of gettimeofday (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: . Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/win/time.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ad0771e38b7889ab92154490845a0c3aafe13782 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_GE(approx_now, t.tv_sec);
+ EXPECT_LT(approx_now - 100, t.tv_sec);
}
+} // namespace
} // namespace test
} // namespace crashpad
« no previous file with comments | « util/win/time.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698