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

Unified Diff: content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellPreconditionsTest.java

Issue 2632043002: Create ContentShellActivityTestRule and BaseJUnitRunner (Closed)
Patch Set: Change javadoc Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellPreconditionsTest.java
diff --git a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellPreconditionsTest.java b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellPreconditionsTest.java
index 21495fc1ddc195188d8bd31901da206b822a8a10..ab3f7987cb01c9eee190a8db5b48b1480df20c14 100644
--- a/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellPreconditionsTest.java
+++ b/content/shell/android/javatests/src/org/chromium/content_shell_apk/ContentShellPreconditionsTest.java
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,26 +8,34 @@ import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.PowerManager;
+import android.support.test.InstrumentationRegistry;
import android.support.test.filters.MediumTest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Feature;
/**
* Test that verifies preconditions for tests to run.
*/
-public class ContentShellPreconditionsTest extends ContentShellTestBase {
+@RunWith(BaseJUnit4ClassRunner.class)
+public class ContentShellPreconditionsTest {
+ @Test
@TargetApi(Build.VERSION_CODES.KITKAT_WATCH)
@SuppressWarnings("deprecation")
@MediumTest
@Feature({"TestInfrastructure"})
public void testScreenIsOn() throws Exception {
- PowerManager pm = (PowerManager) getInstrumentation().getContext().getSystemService(
+ PowerManager pm = (PowerManager) InstrumentationRegistry.getContext().getSystemService(
Context.POWER_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
- assertTrue("Many tests will fail if the screen is not on.", pm.isInteractive());
+ Assert.assertTrue("Many tests will fail if the screen is not on.", pm.isInteractive());
} else {
- assertTrue("Many tests will fail if the screen is not on.", pm.isScreenOn());
+ Assert.assertTrue("Many tests will fail if the screen is not on.", pm.isScreenOn());
}
}
}

Powered by Google App Engine
This is Rietveld 408576698