// Copyright (c) 2012 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.

package org.chromium.content_shell;

import android.content.Context;
import android.os.PowerManager;
import android.test.suitebuilder.annotation.Smoke;

import org.chromium.base.test.util.Feature;

/**
 * Test that verifies preconditions for tests to run.
 */
public class ContentShellPreconditionsTest extends ContentShellTestBase {
    @Smoke
    @Feature({"TestInfrastructure"})
    public void testScreenIsOn() throws Exception {
        PowerManager pm = (PowerManager) getInstrumentation().getContext().getSystemService(
                Context.POWER_SERVICE);

        assertTrue("Many tests will fail if the screen is not on.", pm.isScreenOn());
    }
}

Add test that asserts screen is on.
[Android] Add test that asserts screen is on.

Lots of tests fail with seemingly random failures if the screen turns off. Add an explicit test for this so it's obvious why tests are failing.

BUG=167141

Review URL: https://chromiumcodereview.appspot.com/11642050

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@175538 0039d316-1c4b-4281-b951-d872f2087c98
