Index: components/precache/android/javatests/src/org/chromium/components/precache/MockDeviceState.java |
diff --git a/components/precache/android/javatests/src/org/chromium/components/precache/MockDeviceState.java b/components/precache/android/javatests/src/org/chromium/components/precache/MockDeviceState.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..61f601fc6f38de9a7dc7875a7f3fc3db6b33205e |
--- /dev/null |
+++ b/components/precache/android/javatests/src/org/chromium/components/precache/MockDeviceState.java |
@@ -0,0 +1,45 @@ |
+// Copyright 2015 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.components.precache; |
+ |
+import android.content.Context; |
+ |
+/** |
+ * Mock of the DeviceState class. |
+ */ |
+public class MockDeviceState extends DeviceState { |
+ private final int mStickyBatteryStatus; |
+ private final boolean mPowerIsConnected; |
+ private final boolean mInteractive; |
+ private final boolean mWifiIsAvailable; |
+ |
+ public MockDeviceState(int stickyBatteryStatus, boolean powerIsConnected, |
+ boolean interactive, boolean wifiIsAvailable) { |
+ mStickyBatteryStatus = stickyBatteryStatus; |
+ mPowerIsConnected = powerIsConnected; |
+ mInteractive = interactive; |
+ mWifiIsAvailable = wifiIsAvailable; |
+ } |
+ |
+ @Override |
+ int getStickyBatteryStatus(Context context) { |
+ return mStickyBatteryStatus; |
+ } |
+ |
+ @Override |
+ public boolean isPowerConnected(Context context) { |
+ return mPowerIsConnected; |
+ } |
+ |
+ @Override |
+ public boolean isInteractive(Context context) { |
+ return mInteractive; |
+ } |
+ |
+ @Override |
+ public boolean isWifiAvailable(Context context) { |
+ return mWifiIsAvailable; |
+ } |
+} |