Test: unit test passed.
Change-Id: I1879fc523cca9fc6c672332ab4ac383f21dc16fc
#define STATS_SERVICE_DIR "/data/system/stats-service"
-static StatsdConfig build_fake_config();
-
using android::base::StringPrintf;
using std::unique_ptr;
}
}
-static StatsdConfig build_fake_config() {
+StatsdConfig build_fake_config() {
// HACK: Hard code a test metric for counting screen on events...
StatsdConfig config;
config.set_name("CONFIG_12345");
using std::vector;
using std::pair;
+// Util function to Hard code a test metric for counting screen on events.
+StatsdConfig build_fake_config();
+
/**
* Keeps track of which configurations have been set from various sources.
*
// maps from ConditionTracker to MetricProducer
std::unordered_map<int, std::vector<int>> mConditionToMetricMap;
- bool mConfigValid;
+ bool mConfigValid = false;
};
} // namespace statsd
// limitations under the License.
#include "src/config/ConfigManager.h"
+#include "src/metrics/MetricsManager.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
return arg.name() == name;
}
+TEST(ConfigManagerTest, TestFakeConfig) {
+ auto metricsManager = std::make_unique<MetricsManager>(build_fake_config());
+ EXPECT_TRUE(metricsManager->isConfigValid());
+}
+
/**
* Test the addOrUpdate and remove methods
*/