mobile/android/tests/background/junit3/src/healthreport/MockDatabaseEnvironment.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 package org.mozilla.gecko.background.healthreport;
michael@0 5
michael@0 6 import org.mozilla.gecko.background.healthreport.HealthReportDatabaseStorage;
michael@0 7 import org.mozilla.gecko.background.healthreport.HealthReportDatabaseStorage.DatabaseEnvironment;
michael@0 8
michael@0 9 public class MockDatabaseEnvironment extends DatabaseEnvironment {
michael@0 10 public MockDatabaseEnvironment(HealthReportDatabaseStorage storage, Class<? extends EnvironmentAppender> appender) {
michael@0 11 super(storage, appender);
michael@0 12 }
michael@0 13
michael@0 14 public MockDatabaseEnvironment(HealthReportDatabaseStorage storage) {
michael@0 15 super(storage);
michael@0 16 }
michael@0 17
michael@0 18 public static class MockEnvironmentAppender extends EnvironmentAppender {
michael@0 19 public StringBuilder appended = new StringBuilder();
michael@0 20
michael@0 21 public MockEnvironmentAppender() {
michael@0 22 super();
michael@0 23 }
michael@0 24
michael@0 25 @Override
michael@0 26 public void append(String s) {
michael@0 27 appended.append(s);
michael@0 28 }
michael@0 29
michael@0 30 @Override
michael@0 31 public void append(int v) {
michael@0 32 appended.append(v);
michael@0 33 }
michael@0 34
michael@0 35 @Override
michael@0 36 public String toString() {
michael@0 37 return appended.toString();
michael@0 38 }
michael@0 39 }
michael@0 40
michael@0 41 public MockDatabaseEnvironment mockInit(String appVersion) {
michael@0 42 profileCreation = 1234;
michael@0 43 cpuCount = 2;
michael@0 44 memoryMB = 512;
michael@0 45
michael@0 46 isBlocklistEnabled = 1;
michael@0 47 isTelemetryEnabled = 1;
michael@0 48 extensionCount = 0;
michael@0 49 pluginCount = 0;
michael@0 50 themeCount = 0;
michael@0 51
michael@0 52 architecture = "";
michael@0 53 sysName = "";
michael@0 54 sysVersion = "";
michael@0 55 vendor = "";
michael@0 56 appName = "";
michael@0 57 appID = "";
michael@0 58 this.appVersion = appVersion;
michael@0 59 appBuildID = "";
michael@0 60 platformVersion = "";
michael@0 61 platformBuildID = "";
michael@0 62 os = "";
michael@0 63 xpcomabi = "";
michael@0 64 updateChannel = "";
michael@0 65
michael@0 66 // v2 fields.
michael@0 67 distribution = "";
michael@0 68 appLocale = "";
michael@0 69 osLocale = "";
michael@0 70 acceptLangSet = 0;
michael@0 71
michael@0 72 version = Environment.CURRENT_VERSION;
michael@0 73
michael@0 74 return this;
michael@0 75 }
michael@0 76 }

mercurial