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

Unified Diff: extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc

Issue 1083163002: Expose SetDiscoveryFilter from BluetoothEventRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another windows build fix Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/api/bluetooth/bluetooth_event_router.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
diff --git a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
index 7f5a41283cdfb38d79fe2163020f092cf6dbaf0c..f8aba4403d2c3a534b4774c8b0caad1b5d6125ee 100644
--- a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
+++ b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
@@ -27,6 +27,9 @@ const char kTestExtensionId[] = "test extension id";
const device::BluetoothUUID kAudioProfileUuid("1234");
const device::BluetoothUUID kHealthProfileUuid("4321");
+MATCHER_P(IsFilterEqual, a, "") {
+ return arg.Equals(*a);
+}
} // namespace
namespace extensions {
@@ -91,4 +94,33 @@ TEST_F(BluetoothEventRouterTest, UnloadExtension) {
EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)).Times(1);
}
+// This test check that calling SetDiscoveryFilter before StartDiscoverySession
+// for given extension will start session with proper filter.
+TEST_F(BluetoothEventRouterTest, SetDiscoveryFilter) {
+ scoped_ptr<device::BluetoothDiscoveryFilter> discovery_filter(
+ new device::BluetoothDiscoveryFilter(
+ device::BluetoothDiscoveryFilter::Transport::TRANSPORT_LE));
+
+ discovery_filter->SetRSSI(-80);
+ discovery_filter->AddUUID(device::BluetoothUUID("1000"));
+
+ device::BluetoothDiscoveryFilter df(
+ device::BluetoothDiscoveryFilter::Transport::TRANSPORT_LE);
+ df.CopyFrom(*discovery_filter);
+
+ router_->SetDiscoveryFilter(discovery_filter.Pass(), mock_adapter_,
+ kTestExtensionId, base::Bind(&base::DoNothing),
+ base::Bind(&base::DoNothing));
+
+ EXPECT_CALL(*mock_adapter_, StartDiscoverySessionWithFilterRaw(
+ testing::Pointee(IsFilterEqual(&df)),
+ testing::_, testing::_)).Times(1);
+
+ router_->StartDiscoverySession(mock_adapter_, kTestExtensionId,
+ base::Bind(&base::DoNothing),
+ base::Bind(&base::DoNothing));
+
+ EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)).Times(1);
+}
+
} // namespace extensions
« no previous file with comments | « extensions/browser/api/bluetooth/bluetooth_event_router.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698