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

Commit 54e221a4 authored by Aurimas Liutikas's avatar Aurimas Liutikas
Browse files

Fix broken android.view.DisabledTest.

The test was calling setOnClickListener off the main thread.

Test: ran manually and it now passes
Bug: 38166715
Change-Id: I63777467a789c6a060b340d6b410ac2e744db678
parent b5540300
Loading
Loading
Loading
Loading
+21 −16
Original line number Diff line number Diff line
@@ -16,15 +16,15 @@

package android.view;

import com.android.frameworks.coretests.R;
import android.test.ActivityInstrumentationTestCase;
import android.test.TouchUtils;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.LargeTest;

import android.test.ActivityInstrumentationTestCase;
import android.widget.Button;
import android.test.suitebuilder.annotation.MediumTest;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;

import com.android.frameworks.coretests.R;

/**
 * Exercises {@link android.view.View}'s disabled property.
@@ -45,19 +45,24 @@ public class DisabledTest extends ActivityInstrumentationTestCase<Disabled> {

        final Disabled a = getActivity();
        mDisabled = (Button) a.findViewById(R.id.disabledButton);
        mDisabledParent = a.findViewById(R.id.clickableParent);
        getInstrumentation().runOnMainSync(
                new Runnable() {
                    @Override
                    public void run() {
                        mDisabled.setOnClickListener(new View.OnClickListener() {
                            public void onClick(View v) {
                                mClicked = true;
                            }
                        });

        mDisabledParent = a.findViewById(R.id.clickableParent);
                        mDisabledParent.setOnClickListener(new View.OnClickListener() {
                            public void onClick(View v) {
                                mParentClicked = true;
                            }
                        });
                    }
                });
    }

    @Override
    protected void tearDown() throws Exception {