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

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

Issue 1544323002: Convert Pass()→std::move() in //device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <utility>
7 8
8 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
9 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 11 #include "base/run_loop.h"
11 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
12 #include "dbus/object_path.h" 13 #include "dbus/object_path.h"
13 #include "device/bluetooth/bluetooth_adapter.h" 14 #include "device/bluetooth/bluetooth_adapter.h"
14 #include "device/bluetooth/bluetooth_adapter_bluez.h" 15 #include "device/bluetooth/bluetooth_adapter_bluez.h"
15 #include "device/bluetooth/bluetooth_adapter_factory.h" 16 #include "device/bluetooth/bluetooth_adapter_factory.h"
16 #include "device/bluetooth/bluetooth_device.h" 17 #include "device/bluetooth/bluetooth_device.h"
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 BluetoothDiscoveryFilter* df = new BluetoothDiscoveryFilter( 1402 BluetoothDiscoveryFilter* df = new BluetoothDiscoveryFilter(
1402 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE); 1403 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE);
1403 df->SetRSSI(-60); 1404 df->SetRSSI(-60);
1404 df->AddUUID(BluetoothUUID("1000")); 1405 df->AddUUID(BluetoothUUID("1000"));
1405 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter(df); 1406 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter(df);
1406 1407
1407 adapter_->SetPowered( 1408 adapter_->SetPowered(
1408 true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)), 1409 true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
1409 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1410 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1410 adapter_->StartDiscoverySessionWithFilter( 1411 adapter_->StartDiscoverySessionWithFilter(
1411 discovery_filter.Pass(), 1412 std::move(discovery_filter),
1412 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, 1413 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
1413 base::Unretained(this)), 1414 base::Unretained(this)),
1414 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1415 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1415 message_loop_.Run(); 1416 message_loop_.Run();
1416 EXPECT_EQ(2, callback_count_); 1417 EXPECT_EQ(2, callback_count_);
1417 EXPECT_EQ(0, error_callback_count_); 1418 EXPECT_EQ(0, error_callback_count_);
1418 callback_count_ = 0; 1419 callback_count_ = 0;
1419 1420
1420 ASSERT_TRUE(adapter_->IsPowered()); 1421 ASSERT_TRUE(adapter_->IsPowered());
1421 ASSERT_TRUE(adapter_->IsDiscovering()); 1422 ASSERT_TRUE(adapter_->IsDiscovering());
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 1467
1467 adapter_->SetPowered( 1468 adapter_->SetPowered(
1468 true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)), 1469 true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
1469 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1470 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1470 EXPECT_EQ(1, callback_count_); 1471 EXPECT_EQ(1, callback_count_);
1471 callback_count_ = 0; 1472 callback_count_ = 0;
1472 1473
1473 fake_bluetooth_adapter_client_->MakeSetDiscoveryFilterFail(); 1474 fake_bluetooth_adapter_client_->MakeSetDiscoveryFilterFail();
1474 1475
1475 adapter_->StartDiscoverySessionWithFilter( 1476 adapter_->StartDiscoverySessionWithFilter(
1476 discovery_filter.Pass(), 1477 std::move(discovery_filter),
1477 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, 1478 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
1478 base::Unretained(this)), 1479 base::Unretained(this)),
1479 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1480 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1480 1481
1481 message_loop_.Run(); 1482 message_loop_.Run();
1482 1483
1483 EXPECT_EQ(1, error_callback_count_); 1484 EXPECT_EQ(1, error_callback_count_);
1484 error_callback_count_ = 0; 1485 error_callback_count_ = 0;
1485 1486
1486 ASSERT_TRUE(adapter_->IsPowered()); 1487 ASSERT_TRUE(adapter_->IsPowered());
(...skipping 29 matching lines...) Expand all
1516 adapter_->SetPowered( 1517 adapter_->SetPowered(
1517 true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)), 1518 true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
1518 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1519 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1519 1520
1520 EXPECT_EQ(1, callback_count_); 1521 EXPECT_EQ(1, callback_count_);
1521 EXPECT_EQ(0, error_callback_count_); 1522 EXPECT_EQ(0, error_callback_count_);
1522 callback_count_ = 0; 1523 callback_count_ = 0;
1523 1524
1524 // Queue two requests to start discovery session with filter. 1525 // Queue two requests to start discovery session with filter.
1525 adapter_->StartDiscoverySessionWithFilter( 1526 adapter_->StartDiscoverySessionWithFilter(
1526 discovery_filter.Pass(), 1527 std::move(discovery_filter),
1527 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, 1528 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
1528 base::Unretained(this)), 1529 base::Unretained(this)),
1529 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1530 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1530 1531
1531 adapter_->StartDiscoverySessionWithFilter( 1532 adapter_->StartDiscoverySessionWithFilter(
1532 discovery_filter2.Pass(), 1533 std::move(discovery_filter2),
1533 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, 1534 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
1534 base::Unretained(this)), 1535 base::Unretained(this)),
1535 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1536 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1536 1537
1537 // Run requests, on DBus level there should be call SetDiscoveryFilter, then 1538 // Run requests, on DBus level there should be call SetDiscoveryFilter, then
1538 // StartDiscovery, then SetDiscoveryFilter again. 1539 // StartDiscovery, then SetDiscoveryFilter again.
1539 message_loop_.Run(); 1540 message_loop_.Run();
1540 message_loop_.Run(); 1541 message_loop_.Run();
1541 1542
1542 EXPECT_EQ(2, callback_count_); 1543 EXPECT_EQ(2, callback_count_);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1614 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1614 1615
1615 EXPECT_EQ(1, callback_count_); 1616 EXPECT_EQ(1, callback_count_);
1616 EXPECT_EQ(0, error_callback_count_); 1617 EXPECT_EQ(0, error_callback_count_);
1617 callback_count_ = 0; 1618 callback_count_ = 0;
1618 1619
1619 fake_bluetooth_adapter_client_->MakeSetDiscoveryFilterFail(); 1620 fake_bluetooth_adapter_client_->MakeSetDiscoveryFilterFail();
1620 1621
1621 // Queue two requests to start discovery session with filter. 1622 // Queue two requests to start discovery session with filter.
1622 adapter_->StartDiscoverySessionWithFilter( 1623 adapter_->StartDiscoverySessionWithFilter(
1623 discovery_filter.Pass(), 1624 std::move(discovery_filter),
1624 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, 1625 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
1625 base::Unretained(this)), 1626 base::Unretained(this)),
1626 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1627 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1627 1628
1628 adapter_->StartDiscoverySessionWithFilter( 1629 adapter_->StartDiscoverySessionWithFilter(
1629 discovery_filter2.Pass(), 1630 std::move(discovery_filter2),
1630 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, 1631 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
1631 base::Unretained(this)), 1632 base::Unretained(this)),
1632 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1633 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1633 1634
1634 message_loop_.Run(); 1635 message_loop_.Run();
1635 1636
1636 // First request to SetDiscoveryFilter should fail, resulting in no session 1637 // First request to SetDiscoveryFilter should fail, resulting in no session
1637 // being created. 1638 // being created.
1638 EXPECT_EQ(0, callback_count_); 1639 EXPECT_EQ(0, callback_count_);
1639 EXPECT_EQ(1, error_callback_count_); 1640 EXPECT_EQ(1, error_callback_count_);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 auto filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter(); 1716 auto filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter();
1716 EXPECT_EQ(nullptr, filter); 1717 EXPECT_EQ(nullptr, filter);
1717 1718
1718 BluetoothDiscoveryFilter* df = new BluetoothDiscoveryFilter( 1719 BluetoothDiscoveryFilter* df = new BluetoothDiscoveryFilter(
1719 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE); 1720 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE);
1720 df->SetRSSI(-60); 1721 df->SetRSSI(-60);
1721 df->AddUUID(BluetoothUUID("1000")); 1722 df->AddUUID(BluetoothUUID("1000"));
1722 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter(df); 1723 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter(df);
1723 1724
1724 discovery_sessions_[0]->SetDiscoveryFilter( 1725 discovery_sessions_[0]->SetDiscoveryFilter(
1725 discovery_filter.Pass(), 1726 std::move(discovery_filter),
1726 base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)), 1727 base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
1727 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1728 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1728 1729
1729 message_loop_.Run(); 1730 message_loop_.Run();
1730 EXPECT_EQ(1, callback_count_); 1731 EXPECT_EQ(1, callback_count_);
1731 EXPECT_EQ(0, error_callback_count_); 1732 EXPECT_EQ(0, error_callback_count_);
1732 callback_count_ = 0; 1733 callback_count_ = 0;
1733 1734
1734 ASSERT_TRUE(df->Equals(*discovery_sessions_[0]->GetDiscoveryFilter())); 1735 ASSERT_TRUE(df->Equals(*discovery_sessions_[0]->GetDiscoveryFilter()));
1735 1736
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 } else if (i == 2) { 1795 } else if (i == 2) {
1795 BluetoothDiscoveryFilter* df = new BluetoothDiscoveryFilter( 1796 BluetoothDiscoveryFilter* df = new BluetoothDiscoveryFilter(
1796 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE); 1797 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE);
1797 df->SetRSSI(-65); 1798 df->SetRSSI(-65);
1798 df->AddUUID(BluetoothUUID("1020")); 1799 df->AddUUID(BluetoothUUID("1020"));
1799 df->AddUUID(BluetoothUUID("1003")); 1800 df->AddUUID(BluetoothUUID("1003"));
1800 discovery_filter.reset(df); 1801 discovery_filter.reset(df);
1801 } 1802 }
1802 1803
1803 adapter_->StartDiscoverySessionWithFilter( 1804 adapter_->StartDiscoverySessionWithFilter(
1804 discovery_filter.Pass(), 1805 std::move(discovery_filter),
1805 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, 1806 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
1806 base::Unretained(this)), 1807 base::Unretained(this)),
1807 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1808 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1808 1809
1809 message_loop_.Run(); 1810 message_loop_.Run();
1810 1811
1811 if (i == 0) { 1812 if (i == 0) {
1812 EXPECT_EQ(1, observer.discovering_changed_count()); 1813 EXPECT_EQ(1, observer.discovering_changed_count());
1813 observer.Reset(); 1814 observer.Reset();
1814 1815
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 } else if (i == 2) { 1919 } else if (i == 2) {
1919 BluetoothDiscoveryFilter* df = new BluetoothDiscoveryFilter( 1920 BluetoothDiscoveryFilter* df = new BluetoothDiscoveryFilter(
1920 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE); 1921 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE);
1921 df->SetRSSI(-65); 1922 df->SetRSSI(-65);
1922 df->AddUUID(BluetoothUUID("1020")); 1923 df->AddUUID(BluetoothUUID("1020"));
1923 df->AddUUID(BluetoothUUID("1003")); 1924 df->AddUUID(BluetoothUUID("1003"));
1924 discovery_filter.reset(df); 1925 discovery_filter.reset(df);
1925 } 1926 }
1926 1927
1927 adapter_->StartDiscoverySessionWithFilter( 1928 adapter_->StartDiscoverySessionWithFilter(
1928 discovery_filter.Pass(), 1929 std::move(discovery_filter),
1929 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, 1930 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
1930 base::Unretained(this)), 1931 base::Unretained(this)),
1931 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 1932 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
1932 1933
1933 // each result in 1 requests. 1934 // each result in 1 requests.
1934 message_loop_.Run(); 1935 message_loop_.Run();
1935 1936
1936 if (i == 0) { 1937 if (i == 0) {
1937 auto filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter(); 1938 auto filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter();
1938 EXPECT_EQ("le", *filter->transport); 1939 EXPECT_EQ("le", *filter->transport);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
2000 true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)), 2001 true, base::Bind(&BluetoothBlueZTest::Callback, base::Unretained(this)),
2001 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 2002 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
2002 2003
2003 BluetoothDiscoveryFilter* df = new BluetoothDiscoveryFilter( 2004 BluetoothDiscoveryFilter* df = new BluetoothDiscoveryFilter(
2004 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE); 2005 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE);
2005 df->SetRSSI(-15); 2006 df->SetRSSI(-15);
2006 df->AddUUID(BluetoothUUID("1000")); 2007 df->AddUUID(BluetoothUUID("1000"));
2007 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter(df); 2008 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter(df);
2008 2009
2009 adapter_->StartDiscoverySessionWithFilter( 2010 adapter_->StartDiscoverySessionWithFilter(
2010 discovery_filter.Pass(), 2011 std::move(discovery_filter),
2011 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, 2012 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
2012 base::Unretained(this)), 2013 base::Unretained(this)),
2013 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 2014 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
2014 2015
2015 message_loop_.Run(); 2016 message_loop_.Run();
2016 2017
2017 auto filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter(); 2018 auto filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter();
2018 EXPECT_EQ("le", *filter->transport); 2019 EXPECT_EQ("le", *filter->transport);
2019 EXPECT_EQ(-15, *filter->rssi); 2020 EXPECT_EQ(-15, *filter->rssi);
2020 EXPECT_EQ(nullptr, filter->pathloss.get()); 2021 EXPECT_EQ(nullptr, filter->pathloss.get());
2021 std::vector<std::string> uuids = *filter->uuids; 2022 std::vector<std::string> uuids = *filter->uuids;
2022 EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1000")); 2023 EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1000"));
2023 2024
2024 df = new BluetoothDiscoveryFilter( 2025 df = new BluetoothDiscoveryFilter(
2025 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE); 2026 BluetoothDiscoveryFilter::Transport::TRANSPORT_LE);
2026 df->SetRSSI(-60); 2027 df->SetRSSI(-60);
2027 df->AddUUID(BluetoothUUID("1020")); 2028 df->AddUUID(BluetoothUUID("1020"));
2028 df->AddUUID(BluetoothUUID("1001")); 2029 df->AddUUID(BluetoothUUID("1001"));
2029 discovery_filter = scoped_ptr<BluetoothDiscoveryFilter>(df); 2030 discovery_filter = scoped_ptr<BluetoothDiscoveryFilter>(df);
2030 2031
2031 adapter_->StartDiscoverySessionWithFilter( 2032 adapter_->StartDiscoverySessionWithFilter(
2032 discovery_filter.Pass(), 2033 std::move(discovery_filter),
2033 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, 2034 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
2034 base::Unretained(this)), 2035 base::Unretained(this)),
2035 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 2036 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
2036 2037
2037 message_loop_.Run(); 2038 message_loop_.Run();
2038 2039
2039 filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter(); 2040 filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter();
2040 EXPECT_EQ("le", *filter->transport); 2041 EXPECT_EQ("le", *filter->transport);
2041 EXPECT_EQ(-60, *filter->rssi); 2042 EXPECT_EQ(-60, *filter->rssi);
2042 EXPECT_EQ(nullptr, filter->pathloss.get()); 2043 EXPECT_EQ(nullptr, filter->pathloss.get());
2043 uuids = *filter->uuids; 2044 uuids = *filter->uuids;
2044 EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1000")); 2045 EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1000"));
2045 EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1001")); 2046 EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1001"));
2046 EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1020")); 2047 EXPECT_NE(uuids.end(), std::find(uuids.begin(), uuids.end(), "1020"));
2047 2048
2048 BluetoothDiscoveryFilter* df3 = new BluetoothDiscoveryFilter( 2049 BluetoothDiscoveryFilter* df3 = new BluetoothDiscoveryFilter(
2049 BluetoothDiscoveryFilter::Transport::TRANSPORT_CLASSIC); 2050 BluetoothDiscoveryFilter::Transport::TRANSPORT_CLASSIC);
2050 df3->SetRSSI(-65); 2051 df3->SetRSSI(-65);
2051 df3->AddUUID(BluetoothUUID("1020")); 2052 df3->AddUUID(BluetoothUUID("1020"));
2052 df3->AddUUID(BluetoothUUID("1003")); 2053 df3->AddUUID(BluetoothUUID("1003"));
2053 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter3(df3); 2054 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter3(df3);
2054 2055
2055 adapter_->StartDiscoverySessionWithFilter( 2056 adapter_->StartDiscoverySessionWithFilter(
2056 discovery_filter3.Pass(), 2057 std::move(discovery_filter3),
2057 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback, 2058 base::Bind(&BluetoothBlueZTest::DiscoverySessionCallback,
2058 base::Unretained(this)), 2059 base::Unretained(this)),
2059 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this))); 2060 base::Bind(&BluetoothBlueZTest::ErrorCallback, base::Unretained(this)));
2060 2061
2061 message_loop_.Run(); 2062 message_loop_.Run();
2062 2063
2063 filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter(); 2064 filter = fake_bluetooth_adapter_client_->GetDiscoveryFilter();
2064 EXPECT_EQ("auto", *filter->transport); 2065 EXPECT_EQ("auto", *filter->transport);
2065 EXPECT_EQ(-65, *filter->rssi); 2066 EXPECT_EQ(-65, *filter->rssi);
2066 EXPECT_EQ(nullptr, filter->pathloss.get()); 2067 EXPECT_EQ(nullptr, filter->pathloss.get());
(...skipping 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after
4289 adapter_->Shutdown(); 4290 adapter_->Shutdown();
4290 adapter_chrome_os->OnStopDiscoveryError(GetDiscoveryErrorCallback(), "", ""); 4291 adapter_chrome_os->OnStopDiscoveryError(GetDiscoveryErrorCallback(), "", "");
4291 4292
4292 // 1 error reported to RemoveDiscoverySession because of OnStopDiscoveryError, 4293 // 1 error reported to RemoveDiscoverySession because of OnStopDiscoveryError,
4293 // and kNumberOfDiscoverySessions errors queued with AddDiscoverySession. 4294 // and kNumberOfDiscoverySessions errors queued with AddDiscoverySession.
4294 EXPECT_EQ(0, callback_count_); 4295 EXPECT_EQ(0, callback_count_);
4295 EXPECT_EQ(1 + kNumberOfDiscoverySessions, error_callback_count_); 4296 EXPECT_EQ(1 + kNumberOfDiscoverySessions, error_callback_count_);
4296 } 4297 }
4297 4298
4298 } // namespace bluez 4299 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_advertisement_bluez_unittest.cc ('k') | device/bluetooth/bluetooth_device_bluez.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698