| 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..596e3c66fff0b54bd1909786fd594c479310aaae 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,39 @@ 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.Rule;
|
| +import org.junit.Test;
|
| +import org.junit.rules.TestRule;
|
| +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 {
|
| + @Rule
|
| + public TestRule mActivityTestRule = new ContentShellActivityTestRule();
|
| +
|
| + @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());
|
| }
|
| }
|
| }
|
|
|