bluetooth: Add test to verify page scan during inquiry

Adding a new test to CLHealth to reflect an AVL requirement.

BUG=b:175133160
TEST=Ran on Ezkinil (failed) and Morphius (passed)

Change-Id: Id3cf07dca2ee0ff8448e09af7943eb87328aca51
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2599240
Commit-Queue: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Tested-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Reviewed-by: Daniel Winkler <danielwinkler@google.com>
diff --git a/server/site_tests/bluetooth_AdapterCLHealth/bluetooth_AdapterCLHealth.py b/server/site_tests/bluetooth_AdapterCLHealth/bluetooth_AdapterCLHealth.py
index 09af403..9a25d0f 100644
--- a/server/site_tests/bluetooth_AdapterCLHealth/bluetooth_AdapterCLHealth.py
+++ b/server/site_tests/bluetooth_AdapterCLHealth/bluetooth_AdapterCLHealth.py
@@ -135,6 +135,29 @@
         self.connect_disconnect_loop(device=device, loops=3)
 
 
+    @test_wrapper('Page scan during Inquiry', devices={"MOUSE": 1})
+    def cl_page_scan_during_inquiry(self):
+        """Checks page scan is working during inquiry.
+
+        Scan and pair peer device.
+        Start inquiry.
+        Disconnect peer device from DUT.
+        Reconnect peer device by initiating connection from peer.
+        """
+        device = self.devices['MOUSE'][0]
+
+        # Setup
+        self.assert_discover_and_pair(device)
+        self.test_start_discovery()
+
+        # Disconnection should set up page scan so a reconnect immediately
+        # afterwards should always succeed
+        self.test_disconnection_by_adapter(device.address)
+        self.test_connection_by_device(device)
+
+        # Cleanup
+        self.test_stop_discovery()
+
     @test_wrapper('SDP Service Browse Test', devices={"BLUETOOTH_TESTER":1})
     def cl_sdp_service_browse_test(self):
         """Performs sdp browse with tester peripheral"""
diff --git a/server/site_tests/bluetooth_AdapterCLHealth/control.cl_page_scan_during_inquiry b/server/site_tests/bluetooth_AdapterCLHealth/control.cl_page_scan_during_inquiry
new file mode 100644
index 0000000..816202a
--- /dev/null
+++ b/server/site_tests/bluetooth_AdapterCLHealth/control.cl_page_scan_during_inquiry
@@ -0,0 +1,31 @@
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from autotest_lib.server import utils
+
+AUTHOR = 'chromeos-bluetooth'
+NAME = 'bluetooth_AdapterCLHealth.cl_page_scan_during_inquiry'
+PURPOSE = ('Test controller page scan is working during inquiry.')
+CRITERIA = 'Connection attempt during inquiry should succeed.'
+ATTRIBUTES = 'suite:bluetooth_flaky'
+TIME = 'SHORT'
+TEST_CATEGORY = 'Functional'
+TEST_CLASS = 'bluetooth'
+TEST_TYPE = 'server'
+DEPENDENCIES = 'bluetooth, working_bluetooth_btpeer:1'
+
+DOC = """
+Verify that the DUT could accept a connection during inquiry.
+"""
+
+args_dict = utils.args_to_dict(args)
+
+def run(machine):
+    host = hosts.create_host(machine)
+    job.run_test('bluetooth_AdapterCLHealth', host=host,
+                 num_iterations=1, args_dict=args_dict,
+                 test_name=NAME.split('.')[1])
+
+parallel_simple(run, machines)
+