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

Unified Diff: device/bluetooth/test/bluetooth_test.h

Issue 1150833002: bluetooth: android: Initial Low Energy Discovery Sessions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-manifest-
Patch Set: Add tests Created 5 years, 6 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: device/bluetooth/test/bluetooth_test.h
diff --git a/device/bluetooth/test/bluetooth_test.h b/device/bluetooth/test/bluetooth_test.h
index 12a58b45ff1a464a530e613b3951a0fc1a303e00..8778c00f77a47280def1c6cc4563cce53ad6b389 100644
--- a/device/bluetooth/test/bluetooth_test.h
+++ b/device/bluetooth/test/bluetooth_test.h
@@ -6,7 +6,9 @@
#define DEVICE_BLUETOOTH_TEST_BLUETOOTH_TEST_H_
#include "base/memory/ref_counted.h"
+#include "base/message_loop/message_loop.h"
#include "device/bluetooth/bluetooth_adapter.h"
+#include "device/bluetooth/bluetooth_discovery_session.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace device {
@@ -35,7 +37,25 @@ class BluetoothTestBase : public testing::Test {
// controlled by this test fixture.
virtual void InitWithFakeAdapter(){};
+ // Callbacks that increment |callback_count_|, |error_callback_count_|:
+ void Callback();
+ void DiscoverySessionCallback(scoped_ptr<BluetoothDiscoverySession>);
+ void ErrorCallback();
+
+ // Accessors to get callbacks bound to this fixture:
+ base::Closure GetCallback();
+ BluetoothAdapter::DiscoverySessionCallback GetDiscoverySessionCallback();
+ BluetoothAdapter::ErrorCallback GetErrorCallback();
+
+ // A Message loop is required by some implementations that will PostTasks and
+ // by base::RunLoop().RunUntilIdle() use in this fixuture.
+ base::MessageLoop message_loop_;
+
scoped_refptr<BluetoothAdapter> adapter_;
+ ScopedVector<BluetoothDiscoverySession> discovery_sessions_;
+ int callback_count_ = 0;
+ int error_callback_count_ = 0;
+ bool run_message_loop_to_wait_for_callbacks_ = true;
};
} // namespace device

Powered by Google App Engine
This is Rietveld 408576698