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

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: 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
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..8ca5d388ad93421db5093a5359bb0098d2de6990 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 SetDiscoveryFitler before StartDiscoverySession
armansito 2015/04/16 19:13:55 nit: s/SetDiscoveryFitler/SetDiscoveryFilter/ Not
jpawlowski1 2015/04/16 19:36:28 Done.
+// 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);
armansito 2015/04/16 19:13:55 You'll also want test cases to bluetooth_private_a
jpawlowski1 2015/04/16 19:36:27 this code is not yet connected to bluetooth privat
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698