summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/providers/downloads/FakeSystemFacade.java
blob: 0f8a980131584a76fc373e1041875ac8216cfc1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.android.providers.downloads;

import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.ConnectivityManager;

import java.util.ArrayList;
import java.util.List;

public class FakeSystemFacade implements SystemFacade {
    long mTimeMillis = 0;
    Integer mActiveNetworkType = ConnectivityManager.TYPE_WIFI;
    boolean mIsRoaming = false;
    Integer mMaxBytesOverMobile = null;
    List<Intent> mBroadcastsSent = new ArrayList<Intent>();

    void incrementTimeMillis(long delta) {
        mTimeMillis += delta;
    }

    public long currentTimeMillis() {
        return mTimeMillis;
    }

    public Integer getActiveNetworkType() {
        return mActiveNetworkType;
    }

    public boolean isNetworkRoaming() {
        return mIsRoaming;
    }

    public Integer getMaxBytesOverMobile() {
        return mMaxBytesOverMobile ;
    }

    @Override
    public void sendBroadcast(Intent intent) {
        mBroadcastsSent.add(intent);
    }

    @Override
    public boolean userOwnsPackage(int uid, String pckg) throws NameNotFoundException {
        return true;
    }
}