Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: base/test/android/javatests/src/org/chromium/base/test/SetUpStatement.java

Issue 2770393002: Add setup action interface (Closed)
Patch Set: Move SetUpStatement to its own file Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.base.test;
6
7 import org.junit.rules.TestRule;
8 import org.junit.runners.model.Statement;
9
10 /**
11 * Custom Statement for SetUpTestRules.
12 *
13 * The statment calls {@link SetUpTestRule#setUp} before test run based on
jbudorick 2017/04/10 19:08:45 rephrase: Calls {@link SetUpTestRule.setUp()} befo
the real yoland 2017/04/12 00:52:34 Done
14 * {@link SetUpTestRule#shouldSetUp} argument
15 */
16 public class SetUpStatement extends Statement {
17 private final Statement mBase;
18 private final SetUpTestRule<? extends TestRule> mSetUpTestRule;
19 private final boolean mShouldSetUp;
20
21 public SetUpStatement(
22 final Statement base, SetUpTestRule<? extends TestRule> callback, bo olean shouldSetUp) {
23 mBase = base;
24 mSetUpTestRule = callback;
25 mShouldSetUp = shouldSetUp;
26 }
27
28 @Override
29 public void evaluate() throws Throwable {
30 if (mShouldSetUp) {
31 mSetUpTestRule.setUp();
32 }
33 mBase.evaluate();
34 }
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698