1 // Copyright 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. 4 5 #include "base/win/reference.h" 6 7 #include <windows.foundation.h> 8 #include <wrl/client.h> 9 10 #include "testing/gtest/include/gtest/gtest.h" 11 12 namespace base { 13 namespace win { 14 15 namespace { 16 17 using Microsoft::WRL::Make; 18 19 } // namespace 20 TEST(ReferenceTest,Value)21TEST(ReferenceTest, Value) { 22 auto ref = Make<Reference<int>>(123); 23 int value = 0; 24 HRESULT hr = ref->get_Value(&value); 25 EXPECT_TRUE(SUCCEEDED(hr)); 26 EXPECT_EQ(123, value); 27 } 28 TEST(ReferenceTest,ValueAggregate)29TEST(ReferenceTest, ValueAggregate) { 30 auto ref = Make<Reference<bool>>(true); 31 boolean value = false; 32 HRESULT hr = ref->get_Value(&value); 33 EXPECT_TRUE(SUCCEEDED(hr)); 34 EXPECT_TRUE(value); 35 } 36 37 } // namespace win 38 } // namespace base 39