1 // Copyright (c) 2018 The Chromium Authors. All rights reserved.
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 #include "base/logging.h"
14 #endif // defined(OS_WIN)
18 TEST(ScopedClearLastError, TestNoError) {
21 ScopedClearLastError clear_error;
27 TEST(ScopedClearLastError, TestError) {
30 ScopedClearLastError clear_error;
38 TEST(ScopedClearLastError, TestNoErrorWin) {
41 ScopedClearLastError clear_error;
42 EXPECT_EQ(logging::SystemErrorCode(0), ::GetLastError());
44 EXPECT_EQ(logging::SystemErrorCode(1), ::GetLastError());
47 TEST(ScopedClearLastError, TestErrorWin) {
50 ScopedClearLastError clear_error;
53 EXPECT_EQ(logging::SystemErrorCode(1), ::GetLastError());
56 #endif // defined(OS_WIN)