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