Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 25765fa0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topic "floss_suspend_resume_api" am: ccce159b

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1991130

Change-Id: Ibb29cad0bb5dc6f57aa91d31f692e1010513fa12
parents 99ce13ca ccce159b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ genrule {
        "protoc-gen-grpc-python-plugin",
        "soong_zip",
    ],
    cmd: "$(location aprotoc) --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-python-plugin) -Ipackages/modules/Bluetooth/system $(in) --grpc_out=$(genDir) --python_out=$(genDir)",
    cmd: "$(location aprotoc) --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-python-plugin) -Iexternal/protobuf/src -Ipackages/modules/Bluetooth/system $(in) --grpc_out=$(genDir) --python_out=$(genDir)",
    srcs: ["blueberry/facade/topshim/facade.proto"],
    out: [
        "blueberry/facade/topshim/facade_pb2.py",
+3 −0
Original line number Diff line number Diff line
syntax = "proto3";

import "google/protobuf/empty.proto";

package blueberry.facade.topshim;

service AdapterService {
  rpc FetchEvents(FetchEventsRequest) returns (stream FetchEventsResponse) {}
  rpc ToggleStack(ToggleStackRequest) returns (ToggleStackResponse) {}
  rpc SetDiscoveryMode(SetDiscoveryModeRequest) returns (SetDiscoveryModeResponse) {}
  rpc ClearEventFilter(google.protobuf.Empty) returns (google.protobuf.Empty) {}
}

enum EventType {
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import grpc
from blueberry.facade.topshim import facade_pb2
from blueberry.facade.topshim import facade_pb2_grpc

from google.protobuf import empty_pb2 as empty_proto


class AdapterAutomationHelper():
    # Timeout for async wait
@@ -60,6 +62,9 @@ class AdapterAutomationHelper():
    async def verify_adapter_started(self):
        await asyncio.wait_for(self.pending_future, AdapterAutomationHelper.DEFAULT_TIMEOUT)

    async def clear_event_filter(self):
        await self.adapter_stub.ClearEventFilter(empty_proto.Empty())


class A2dpAutomationHelper():
    """Invoke gRPC on topshim for A2DP testing"""
+42 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3
#
#   Copyright 2021 - The Android Open Source Project
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

import asyncio
from mobly import test_runner
from blueberry.tests.gd.rust.topshim.facade import topshim_base_test
from blueberry.tests.gd.rust.topshim.facade.automation_helper import AdapterAutomationHelper
import time


class SuspendTest(topshim_base_test.TopshimBaseTest):

    async def _test_verify_event_filter_cleared(self):
        self.dut_adapter = AdapterAutomationHelper(port=self.dut_port)
        event_loop = asyncio.get_running_loop()
        self.dut_adapter.fetch_events(event_loop)
        self.dut_adapter.pending_future = event_loop.create_future()
        await self.dut_adapter.clear_event_filter()
        #TODO(optedoblivion): Replace sleep with a call to LeGetRandom and synchronize on
        # the callback
        time.sleep(1)
        self.dut_adapter.event_handler.cancel()

    def test_verify_event_filter_cleared(self):
        asyncio.run(self._test_verify_event_filter_cleared())


if __name__ == "__main__":
    test_runner.main()
+3 −2
Original line number Diff line number Diff line
@@ -20,7 +20,8 @@ import os
import argparse

TEST_SUITES = [
    "blueberry.tests.gd.rust.topshim.facade.adapter_test"
    "blueberry.tests.gd.rust.topshim.facade.adapter_test",
    "blueberry.tests.gd.rust.topshim.facade.suspend_test"
]

SOONG_UI_BASH = 'build/soong/soong_ui.bash'
@@ -135,7 +136,7 @@ def main():
    if not all(test_results):
        failures = [i for i, x in enumerate(test_results) if not x]
        for index in failures:
            print('TEST FAILLED: ' + TEST_SUITES[index])
            print('TEST FAILED: ' + TEST_SUITES[index])
        sys.exit(0)
    print('TEST PASSED ' + str(len(test_results)) + ' tests were run')

Loading