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

Side by Side Diff: base/win/scoped_handle_unittest.cc

Issue 1466413002: Update gtest to 786564fa4a3c, switch to googlemock in gtest Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « base/win/scoped_comptr_unittest.cc ('k') | base/win/scoped_variant_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/win/scoped_handle.h" 5 #include "base/win/scoped_handle.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/googletest/include/gtest/gtest.h"
8 8
9 TEST(ScopedHandleTest, ScopedHandle) { 9 TEST(ScopedHandleTest, ScopedHandle) {
10 // Any illegal error code will do. We just need to test that it is preserved 10 // Any illegal error code will do. We just need to test that it is preserved
11 // by ScopedHandle to avoid bug 528394. 11 // by ScopedHandle to avoid bug 528394.
12 const DWORD magic_error = 0x12345678; 12 const DWORD magic_error = 0x12345678;
13 13
14 HANDLE handle = ::CreateMutex(nullptr, FALSE, nullptr); 14 HANDLE handle = ::CreateMutex(nullptr, FALSE, nullptr);
15 // Call SetLastError after creating the handle. 15 // Call SetLastError after creating the handle.
16 ::SetLastError(magic_error); 16 ::SetLastError(magic_error);
17 base::win::ScopedHandle handle_holder(handle); 17 base::win::ScopedHandle handle_holder(handle);
18 EXPECT_EQ(magic_error, ::GetLastError()); 18 EXPECT_EQ(magic_error, ::GetLastError());
19 19
20 // Create a new handle and then set LastError again. 20 // Create a new handle and then set LastError again.
21 handle = ::CreateMutex(nullptr, FALSE, nullptr); 21 handle = ::CreateMutex(nullptr, FALSE, nullptr);
22 ::SetLastError(magic_error); 22 ::SetLastError(magic_error);
23 handle_holder.Set(handle); 23 handle_holder.Set(handle);
24 EXPECT_EQ(magic_error, ::GetLastError()); 24 EXPECT_EQ(magic_error, ::GetLastError());
25 25
26 // Create a new handle and then set LastError again. 26 // Create a new handle and then set LastError again.
27 handle = ::CreateMutex(nullptr, FALSE, nullptr); 27 handle = ::CreateMutex(nullptr, FALSE, nullptr);
28 base::win::ScopedHandle handle_source(handle); 28 base::win::ScopedHandle handle_source(handle);
29 ::SetLastError(magic_error); 29 ::SetLastError(magic_error);
30 handle_holder = handle_source.Pass(); 30 handle_holder = handle_source.Pass();
31 EXPECT_EQ(magic_error, ::GetLastError()); 31 EXPECT_EQ(magic_error, ::GetLastError());
32 } 32 }
OLDNEW
« no previous file with comments | « base/win/scoped_comptr_unittest.cc ('k') | base/win/scoped_variant_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698