| // Copyright 2018 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "base/scoped_clear_last_error.h" |
| #include "base/logging.h" |
| #include "build/build_config.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| #endif // BUILDFLAG(IS_WIN) |
| TEST(ScopedClearLastError, TestNoError) { |
| ScopedClearLastError clear_error; |
| TEST(ScopedClearLastError, TestError) { |
| ScopedClearLastError clear_error; |
| TEST(ScopedClearLastError, TestNoErrorWin) { |
| ScopedClearLastError clear_error; |
| EXPECT_EQ(logging::SystemErrorCode(0), ::GetLastError()); |
| EXPECT_EQ(logging::SystemErrorCode(1), ::GetLastError()); |
| TEST(ScopedClearLastError, TestErrorWin) { |
| ScopedClearLastError clear_error; |
| EXPECT_EQ(logging::SystemErrorCode(1), ::GetLastError()); |
| #endif // BUILDFLAG(IS_WIN) |