bluetooth: Remove tests related to PauseDiscovery and UnpauseDiscovery

PauseDiscovery and UnpauseDiscovery is no longer needed since the kernel
handles connection during Inquiry (CL:2583229).

BUG=b:168725519
TEST=Ran bluetooth_AdapterSAHealth

Change-Id: I3ff516462b71b0556076137b7e5c97a45c3bc7c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2593744
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Commit-Queue: Sonny Sasaka <sonnysasaka@chromium.org>
Tested-by: Sonny Sasaka <sonnysasaka@chromium.org>
diff --git a/client/cros/multimedia/bluetooth_facade_native.py b/client/cros/multimedia/bluetooth_facade_native.py
index 6ba2039..5d1cdec 100644
--- a/client/cros/multimedia/bluetooth_facade_native.py
+++ b/client/cros/multimedia/bluetooth_facade_native.py
@@ -1559,68 +1559,6 @@
         self._adapter.StopDiscovery(dbus_interface=self.BLUEZ_ADAPTER_IFACE)
         return (True, None)
 
-    @dbus_print_error()
-    def pause_discovery(self, system_suspend_resume):
-        """Pause discovery of remote devices.
-
-        @return (True, None) on success, (False,<error>) otherwise.
-
-        """
-        self._adapter.PauseDiscovery(dbus.Boolean(system_suspend_resume,
-                                                  variant_level=1),
-                                     dbus_interface=self.BLUEZ_ADAPTER_IFACE)
-        return (True, None)
-
-    @dbus_print_error()
-    def unpause_discovery(self, system_suspend_resume):
-        """Unpause discovery of remote devices.
-
-        @return (True, None) on success, (False,<error>) otherwise.
-
-        """
-        self._adapter.UnpauseDiscovery(dbus.Boolean(system_suspend_resume,
-                                                    variant_level=1),
-                                       dbus_interface=self.BLUEZ_ADAPTER_IFACE)
-        return (True, None)
-
-    @xmlrpc_server.dbus_safe(False)
-    @dbus_print_error()
-    def pause_discovery(self, system_suspend_resume=False):
-        """Pause discovery of remote devices.
-
-        This pauses all device discovery sessions.
-
-        @param system_suspend_resume: whether the
-               request is related to system suspend/resume.
-
-        @return True on success, False otherwise.
-
-        """
-        if not self._adapter:
-            return (False, "Adapter Not Found")
-        self._adapter.PauseDiscovery(system_suspend_resume,
-                                     dbus_interface=self.BLUEZ_ADAPTER_IFACE)
-        return (True, None)
-
-    @xmlrpc_server.dbus_safe(False)
-    @dbus_print_error()
-    def unpause_discovery(self, system_suspend_resume=False):
-        """Unpause discovery of remote devices.
-
-        This unpauses all device discovery sessions.
-
-        @param system_suspend_resume: whether the
-               request is related to system suspend/resume.
-
-        @return True on success, False otherwise.
-
-        """
-        if not self._adapter:
-            return (False, "Adapter Not Found")
-        self._adapter.UnpauseDiscovery(system_suspend_resume,
-                                       dbus_interface=self.BLUEZ_ADAPTER_IFACE)
-        return (True, None)
-
     def get_dev_info(self):
         """Read raw HCI device information.
 
diff --git a/server/cros/bluetooth/bluetooth_adapter_better_together.py b/server/cros/bluetooth/bluetooth_adapter_better_together.py
index 14c349d..5ca6011 100644
--- a/server/cros/bluetooth/bluetooth_adapter_better_together.py
+++ b/server/cros/bluetooth/bluetooth_adapter_better_together.py
@@ -127,16 +127,14 @@
        3. Stop the discovery after the device was found.
        4. Set the LE connection parameters to reduce the min and max
           connection intervals to 6.
-       5. Pause the discovery sessions from all the clients.
-       6. Connect the device.
-       7. Unpause the discovery sessions once the device was connected.
-       8. Set the Trusted property of the device to true.
-       9. Verify all the services were resolved.
-       10. Start notification on the RX characteristic of the
+       5. Connect the device.
+       6. Set the Trusted property of the device to true.
+       7. Verify all the services were resolved.
+       8. Start notification on the RX characteristic of the
            Proximity Service.
-       11. Exchange some messages with the peer device to authorize it.
-       12. Stop the notification.
-       13. Disconnect the device.
+       9. Exchange some messages with the peer device to authorize it.
+       10. Stop the notification.
+       11. Disconnect the device.
     """
 
     filter = {'Transport':'le'}
@@ -151,9 +149,7 @@
       self.test_discover_device(address)
 
       self.test_set_le_connection_parameters(address, parameters)
-      self.test_pause_discovery()
       self.test_connection_by_adapter(address)
-      self.test_unpause_discovery()
 
       self.test_set_trusted(address)
       self.test_service_resolved(address)
diff --git a/server/cros/bluetooth/bluetooth_adapter_tests.py b/server/cros/bluetooth/bluetooth_adapter_tests.py
index 6316f4a..7398449 100644
--- a/server/cros/bluetooth/bluetooth_adapter_tests.py
+++ b/server/cros/bluetooth/bluetooth_adapter_tests.py
@@ -4032,20 +4032,6 @@
 
 
     @test_retry_and_log(False)
-    def test_pause_discovery(self):
-        """Test pause discovery"""
-
-        return self.bluetooth_facade.pause_discovery()
-
-
-    @test_retry_and_log(False)
-    def test_unpause_discovery(self):
-        """Test unpause discovery"""
-
-        return self.bluetooth_facade.unpause_discovery()
-
-
-    @test_retry_and_log(False)
     def test_get_connection_info(self, address):
         """Test that connection info to device is retrievable."""
 
diff --git a/server/cros/bluetooth/bluetooth_dbus_api_tests.py b/server/cros/bluetooth/bluetooth_dbus_api_tests.py
index c5c1e5c..2dc7f1a 100644
--- a/server/cros/bluetooth/bluetooth_dbus_api_tests.py
+++ b/server/cros/bluetooth/bluetooth_dbus_api_tests.py
@@ -54,8 +54,6 @@
         power_off = self._wait_till_power_off()
         power_on = self._wait_till_power_on()
         not_discovering = self._wait_till_discovery_stops()
-        # unpause_discovery will fail if discovery is not paused
-        self.bluetooth_facade.unpause_discovery(False)
         reset_results = {'power_off' : power_off,
                          'power_on' : power_on,
                          'not_discovering' : not_discovering}
@@ -336,259 +334,6 @@
 
 
 ########################################################################
-# dbus call: pause_discovery
-# arguments: boolean system_suspend_resume
-# returns : True/False
-# Notes: 1: argument system_suspend_resume is ignored in the code
-#        2: pause/unpause state is not reflected in Discovering state
-#####################################################
-# Positive cases
-# Case 1
-# preconditions: Adapter powered on AND
-#                Currently discovering
-# Argument: [True|False]
-# result: Success
-# Case 2
-# preconditions: Adapter powered on AND
-#                Currently not discovering
-# Argument: [True|False]
-# result: Success
-######################################################
-# Negative cases
-#
-# Case 1
-# preconditions: Adapter powered off
-# result: Failure
-# error : NotReady
-# postconditions: Discovery can be started after power on
-#
-# Case 2
-# precondition: Adapter powered on AND
-#               Discovery paused
-# result: Failure
-# error: Busy
-#########################################################################
-
-    @_test_retry_and_log(False)
-    def test_dbus_pause_discovery_success(self):
-        """ Test success case of pause_discovery call. """
-        reset = self._reset_state()
-        is_discovering = self._wait_till_discovery_starts()
-        self._wait_till_hci_state_inquiry()
-
-        pause_discovery, error = self.bluetooth_facade.pause_discovery(False)
-
-        no_inquiry = self._wait_till_hci_state_no_inquiry_holds()
-        self.results = {'reset' : reset,
-                        'is_discovering': is_discovering,
-                        'pause_discovery' : pause_discovery,
-                        'no_inquiry' : no_inquiry
-                        }
-        return all(self.results.values())
-
-    @_test_retry_and_log(False)
-    def test_dbus_pause_discovery_success_no_discovery_in_progress(self):
-        """ Test success case of pause_discovery call. """
-        reset = self._reset_state()
-        is_power_on = self._wait_till_power_on()
-        is_not_discovering = self._wait_till_discovery_stops()
-
-        pause_discovery, error = self.bluetooth_facade.pause_discovery(False)
-
-        no_inquiry = self._wait_till_hci_state_no_inquiry_holds()
-        self.results = {'reset' : reset,
-                        'is_power_on' : is_power_on,
-                        'is_not_discovering': is_not_discovering,
-                        'pause_discovery' : pause_discovery,
-                        'no_inquiry' : no_inquiry
-                        }
-        return all(self.results.values())
-
-    @_test_retry_and_log(False)
-    def test_dbus_pause_discovery_fail_power_off(self):
-        """ Test Failure case of pause_discovery call.
-
-        pause discovery when adapter is turned off and confirm it fails with
-        'NotReady' : 'org.bluez.Error.NotReady: Resource Not Ready'.
-        Also check we are able to start discovery after power on
-        """
-        reset = self._reset_state()
-        is_power_off = self._wait_till_power_off()
-
-        pause_discovery, error = self.bluetooth_facade.pause_discovery()
-
-        is_power_on = self._wait_till_power_on()
-        discovery_started = self._wait_till_discovery_starts()
-
-        self.results = {'reset' : reset,
-                        'is_power_off' : is_power_off,
-                        'pause_discovery_failed' : not pause_discovery,
-                        'error_matches' : self._compare_error(error,
-                                                    DBUS_ERRORS['NotReady']),
-                        'is_power_on' : is_power_on,
-                        'discovery_started' : discovery_started
-                       }
-        return all(self.results.values())
-
-    @_test_retry_and_log(False)
-    def test_dbus_pause_discovery_fail_already_paused(self):
-        """ Test failure case of pause_discovery call.
-
-        Call pause discovery twice and make sure second call fails
-        with 'org.bluez.Error.InProgress: Operation already in progress'.
-        """
-        reset = self._reset_state()
-        is_power_on = self._wait_till_power_on()
-        is_discovering = self._wait_till_discovery_starts()
-        pause_discovery, _ = self.bluetooth_facade.pause_discovery()
-
-        pause_discovery_again, error = self.bluetooth_facade.pause_discovery()
-
-        no_inquiry = self._wait_till_hci_state_no_inquiry_holds()
-
-        self.results = {'reset' : reset,
-                        'is_power_on' : is_power_on,
-                        'is_discovering': is_discovering,
-                        'pause_discovery' : pause_discovery,
-                        'pause_discovery_failed' : not pause_discovery_again,
-                        'error_matches' : self._compare_error(error,
-                                                    DBUS_ERRORS['InProgress']),
-                        'no_inquiry' : no_inquiry,
-                        }
-        return all(self.results.values())
-
-########################################################################
-# dbus call: unpause_discovery
-# arguments: boolean system_suspend_resume
-# returns : True/False
-# Notes: 1: argument system_suspend_resume is ignored in the code
-#        2: pause/unpause state is not reflected in Discovering state
-#####################################################
-# Positive cases
-# Case 1
-# preconditions: Adapter powered on AND
-#                Discovery started and Discovery currently paused
-# Argument: [True|False]
-######################################################
-# Negative cases
-#
-# result: Success
-# Case 1
-# preconditions: Adapter powered on AND
-#                Discovery currently not paused
-# Argument: [True|False]
-# result: Failed
-#
-# Case 2
-# preconditions: Adapter powered off
-# result: Failure
-# error : NotReady
-#
-# Case 3
-# precondition: Adapter powered on AND
-#               Discovery paused
-# result: Failure
-# error: Busy
-#########################################################################
-    @_test_retry_and_log(False)
-    def test_dbus_unpause_discovery_success(self):
-        """ Test success case of unpause_discovery call. """
-        reset = self._reset_state()
-        is_discovering = self._wait_till_discovery_starts()
-        pause_discovery, _ = self.bluetooth_facade.pause_discovery()
-        no_inquiry_after_pause = self._wait_till_hci_state_no_inquiry_holds()
-
-        unpause_discovery, error = self.bluetooth_facade.unpause_discovery()
-
-        inquiry_after_unpause = self._wait_till_hci_state_inquiry()
-        self.results = {'reset' : reset,
-                        'is_discovering': is_discovering,
-                        'pause_discovery' : pause_discovery,
-                        'no_inquiry_after_pause' : no_inquiry_after_pause,
-                        'unpause_discovery' : unpause_discovery,
-                        'error' : error is None,
-                        'inquiry_after_unpause' : inquiry_after_unpause
-                        }
-        return all(self.results.values())
-
-    @_test_retry_and_log(False)
-    def test_dbus_unpause_discovery_fail_without_pause(self):
-        """ Test failure case of unpause_discovery call.
-
-        Call unpause_discovery without calling pause_discovery and check it will
-        fail with  org.bluez.Error.Failed: Discovery not paused'
-        """
-        reset = self._reset_state()
-        is_discovering = self._wait_till_discovery_starts()
-
-        unpause_discovery, error = self.bluetooth_facade.unpause_discovery()
-
-        inquiry_after_unpause = self._wait_till_hci_state_inquiry()
-        self.results = {'reset' : reset,
-                        'is_discovering': is_discovering,
-                        'unpause_discovery_fails' : not unpause_discovery,
-                        'error' : self._compare_error(error,
-                                    DBUS_ERRORS['Failed']['discovery_unpause']),
-                        'inquiry_after_unpause' : inquiry_after_unpause
-                        }
-        return all(self.results.values())
-
-    @_test_retry_and_log(False)
-    def test_dbus_unpause_discovery_fail_power_off(self):
-        """ Test Failure case of unpause_discovery call.
-
-        unpause discovery when adapter is turned off and confirm it fails with
-         'org.bluez.Error.Failed: Discovery not paused'
-
-        """
-        reset = self._reset_state()
-        is_power_off = self._wait_till_power_off()
-
-        unpause_discovery, error = self.bluetooth_facade.unpause_discovery()
-
-        self.results = {'reset' : reset,
-                        'is_power_off' : is_power_off,
-                        'unpause_discovery_failed' : not unpause_discovery,
-                        'error_matches' : self._compare_error(error,
-                                    DBUS_ERRORS['Failed']['discovery_unpause']),
-
-                       }
-        return all(self.results.values())
-
-
-    @_test_retry_and_log(False)
-    def test_dbus_unpause_discovery_fail_already_unpaused(self):
-        """ Test Failure case of unpause_discovery call.
-
-        Call unpause discovery twice and make sure second call fails
-        with 'org.bluez.Error.InProgress: Operation already in progress'.
-        """
-        reset = self._reset_state()
-        is_discovering = self._wait_till_discovery_starts()
-        pause_discovery, error = self.bluetooth_facade.pause_discovery()
-        # Make sure the pause discovery has completed
-        pause_discovery_complete = self._wait_till_hci_state_no_inquiry_holds()
-
-        unpause_discovery, _ = self.bluetooth_facade.unpause_discovery()
-
-        unpause_again, error = self.bluetooth_facade.unpause_discovery()
-
-        inquiry_after_unpause = self._wait_till_hci_state_inquiry()
-
-        self.results = {
-            'reset' : reset,
-            'is_discovering': is_discovering,
-            'pause_discovery' : pause_discovery,
-            'pause_discovery_complete' : pause_discovery_complete,
-            'unpause_discovery' : unpause_discovery,
-            'unpause_again_failed': not unpause_again,
-            'error_matches' : self._compare_error(error,
-                                    DBUS_ERRORS['Failed']['discovery_unpause']),
-            'inquiry_after_unpause':inquiry_after_unpause
-        }
-        return all(self.results.values())
-
-########################################################################
 # dbus call: get_suppported_capabilities
 # arguments: None
 # returns : The dictionary is following the format
diff --git a/server/cros/bluetooth/bluetooth_device.py b/server/cros/bluetooth/bluetooth_device.py
index a1aaa76..1de3962 100644
--- a/server/cros/bluetooth/bluetooth_device.py
+++ b/server/cros/bluetooth/bluetooth_device.py
@@ -642,60 +642,6 @@
         return self._proxy.stop_discovery()
 
 
-    @proxy_thread_safe
-    def pause_discovery(self, system_suspend_resume=False):
-        """ Pause discovery of remote devices
-
-        @params: boolean system_suspend_resume Is this request related to
-                 system suspend resume.
-
-        @return (True, None) on success (False, <error>) otherwise
-        """
-        return self._proxy.pause_discovery(system_suspend_resume)
-
-
-    @proxy_thread_safe
-    def unpause_discovery(self, system_suspend_resume=False):
-        """ Unpause discovery of remote devices
-
-        @params: boolean system_suspend_resume Is this request related to
-                 system suspend resume.
-
-        @return (True, None) on success (False, <error>) otherwise
-        """
-        return self._proxy.unpause_discovery(system_suspend_resume)
-
-
-    @proxy_thread_safe
-    def pause_discovery(self, system_suspend_resume=False):
-        """Pause discovery of remote devices.
-
-        This pauses all device discovery sessions.
-
-        @param system_suspend_resume: whether the
-               request is related to system suspend/resume.
-
-        @return True on success, False otherwise.
-
-        """
-        return self._proxy.pause_discovery(system_suspend_resume)
-
-
-    @proxy_thread_safe
-    def unpause_discovery(self, system_suspend_resume=False):
-        """Unpause discovery of remote devices.
-
-        This unpauses all device discovery sessions.
-
-        @param system_suspend_resume: whether the
-               request is related to system suspend/resume.
-
-        @return True on success, False otherwise.
-
-        """
-        return self._proxy.unpause_discovery(system_suspend_resume)
-
-
     def is_discovering(self):
         """Is it discovering?
 
diff --git a/server/site_tests/bluetooth_AdapterSAHealth/bluetooth_AdapterSAHealth.py b/server/site_tests/bluetooth_AdapterSAHealth/bluetooth_AdapterSAHealth.py
index fa6ad78..0a7149b 100644
--- a/server/site_tests/bluetooth_AdapterSAHealth/bluetooth_AdapterSAHealth.py
+++ b/server/site_tests/bluetooth_AdapterSAHealth/bluetooth_AdapterSAHealth.py
@@ -206,16 +206,6 @@
         self.test_dbus_stop_discovery_fail_discovery_not_in_progress()
         self.test_dbus_stop_discovery_fail_power_off()
 
-        self.test_dbus_pause_discovery_success()
-        self.test_dbus_pause_discovery_success_no_discovery_in_progress()
-        self.test_dbus_pause_discovery_fail_already_paused()
-        self.test_dbus_pause_discovery_fail_power_off()
-
-        self.test_dbus_unpause_discovery_success()
-        self.test_dbus_unpause_discovery_fail_without_pause()
-        self.test_dbus_unpause_discovery_fail_power_off()
-        self.test_dbus_unpause_discovery_fail_already_unpaused()
-
         self.test_dbus_get_supported_capabilities_success()
         self.test_dbus_get_supported_capabilities_success_power_off()