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

Unified Diff: device/bluetooth/bluetooth_experimental_chromeos_unittest.cc

Issue 13870020: Bluetooth: Add support for pairing display notifications (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: implementation and test Created 7 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 | « device/bluetooth/bluetooth_device_experimental_chromeos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_experimental_chromeos_unittest.cc
diff --git a/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc b/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc
index 7bd7c25fd3582280afff2caef24636298934ad15..f7cb49d123ecfbfb9ad6637d8e8e160fe10ee236 100644
--- a/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc
+++ b/device/bluetooth/bluetooth_experimental_chromeos_unittest.cc
@@ -128,6 +128,7 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate {
request_passkey_count_(0),
display_pincode_count_(0),
display_passkey_count_(0),
+ keys_entered_count_(0),
confirm_passkey_count_(0),
dismiss_count_(0) {}
virtual ~TestPairingDelegate() {}
@@ -160,6 +161,14 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate {
QuitMessageLoop();
}
+ void KeysEntered(BluetoothDevice* device,
+ uint32 entered) OVERRIDE {
+ ++call_count_;
+ ++keys_entered_count_;
+ last_entered_ = entered;
+ QuitMessageLoop();
+ }
+
void ConfirmPasskey(BluetoothDevice* device,
uint32 passkey) OVERRIDE {
++call_count_;
@@ -179,9 +188,11 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate {
int request_passkey_count_;
int display_pincode_count_;
int display_passkey_count_;
+ int keys_entered_count_;
int confirm_passkey_count_;
int dismiss_count_;
uint32 last_passkey_;
+ uint32 last_entered_;
std::string last_pincode_;
private:
@@ -1218,15 +1229,29 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairMotorolaKeyboard) {
base::Bind(&BluetoothExperimentalChromeOSTest::ConnectErrorCallback,
base::Unretained(this)));
- EXPECT_EQ(1, pairing_delegate.call_count_);
+ // One call for DisplayPasskey() and one for KeysEntered().
+ EXPECT_EQ(2, pairing_delegate.call_count_);
EXPECT_EQ(1, pairing_delegate.display_passkey_count_);
EXPECT_EQ(123456U, pairing_delegate.last_passkey_);
EXPECT_TRUE(device->IsConnecting());
keybuk 2013/04/18 23:50:36 Doesn't check the KeysEntered call here. Should v
deymo 2013/04/19 01:35:00 Done.
- // TODO(keybuk): verify we get typing notifications
+ // One call to KeysEntered() for each key, including [enter].
+ for(int i = 1; i <= 7; ++i) {
+ message_loop.Run();
+
+ EXPECT_EQ(2 + i, pairing_delegate.call_count_);
+ EXPECT_EQ(1 + i, pairing_delegate.keys_entered_count_);
+ EXPECT_EQ((uint32_t)i, pairing_delegate.last_entered_);
keybuk 2013/04/18 23:50:36 style: use static_cast<> http://google-styleguide.
deymo 2013/04/19 01:35:00 Done.
+ }
message_loop.Run();
+ // 8 KeysEntered notifications (0 to 7, inclusive). Two aditional calls for
+ // DisplayPasskey() and DismissDisplayOrConfirm().
+ EXPECT_EQ(10, pairing_delegate.call_count_);
+ EXPECT_EQ(8, pairing_delegate.keys_entered_count_);
+ EXPECT_EQ(7U, pairing_delegate.last_entered_);
+
EXPECT_EQ(1, callback_count_);
EXPECT_EQ(0, error_callback_count_);
@@ -1240,7 +1265,6 @@ TEST_F(BluetoothExperimentalChromeOSTest, PairMotorolaKeyboard) {
EXPECT_TRUE(device->IsPaired());
// Pairing dialog should be dismissed
- EXPECT_EQ(2, pairing_delegate.call_count_);
EXPECT_EQ(1, pairing_delegate.dismiss_count_);
// Make sure the trusted property has been set to true.
« no previous file with comments | « device/bluetooth/bluetooth_device_experimental_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698