OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 void CreateHandle(int value, HANDLE* result) { | 8 void CreateHandle(int value, HANDLE* result) { |
9 *result = reinterpret_cast<HANDLE>(value); | 9 *result = reinterpret_cast<HANDLE>(value); |
10 } | 10 } |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 EXPECT_EQ(handle.Get(), reinterpret_cast<HANDLE>(value)); | 23 EXPECT_EQ(handle.Get(), reinterpret_cast<HANDLE>(value)); |
24 HANDLE to_discard = handle.Take(); | 24 HANDLE to_discard = handle.Take(); |
25 | 25 |
26 // The standard use case: | 26 // The standard use case: |
27 value = 183; | 27 value = 183; |
28 CreateHandle(value, handle.Receive()); | 28 CreateHandle(value, handle.Receive()); |
29 EXPECT_EQ(handle.Get(), reinterpret_cast<HANDLE>(value)); | 29 EXPECT_EQ(handle.Get(), reinterpret_cast<HANDLE>(value)); |
30 to_discard = handle.Take(); | 30 to_discard = handle.Take(); |
31 } | 31 } |
OLD | NEW |