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

Side by Side Diff: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc

Issue 2615273002: Bump Bluetooth max filter name length from 29 bytes to 240 bytes (Closed)
Patch Set: Correct fake test value Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid er.h" 5 #include "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid er.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (fake_adapter_name == "ScanFilterCheckingAdapter") 175 if (fake_adapter_name == "ScanFilterCheckingAdapter")
176 return GetScanFilterCheckingAdapter(); 176 return GetScanFilterCheckingAdapter();
177 if (fake_adapter_name == "EmptyAdapter") 177 if (fake_adapter_name == "EmptyAdapter")
178 return GetEmptyAdapter(); 178 return GetEmptyAdapter();
179 if (fake_adapter_name == "FailStartDiscoveryAdapter") 179 if (fake_adapter_name == "FailStartDiscoveryAdapter")
180 return GetFailStartDiscoveryAdapter(); 180 return GetFailStartDiscoveryAdapter();
181 if (fake_adapter_name == "GlucoseHeartRateAdapter") 181 if (fake_adapter_name == "GlucoseHeartRateAdapter")
182 return GetGlucoseHeartRateAdapter(); 182 return GetGlucoseHeartRateAdapter();
183 if (fake_adapter_name == "UnicodeDeviceAdapter") 183 if (fake_adapter_name == "UnicodeDeviceAdapter")
184 return GetUnicodeDeviceAdapter(); 184 return GetUnicodeDeviceAdapter();
185 if (fake_adapter_name == "DeviceNameLongerThan29BytesAdapter")
186 return GetDeviceNameLongerThan29BytesAdapter();
185 if (fake_adapter_name == "MissingServiceHeartRateAdapter") 187 if (fake_adapter_name == "MissingServiceHeartRateAdapter")
186 return GetMissingServiceHeartRateAdapter(); 188 return GetMissingServiceHeartRateAdapter();
187 if (fake_adapter_name == "MissingCharacteristicHeartRateAdapter") 189 if (fake_adapter_name == "MissingCharacteristicHeartRateAdapter")
188 return GetMissingCharacteristicHeartRateAdapter(); 190 return GetMissingCharacteristicHeartRateAdapter();
189 if (fake_adapter_name == "HeartRateAdapter") 191 if (fake_adapter_name == "HeartRateAdapter")
190 return GetHeartRateAdapter(); 192 return GetHeartRateAdapter();
191 if (fake_adapter_name == "EmptyNameDeviceAdapter") 193 if (fake_adapter_name == "EmptyNameDeviceAdapter")
192 return GetEmptyNameDeviceAdapter(); 194 return GetEmptyNameDeviceAdapter();
193 if (fake_adapter_name == "NoNameDeviceAdapter") 195 if (fake_adapter_name == "NoNameDeviceAdapter")
194 return GetNoNameDeviceAdapter(); 196 return GetNoNameDeviceAdapter();
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 // static 396 // static
395 scoped_refptr<NiceMockBluetoothAdapter> 397 scoped_refptr<NiceMockBluetoothAdapter>
396 LayoutTestBluetoothAdapterProvider::GetUnicodeDeviceAdapter() { 398 LayoutTestBluetoothAdapterProvider::GetUnicodeDeviceAdapter() {
397 scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter()); 399 scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter());
398 400
399 adapter->AddMockDevice(GetBaseDevice(adapter.get(), "❤❤❤❤❤❤❤❤❤")); 401 adapter->AddMockDevice(GetBaseDevice(adapter.get(), "❤❤❤❤❤❤❤❤❤"));
400 402
401 return adapter; 403 return adapter;
402 } 404 }
403 405
406 // static
407 scoped_refptr<NiceMockBluetoothAdapter>
408 LayoutTestBluetoothAdapterProvider::GetDeviceNameLongerThan29BytesAdapter() {
409 scoped_refptr<NiceMockBluetoothAdapter> adapter(GetEmptyAdapter());
410
411 adapter->AddMockDevice(GetBaseDevice(adapter.get(),
412 "a_device_name_that_is_longer_than_29_bytes_but_shorter _than_240_bytes"));
413
414 return adapter;
415 }
416
404 // Adds a device to |adapter| and notifies all observers about that new device. 417 // Adds a device to |adapter| and notifies all observers about that new device.
405 // Mocks can call this asynchronously to cause changes in the middle of a test. 418 // Mocks can call this asynchronously to cause changes in the middle of a test.
406 static void AddDevice(scoped_refptr<NiceMockBluetoothAdapter> adapter, 419 static void AddDevice(scoped_refptr<NiceMockBluetoothAdapter> adapter,
407 std::unique_ptr<NiceMockBluetoothDevice> new_device) { 420 std::unique_ptr<NiceMockBluetoothDevice> new_device) {
408 NiceMockBluetoothDevice* new_device_ptr = new_device.get(); 421 NiceMockBluetoothDevice* new_device_ptr = new_device.get();
409 adapter->AddMockDevice(std::move(new_device)); 422 adapter->AddMockDevice(std::move(new_device));
410 for (auto& observer : adapter->GetObservers()) 423 for (auto& observer : adapter->GetObservers())
411 observer.DeviceAdded(adapter.get(), new_device_ptr); 424 observer.DeviceAdded(adapter.get(), new_device_ptr);
412 } 425 }
413 426
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 return BluetoothUUID(); 1705 return BluetoothUUID();
1693 } 1706 }
1694 1707
1695 // static 1708 // static
1696 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { 1709 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) {
1697 return BluetoothDevice::CanonicalizeAddress( 1710 return BluetoothDevice::CanonicalizeAddress(
1698 base::StringPrintf("%012" PRIx64, addr)); 1711 base::StringPrintf("%012" PRIx64, addr));
1699 } 1712 }
1700 1713
1701 } // namespace content 1714 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698