Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / content / shell / android / javatests / src / org / chromium / content_shell_apk / ContentShellPreconditionsTest.java
1 // Copyright 2012 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.content_shell_apk;
6
7 import android.annotation.TargetApi;
8 import android.content.Context;
9 import android.os.Build;
10 import android.os.PowerManager;
11 import android.test.suitebuilder.annotation.Smoke;
12
13 import org.chromium.base.test.util.Feature;
14
15 /**
16  * Test that verifies preconditions for tests to run.
17  */
18 public class ContentShellPreconditionsTest extends ContentShellTestBase {
19     @TargetApi(Build.VERSION_CODES.KITKAT_WATCH)
20     @SuppressWarnings("deprecation")
21     @Smoke
22     @Feature({"TestInfrastructure"})
23     public void testScreenIsOn() throws Exception {
24         PowerManager pm = (PowerManager) getInstrumentation().getContext().getSystemService(
25                 Context.POWER_SERVICE);
26
27         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
28             assertTrue("Many tests will fail if the screen is not on.", pm.isInteractive());
29         } else {
30             assertTrue("Many tests will fail if the screen is not on.", pm.isScreenOn());
31         }
32     }
33 }