metricsd: Fix unit tests.

When logging, libchrome will extract the program's name from the command
line. If the command line helpers have not been initialized, the logging
call will fail and the program will abort.

BUG: 24262190
TEST: unit tests.

Change-Id: Ie7982d5491f8373dc06ba44b69b518ff8673b568
This commit is contained in:
Bertrand SIMONNET 2015-09-21 11:11:59 -07:00
parent 71f878f89b
commit dc034771cd

View file

@ -25,6 +25,7 @@
#include <base/files/scoped_temp_dir.h>
#include <base/strings/string_number_conversions.h>
#include <base/strings/stringprintf.h>
#include <chromeos/flag_helper.h>
#include <gtest/gtest.h>
#include "constants.h"
@ -60,6 +61,7 @@ class MetricsDaemonTest : public testing::Test {
std::string kFakeDiskStats1;
virtual void SetUp() {
chromeos::FlagHelper::Init(0, nullptr, "");
EXPECT_TRUE(temp_dir_.CreateUniqueTempDir());
scaling_max_freq_path_ = temp_dir_.path().Append("scaling_max");
cpu_max_freq_path_ = temp_dir_.path().Append("cpu_freq_max");