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

Side by Side Diff: device/bluetooth/bluetooth_low_energy_win_unittest.cc

Issue 379943003: Retrieve "connected" property from BLE devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_unittests
Patch Set: Created 6 years, 5 months 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
OLDNEW
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
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
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_win.cc ('k') | device/bluetooth/bluetooth_task_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698