| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/strings/sys_string_conversions.h" | 5 #include "base/strings/sys_string_conversions.h" |
| 6 #include "device/bluetooth/bluetooth_low_energy_win.h" | 6 #include "device/bluetooth/bluetooth_low_energy_win.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 DWORD test_value = 5u; | 64 DWORD test_value = 5u; |
| 65 size_t buffer_size = sizeof(DWORD); | 65 size_t buffer_size = sizeof(DWORD); |
| 66 scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]); | 66 scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]); |
| 67 memcpy(buffer.get(), &test_value, buffer_size); | 67 memcpy(buffer.get(), &test_value, buffer_size); |
| 68 scoped_ptr<device::win::DeviceRegistryPropertyValue> value = | 68 scoped_ptr<device::win::DeviceRegistryPropertyValue> value = |
| 69 device::win::DeviceRegistryPropertyValue::Create( | 69 device::win::DeviceRegistryPropertyValue::Create( |
| 70 REG_DWORD, buffer.Pass(), buffer_size).Pass(); | 70 REG_DWORD, buffer.Pass(), buffer_size).Pass(); |
| 71 EXPECT_EQ(test_value, value->AsDWORD()); | 71 EXPECT_EQ(test_value, value->AsDWORD()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 TEST_F(BluetoothLowEnergyWinTest, DevicePropertyValueAsUint32) { |
| 75 uint32_t test_value = 5u; |
| 76 size_t buffer_size = sizeof(uint32_t); |
| 77 scoped_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]); |
| 78 memcpy(buffer.get(), &test_value, buffer_size); |
| 79 scoped_ptr<device::win::DevicePropertyValue> value( |
| 80 new device::win::DevicePropertyValue( |
| 81 DEVPROP_TYPE_UINT32, buffer.Pass(), buffer_size)); |
| 82 EXPECT_EQ(test_value, value->AsUint32()); |
| 83 } |
| 84 |
| 74 } // namespace device | 85 } // namespace device |
| OLD | NEW |