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

Commit accfd764 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "dumpsys: '-l' works for 0/1 services." am: d59ca09f

Change-Id: I6000ffa76f2fa6bfe299d38e7a170ab86f4f99f5
parents d10aba2a d59ca09f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ int Dumpsys::main(int argc, char* const argv[]) {
    }

    const size_t N = services.size();
    if (N > 1) {
    if (N > 1 || showListOnly) {
        // first print a list of the current services
        std::cout << "Currently running services:" << std::endl;

+16 −4
Original line number Diff line number Diff line
@@ -206,10 +206,7 @@ class DumpsysTest : public Test {
    }

    void AssertRunningServices(const std::vector<std::string>& services) {
        std::string expected;
        if (services.size() > 1) {
            expected.append("Currently running services:\n");
        }
        std::string expected = "Currently running services:\n";
        for (const std::string& service : services) {
            expected.append("  ").append(service).append("\n");
        }
@@ -263,6 +260,21 @@ TEST_F(DumpsysTest, ListAllServices) {
    AssertRunningServices({"Locksmith", "Valet"});
}

TEST_F(DumpsysTest, ListServicesOneRegistered) {
    ExpectListServices({"Locksmith"});
    ExpectCheckService("Locksmith");

    CallMain({"-l"});

    AssertRunningServices({"Locksmith"});
}

TEST_F(DumpsysTest, ListServicesEmpty) {
    CallMain({"-l"});

    AssertRunningServices({});
}

// Tests 'dumpsys -l' when a service is not running
TEST_F(DumpsysTest, ListRunningServices) {
    ExpectListServices({"Locksmith", "Valet"});