New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 783820 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Not on Chrome anymore
Closed: Jan 2018
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Allow running @Before and @After methods that know method parameters

Project Member Reported by bauerb@chromium.org, Nov 10 2017

Issue description

This is useful e.g. to enable features based on a parameter (which needs to happen before the activity is started).
 
Project Member

Comment 1 by bugdroid1@chromium.org, Nov 11 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/629200a5bb428c36f4708f4191bc0d66c468bbda

commit 629200a5bb428c36f4708f4191bc0d66c468bbda
Author: Bernhard Bauer <bauerb@chromium.org>
Date: Sat Nov 11 19:08:01 2017

Add @UseMethodParamBefore and @UseMethodParamAfter annotations

The annotations can be used in conjunction with a newly added test rule
to do setup and teardown for tests that use method parameters. The
methods will be called iff a test method with the given parameter is
executed, with the corresponding parameters.

As an example, use @UseMethodParamBefore in HomeSheetUiCaptureTest to
set the state of the SigninPromo feature before the activity is started.

Also, for moar reusability, extract a MethodParamRule that can be used
to build arbitrary rules that are applied to test statements that use
method parameters and that have access to the parameter value.

Bug:  783820 
Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: If422eef9009c1e8721039d52f4979e5efda98089
Reviewed-on: https://chromium-review.googlesource.com/757356
Commit-Queue: Bernhard Bauer <bauerb@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Nicolas Dossou-Gbété <dgn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515849}
[modify] https://crrev.com/629200a5bb428c36f4708f4191bc0d66c468bbda/base/BUILD.gn
[add] https://crrev.com/629200a5bb428c36f4708f4191bc0d66c468bbda/base/test/android/javatests/src/org/chromium/base/test/params/MethodParamAnnotationRule.java
[add] https://crrev.com/629200a5bb428c36f4708f4191bc0d66c468bbda/base/test/android/javatests/src/org/chromium/base/test/params/MethodParamRule.java
[modify] https://crrev.com/629200a5bb428c36f4708f4191bc0d66c468bbda/base/test/android/javatests/src/org/chromium/base/test/params/ParameterAnnotations.java
[modify] https://crrev.com/629200a5bb428c36f4708f4191bc0d66c468bbda/base/test/android/junit/src/org/chromium/base/test/params/ExampleParameterizedTest.java
[modify] https://crrev.com/629200a5bb428c36f4708f4191bc0d66c468bbda/chrome/android/javatests/src/org/chromium/chrome/browser/suggestions/HomeSheetUiCaptureTest.java

Comment 2 by bauerb@chromium.org, Jan 22 2018

Status: Fixed (was: Started)

Sign in to add a comment