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

Commit 9fc2e091 authored by Ang Li's avatar Ang Li Committed by Android (Google) Code Review
Browse files

Merge "Add test for ProtoLog calls before initialization." into main

parents 661c2081 f4b229fd
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -55,6 +55,21 @@ public class ProtoLogTest {
        ProtoLog.setControllerInstanceForTest(mController);
    }

    @Test
    public void log_whenUninitialized_doesNotThrow() {
        // This test verifies that calling any ProtoLog logging method before the
        // system is initialized does not cause a crash. The change this test covers
        // replaced an IllegalStateException with a Log.wtf() call.

        // The test passes if no exception is thrown for any of the log levels.
        ProtoLog.d(TEST_GROUP_1, "Debug log call before init");
        ProtoLog.v(TEST_GROUP_1, "Verbose log call before init");
        ProtoLog.i(TEST_GROUP_1, "Info log call before init");
        ProtoLog.w(TEST_GROUP_1, "Warning log call before init");
        ProtoLog.e(TEST_GROUP_1, "Error log call before init");
        ProtoLog.wtf(TEST_GROUP_1, "WTF log call before init");
    }

    @Test
    public void canRunProtoLogInitMultipleTimes() {
        ProtoLog.init(TEST_GROUP_1);