| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/arc/bluetooth/bluetooth_struct_traits.h" | 5 #include "components/arc/bluetooth/bluetooth_struct_traits.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "device/bluetooth/bluetooth_uuid.h" | 8 #include "device/bluetooth/bluetooth_uuid.h" |
| 9 #include "mojo/public/cpp/bindings/array.h" | 9 #include "mojo/public/cpp/bindings/array.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 device::BluetoothUUID uuid_device; | 60 device::BluetoothUUID uuid_device; |
| 61 EXPECT_TRUE(ConvertFromMojo(std::move(uuid_mojo), &uuid_device)); | 61 EXPECT_TRUE(ConvertFromMojo(std::move(uuid_mojo), &uuid_device)); |
| 62 EXPECT_EQ(std::string(kUuidStr), uuid_device.canonical_value()); | 62 EXPECT_EQ(std::string(kUuidStr), uuid_device.canonical_value()); |
| 63 | 63 |
| 64 // Size checks are performed in serialization code. UUIDs with a length | 64 // Size checks are performed in serialization code. UUIDs with a length |
| 65 // other than 16 bytes will not make it through the mojo deserialization | 65 // other than 16 bytes will not make it through the mojo deserialization |
| 66 // code since arc::mojom::BluetoothUUID::uuid is defined as | 66 // code since arc::mojom::BluetoothUUID::uuid is defined as |
| 67 // array<uint8, 16>. | 67 // array<uint8, 16>. |
| 68 } | 68 } |
| 69 | 69 |
| 70 // Disabled due to memory leak, see http://crbug.com/653480. | 70 TEST(BluetoothStructTraitsTest, DeserializeBluetoothAdvertisement) { |
| 71 TEST(BluetoothStructTraitsTest, DISABLED_DeserializeBluetoothAdvertisement) { | |
| 72 arc::mojom::BluetoothAdvertisementPtr advertisement_mojo = | 71 arc::mojom::BluetoothAdvertisementPtr advertisement_mojo = |
| 73 arc::mojom::BluetoothAdvertisement::New(); | 72 arc::mojom::BluetoothAdvertisement::New(); |
| 74 mojo::Array<arc::mojom::BluetoothAdvertisingDataPtr> adv_data; | 73 mojo::Array<arc::mojom::BluetoothAdvertisingDataPtr> adv_data; |
| 75 | 74 |
| 76 // Create service UUIDs. | 75 // Create service UUIDs. |
| 77 arc::mojom::BluetoothAdvertisingDataPtr data = | 76 arc::mojom::BluetoothAdvertisingDataPtr data = |
| 78 arc::mojom::BluetoothAdvertisingData::New(); | 77 arc::mojom::BluetoothAdvertisingData::New(); |
| 79 std::vector<device::BluetoothUUID> service_uuids; | 78 std::vector<device::BluetoothUUID> service_uuids; |
| 80 service_uuids.push_back((device::BluetoothUUID(kUuidStr))); | 79 service_uuids.push_back((device::BluetoothUUID(kUuidStr))); |
| 81 data->set_service_uuids(service_uuids); | 80 data->set_service_uuids(service_uuids); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 144 |
| 146 advertisement_mojo->type = | 145 advertisement_mojo->type = |
| 147 arc::mojom::BluetoothAdvertisementType::ADV_TYPE_CONNECTABLE; | 146 arc::mojom::BluetoothAdvertisementType::ADV_TYPE_CONNECTABLE; |
| 148 advertisement_mojo->data = std::move(adv_data); | 147 advertisement_mojo->data = std::move(adv_data); |
| 149 | 148 |
| 150 std::unique_ptr<device::BluetoothAdvertisement::Data> advertisement; | 149 std::unique_ptr<device::BluetoothAdvertisement::Data> advertisement; |
| 151 EXPECT_FALSE(ConvertFromMojo(std::move(advertisement_mojo), &advertisement)); | 150 EXPECT_FALSE(ConvertFromMojo(std::move(advertisement_mojo), &advertisement)); |
| 152 } | 151 } |
| 153 | 152 |
| 154 } // namespace mojo | 153 } // namespace mojo |
| OLD | NEW |