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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/test/ClearAppDataTestRule.java

Issue 2962893002: Add a JUnit test rule for clearing app data prior to testing. (Closed)
Patch Set: . Created 3 years, 5 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
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.chrome.browser.test;
6
7 import android.content.Context;
8
9 import org.junit.rules.TestRule;
10 import org.junit.runner.Description;
11 import org.junit.runners.model.Statement;
12
13 import org.chromium.chrome.test.util.ApplicationData;
14
15 /**
16 * JUnit test rule that just clears app data before each test. Having this as a rule allows us
17 * to ensure the order it's executed in with something like RuleChain, allowing us to execute it
18 * prior to launching the browser process.
19 */
20 public class ClearAppDataTestRule implements TestRule {
21 Context mContext;
22
23 public ClearAppDataTestRule(Context context) {
24 mContext = context;
25 }
26
27 @Override
28 public Statement apply(final Statement base, Description description) {
29 return new Statement() {
30 @Override
31 public void evaluate() throws Throwable {
32 ApplicationData.clearAppData(mContext);
33 }
34 };
35 }
36 }
OLDNEW
« no previous file with comments | « chrome/android/java_sources.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698