1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/scoped_clear_last_error.h"
7 #include "base/logging.h"
8 #include "build/build_config.h"
9 #include "testing/gtest/include/gtest/gtest.h"
13 #endif // BUILDFLAG(IS_WIN)
17 TEST(ScopedClearLastError, TestNoError) {
20 ScopedClearLastError clear_error;
26 TEST(ScopedClearLastError, TestError) {
29 ScopedClearLastError clear_error;
37 TEST(ScopedClearLastError, TestNoErrorWin) {
40 ScopedClearLastError clear_error;
41 EXPECT_EQ(logging::SystemErrorCode(0), ::GetLastError());
43 EXPECT_EQ(logging::SystemErrorCode(1), ::GetLastError());
46 TEST(ScopedClearLastError, TestErrorWin) {
49 ScopedClearLastError clear_error;
52 EXPECT_EQ(logging::SystemErrorCode(1), ::GetLastError());
55 #endif // BUILDFLAG(IS_WIN)