diff options
author | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-21 02:37:42 +0000 |
---|---|---|
committer | keybuk@chromium.org <keybuk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-21 02:37:42 +0000 |
commit | 524203498d81fce05e2bd368f6c014e2a570b368 (patch) | |
tree | 770fca0731954ebdcb67f58c2e873e190dc3deb4 /device | |
parent | e93a86a64fbc064c3e6e1d428d6cb5613ce25c46 (diff) | |
download | chromium_src-524203498d81fce05e2bd368f6c014e2a570b368.zip chromium_src-524203498d81fce05e2bd368f6c014e2a570b368.tar.gz chromium_src-524203498d81fce05e2bd368f6c014e2a570b368.tar.bz2 |
Bluetooth: remove DismissDisplayOrConfirm
This pairing delegate method never really made any sense, since the
outgoing call to Connect() has callbacks for the success and error
cases which indicate completion of the pairing and thus the right
point to hide down the dialog.
As part of the clean-up make the 'Accept' button return the dialog
to the 'Connecting...' state, as the 'Connect' button on the
PIN/Passkey prompts does, rather than closing the dialog.
This means that the positive buttons (Connect, Accept) keep the dialog
open, while the negative buttons (Cancel, Reject) dismiss the dialog.
Thus the API is now cleaner for implementing notifications/JavaScript.
BUG=338492
TEST=device_unittests, unit_tests, browser_tests and run through the
various 'fake' interactions
Review URL: https://codereview.chromium.org/172953006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252471 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device')
-rw-r--r-- | device/bluetooth/bluetooth_adapter_chromeos.cc | 1 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_chromeos_unittest.cc | 76 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_device.h | 15 |
3 files changed, 6 insertions, 86 deletions
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc index 3344392..3b694e4 100644 --- a/device/bluetooth/bluetooth_adapter_chromeos.cc +++ b/device/bluetooth/bluetooth_adapter_chromeos.cc @@ -586,7 +586,6 @@ BluetoothAdapterChromeOS::PairingContext::~PairingContext() { DCHECK(passkey_callback_.is_null()); DCHECK(confirmation_callback_.is_null()); - pairing_delegate_->DismissDisplayOrConfirm(); pairing_delegate_ = NULL; } diff --git a/device/bluetooth/bluetooth_chromeos_unittest.cc b/device/bluetooth/bluetooth_chromeos_unittest.cc index a1cc67d5..6e4db1a 100644 --- a/device/bluetooth/bluetooth_chromeos_unittest.cc +++ b/device/bluetooth/bluetooth_chromeos_unittest.cc @@ -140,7 +140,6 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate { display_passkey_count_(0), keys_entered_count_(0), confirm_passkey_count_(0), - dismiss_count_(0), last_passkey_(9999999U), last_entered_(999U) {} virtual ~TestPairingDelegate() {} @@ -188,12 +187,6 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate { QuitMessageLoop(); } - virtual void DismissDisplayOrConfirm() OVERRIDE { - ++call_count_; - ++dismiss_count_; - QuitMessageLoop(); - } - int call_count_; int request_pincode_count_; int request_passkey_count_; @@ -201,7 +194,6 @@ class TestPairingDelegate : public BluetoothDevice::PairingDelegate { 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_; @@ -1300,10 +1292,6 @@ TEST_F(BluetoothChromeOSTest, PairAppleMouse) { EXPECT_EQ(uuids[0], "00001124-0000-1000-8000-00805f9b34fb"); EXPECT_TRUE(device->IsConnectable()); - // Pairing dialog should be dismissed - EXPECT_EQ(1, pairing_delegate.call_count_); - EXPECT_EQ(1, pairing_delegate.dismiss_count_); - // Make sure the trusted property has been set to true. FakeBluetoothDeviceClient::Properties* properties = fake_bluetooth_device_client_->GetProperties( @@ -1363,9 +1351,6 @@ TEST_F(BluetoothChromeOSTest, PairAppleKeyboard) { EXPECT_EQ(uuids[0], "00001124-0000-1000-8000-00805f9b34fb"); EXPECT_TRUE(device->IsConnectable()); - // Pairing dialog should be dismissed - EXPECT_EQ(1, pairing_delegate.dismiss_count_); - // Make sure the trusted property has been set to true. FakeBluetoothDeviceClient::Properties* properties = fake_bluetooth_device_client_->GetProperties( @@ -1418,9 +1403,9 @@ TEST_F(BluetoothChromeOSTest, PairMotorolaKeyboard) { message_loop.Run(); - // 8 KeysEntered notifications (0 to 7, inclusive). Two aditional calls for - // DisplayPasskey() and DismissDisplayOrConfirm(). - EXPECT_EQ(10, pairing_delegate.call_count_); + // 8 KeysEntered notifications (0 to 7, inclusive) and one aditional call for + // DisplayPasskey(). + EXPECT_EQ(9, pairing_delegate.call_count_); EXPECT_EQ(8, pairing_delegate.keys_entered_count_); EXPECT_EQ(7U, pairing_delegate.last_entered_); @@ -1446,9 +1431,6 @@ TEST_F(BluetoothChromeOSTest, PairMotorolaKeyboard) { // Fake MotorolaKeyboard is not connectable. EXPECT_FALSE(device->IsConnectable()); - // Pairing dialog should be dismissed - EXPECT_EQ(1, pairing_delegate.dismiss_count_); - // Make sure the trusted property has been set to true. FakeBluetoothDeviceClient::Properties* properties = fake_bluetooth_device_client_->GetProperties( @@ -1508,10 +1490,6 @@ TEST_F(BluetoothChromeOSTest, PairSonyHeadphones) { // Non HID devices are always connectable. EXPECT_TRUE(device->IsConnectable()); - // 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. FakeBluetoothDeviceClient::Properties* properties = fake_bluetooth_device_client_->GetProperties( @@ -1568,10 +1546,6 @@ TEST_F(BluetoothChromeOSTest, PairPhone) { // Non HID devices are always connectable. EXPECT_TRUE(device->IsConnectable()); - // 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. FakeBluetoothDeviceClient::Properties* properties = fake_bluetooth_device_client_->GetProperties( @@ -1629,10 +1603,6 @@ TEST_F(BluetoothChromeOSTest, PairWeirdDevice) { // Non HID devices are always connectable. EXPECT_TRUE(device->IsConnectable()); - // 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. FakeBluetoothDeviceClient::Properties* properties = fake_bluetooth_device_client_->GetProperties( @@ -1677,10 +1647,6 @@ TEST_F(BluetoothChromeOSTest, PairUnpairableDeviceFails) { EXPECT_FALSE(device->IsConnected()); EXPECT_FALSE(device->IsConnecting()); EXPECT_FALSE(device->IsPaired()); - - // Pairing dialog should be dismissed - EXPECT_EQ(1, pairing_delegate.call_count_); - EXPECT_EQ(1, pairing_delegate.dismiss_count_); } TEST_F(BluetoothChromeOSTest, PairingFails) { @@ -1721,10 +1687,6 @@ TEST_F(BluetoothChromeOSTest, PairingFails) { EXPECT_FALSE(device->IsConnected()); EXPECT_FALSE(device->IsConnecting()); EXPECT_FALSE(device->IsPaired()); - - // Pairing dialog should be dismissed - EXPECT_EQ(1, pairing_delegate.call_count_); - EXPECT_EQ(1, pairing_delegate.dismiss_count_); } TEST_F(BluetoothChromeOSTest, PairingFailsAtConnection) { @@ -1771,10 +1733,6 @@ TEST_F(BluetoothChromeOSTest, PairingFailsAtConnection) { EXPECT_TRUE(device->IsPaired()); - // Pairing dialog should be dismissed - EXPECT_EQ(1, pairing_delegate.call_count_); - EXPECT_EQ(1, pairing_delegate.dismiss_count_); - // Make sure the trusted property has been set to true still (since pairing // worked). FakeBluetoothDeviceClient::Properties* properties = @@ -1825,10 +1783,6 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtPinCode) { EXPECT_FALSE(device->IsConnected()); EXPECT_FALSE(device->IsConnecting()); EXPECT_FALSE(device->IsPaired()); - - // Pairing dialog should be dismissed - EXPECT_EQ(2, pairing_delegate.call_count_); - EXPECT_EQ(1, pairing_delegate.dismiss_count_); } TEST_F(BluetoothChromeOSTest, PairingCancelledAtPinCode) { @@ -1872,10 +1826,6 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtPinCode) { EXPECT_FALSE(device->IsConnected()); EXPECT_FALSE(device->IsConnecting()); EXPECT_FALSE(device->IsPaired()); - - // Pairing dialog should be dismissed - EXPECT_EQ(2, pairing_delegate.call_count_); - EXPECT_EQ(1, pairing_delegate.dismiss_count_); } TEST_F(BluetoothChromeOSTest, PairingRejectedAtPasskey) { @@ -1919,10 +1869,6 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtPasskey) { EXPECT_FALSE(device->IsConnected()); EXPECT_FALSE(device->IsConnecting()); EXPECT_FALSE(device->IsPaired()); - - // Pairing dialog should be dismissed - EXPECT_EQ(2, pairing_delegate.call_count_); - EXPECT_EQ(1, pairing_delegate.dismiss_count_); } TEST_F(BluetoothChromeOSTest, PairingCancelledAtPasskey) { @@ -1966,10 +1912,6 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtPasskey) { EXPECT_FALSE(device->IsConnected()); EXPECT_FALSE(device->IsConnecting()); EXPECT_FALSE(device->IsPaired()); - - // Pairing dialog should be dismissed - EXPECT_EQ(2, pairing_delegate.call_count_); - EXPECT_EQ(1, pairing_delegate.dismiss_count_); } TEST_F(BluetoothChromeOSTest, PairingRejectedAtConfirmation) { @@ -2013,10 +1955,6 @@ TEST_F(BluetoothChromeOSTest, PairingRejectedAtConfirmation) { EXPECT_FALSE(device->IsConnected()); EXPECT_FALSE(device->IsConnecting()); EXPECT_FALSE(device->IsPaired()); - - // Pairing dialog should be dismissed - EXPECT_EQ(2, pairing_delegate.call_count_); - EXPECT_EQ(1, pairing_delegate.dismiss_count_); } TEST_F(BluetoothChromeOSTest, PairingCancelledAtConfirmation) { @@ -2060,10 +1998,6 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledAtConfirmation) { EXPECT_FALSE(device->IsConnected()); EXPECT_FALSE(device->IsConnecting()); EXPECT_FALSE(device->IsPaired()); - - // Pairing dialog should be dismissed - EXPECT_EQ(2, pairing_delegate.call_count_); - EXPECT_EQ(1, pairing_delegate.dismiss_count_); } TEST_F(BluetoothChromeOSTest, PairingCancelledInFlight) { @@ -2106,10 +2040,6 @@ TEST_F(BluetoothChromeOSTest, PairingCancelledInFlight) { EXPECT_FALSE(device->IsConnected()); EXPECT_FALSE(device->IsConnecting()); EXPECT_FALSE(device->IsPaired()); - - // Pairing dialog should be dismissed - EXPECT_EQ(1, pairing_delegate.call_count_); - EXPECT_EQ(1, pairing_delegate.dismiss_count_); } } // namespace chromeos diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h index b115d73..d0b1765 100644 --- a/device/bluetooth/bluetooth_device.h +++ b/device/bluetooth/bluetooth_device.h @@ -102,9 +102,7 @@ class BluetoothDevice { // This method will be called when the Bluetooth daemon requires that the // user enter the PIN code |pincode| into the device |device| so that it - // may be authenticated. The DismissDisplayOrConfirm() method - // will be called to dismiss the display once pairing is complete or - // cancelled. + // may be authenticated. // // This is used for Bluetooth 2.0 and earlier keyboard devices, the // |pincode| will always be a six-digit numeric in the range 000000-999999 @@ -114,8 +112,7 @@ class BluetoothDevice { // This method will be called when the Bluetooth daemon requires that the // user enter the Passkey |passkey| into the device |device| so that it - // may be authenticated. The DismissDisplayOrConfirm() method will be - // called to dismiss the display once pairing is complete or cancelled. + // may be authenticated. // // This is used for Bluetooth 2.1 and later devices that support input // but not display, such as keyboards. The Passkey is a numeric in the @@ -129,8 +126,7 @@ class BluetoothDevice { // using a PIN code or a Passkey. // // This method will be called only after DisplayPinCode() or - // DisplayPasskey() is called and before the corresponding - // DismissDisplayOrConfirm() is called, but is not warranted to be called + // DisplayPasskey() method is called, but is not warranted to be called // on every pairing process that requires a PIN code or a Passkey because // some device may not support this feature. // @@ -154,11 +150,6 @@ class BluetoothDevice { // digits. virtual void ConfirmPasskey(BluetoothDevice* device, uint32 passkey) = 0; - - // This method will be called when any previous DisplayPinCode(), - // DisplayPasskey() or ConfirmPasskey() request should be concluded - // and removed from the user. - virtual void DismissDisplayOrConfirm() = 0; }; // Returns true if uuid is in a a valid canonical format |