@Before
    public void setup() {
        mCallback = new TestCustomTabsCallback();
        mContext = InstrumentationRegistry.getContext();

        CustomTabsSessionToken token = new CustomTabsSessionToken(mCallback.getStub(), null);
        mConnection = new PostMessageServiceConnection(token) {
            @Override
            public void onPostMessageServiceConnected() {
                mServiceConnected = true;
            }

            @Override
            public void onPostMessageServiceDisconnected() {
                mServiceConnected = false;
            }
        };

        mConnection.bindSessionToPostMessageService(mContext, mContext.getPackageName());
        PollingCheck.waitFor(() -> mServiceConnected);
    }
Tests for {@link PostMessageServiceConnection} with no {@link CustomTabsService} component.
customtabs/tests/src/android/support/customtabs/PostMessageServiceConnectionTest.java