| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 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.chrome.browser.offlinepages; | |
| 6 | |
| 7 import org.chromium.base.Callback; | |
| 8 import org.chromium.chrome.browser.offlinepages.interfaces.BackgroundSchedulerPr
ocessor; | |
| 9 | |
| 10 /** | |
| 11 * Custom stub for our own BackgroundSchedulerRequestProcessor. | |
| 12 */ | |
| 13 public class StubBackgroundSchedulerProcessor implements BackgroundSchedulerProc
essor { | |
| 14 private boolean mFailToStart; | |
| 15 private boolean mDidStartProcessing; | |
| 16 private DeviceConditions mDeviceConditions; | |
| 17 private Callback<Boolean> mCallback; | |
| 18 | |
| 19 public void setFailToStart(boolean failToStart) { | |
| 20 mFailToStart = failToStart; | |
| 21 } | |
| 22 | |
| 23 public boolean getDidStartProcessing() { | |
| 24 return mDidStartProcessing; | |
| 25 } | |
| 26 | |
| 27 public DeviceConditions getDeviceConditions() { | |
| 28 return mDeviceConditions; | |
| 29 } | |
| 30 | |
| 31 public void callback() { | |
| 32 mCallback.onResult(true); | |
| 33 } | |
| 34 | |
| 35 @Override | |
| 36 public boolean startScheduledProcessing( | |
| 37 DeviceConditions deviceConditions, Callback<Boolean> callback) { | |
| 38 if (mFailToStart) { | |
| 39 return false; | |
| 40 } | |
| 41 | |
| 42 mDidStartProcessing = true; | |
| 43 mDeviceConditions = deviceConditions; | |
| 44 mCallback = callback; | |
| 45 return true; | |
| 46 } | |
| 47 | |
| 48 @Override | |
| 49 public boolean stopScheduledProcessing() { | |
| 50 return true; | |
| 51 } | |
| 52 } | |
| OLD | NEW |