1// Copyright (c) 2011 The Chromium OS 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#ifndef LIBBRILLO_BRILLO_TEST_HELPERS_H_
6#define LIBBRILLO_BRILLO_TEST_HELPERS_H_
7
8#include "gtest/gtest.h"
9
10#include <string>
11
12#include <base/command_line.h>
13#include <base/files/file_path.h>
14#include <base/files/file_util.h>
15#include <base/logging.h>
16
17#include "brillo/syslog_logging.h"
18
19inline void ExpectFileEquals(const char* golden, const char* file_path) {
20  std::string contents;
21  EXPECT_TRUE(base::ReadFileToString(base::FilePath(file_path), &contents));
22  EXPECT_EQ(golden, contents);
23}
24
25inline void SetUpTests(int* argc, char** argv, bool log_to_stderr) {
26  base::CommandLine::Init(*argc, argv);
27  ::brillo::InitLog(log_to_stderr ? brillo::kLogToStderr : 0);
28  ::brillo::LogToString(true);
29  ::testing::InitGoogleTest(argc, argv);
30}
31
32#endif  // LIBBRILLO_BRILLO_TEST_HELPERS_H_
33