From d9843357d0fa8e4bbe0d42007bfdfebe37db7451 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Wed, 25 Jan 2017 11:19:59 -0800 Subject: Adding some tests for request pin shortcut/widget flow Bug: 33584624 Change-Id: I49df36f60d2ae071b9d2c77c9c3300e010cd3bb9 --- .../testcomponent/WidgetConfigActivity.java | 38 +++++----------------- 1 file changed, 9 insertions(+), 29 deletions(-) (limited to 'tests/src/com/android/launcher3/testcomponent/WidgetConfigActivity.java') diff --git a/tests/src/com/android/launcher3/testcomponent/WidgetConfigActivity.java b/tests/src/com/android/launcher3/testcomponent/WidgetConfigActivity.java index c0509bc24..d76ad0499 100644 --- a/tests/src/com/android/launcher3/testcomponent/WidgetConfigActivity.java +++ b/tests/src/com/android/launcher3/testcomponent/WidgetConfigActivity.java @@ -15,50 +15,30 @@ */ package com.android.launcher3.testcomponent; -import android.app.Activity; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; import android.os.Bundle; /** * Simple activity for widget configuration */ -public class WidgetConfigActivity extends Activity { +public class WidgetConfigActivity extends BaseTestingActivity { public static final String SUFFIX_FINISH = "-finish"; public static final String EXTRA_CODE = "code"; - public static final String EXTRA_INTENT = "intent"; - - private final BroadcastReceiver mFinishReceiver = new BroadcastReceiver() { - - @Override - public void onReceive(Context context, Intent intent) { - WidgetConfigActivity.this.setResult( - intent.getIntExtra(EXTRA_CODE, RESULT_CANCELED), - (Intent) intent.getParcelableExtra(EXTRA_INTENT)); - WidgetConfigActivity.this.finish(); - } - }; - - private final String mAction = this.getClass().getName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - registerReceiver(mFinishReceiver, new IntentFilter(mAction + SUFFIX_FINISH)); + addButton("Cancel", "clickCancel"); + addButton("OK", "clickOK"); } - @Override - protected void onResume() { - super.onResume(); - sendBroadcast(new Intent(mAction).putExtra(Intent.EXTRA_INTENT, getIntent())); + public void clickCancel() { + setResult(RESULT_CANCELED); + finish(); } - @Override - protected void onDestroy() { - unregisterReceiver(mFinishReceiver); - super.onDestroy(); + public void clickOK() { + setResult(RESULT_OK); + finish(); } } -- cgit v1.2.3