1 // Copyright 2014 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.cronet_sample_apk; 6 7 import android.content.Context; 8 import android.os.PowerManager; 9 import android.test.suitebuilder.annotation.Smoke; 10 11 import org.chromium.base.test.util.Feature; 12 13 /** 14 * Test that verifies preconditions for tests to run. 15 */ 16 public class CronetSamplePreconditionsTest extends CronetSampleTestBase { 17 @Smoke 18 @Feature({"TestInfrastructure"}) 19 public void testScreenIsOn() throws Exception { 20 PowerManager pm = (PowerManager)getInstrumentation().getContext() 21 .getSystemService(Context.POWER_SERVICE); 22 23 assertTrue("Many tests will fail if the screen is not on.", 24 pm.isScreenOn()); 25 } 26 } 27