1// Copyright (c) 2013 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#include "base/logging.h" 6 7#include "compat/string.h" 8#include "compat/test.h" 9#include "conversion_utils.h" 10#include "perf_test_files.h" 11#include "scoped_temp_path.h" 12#include "test_utils.h" 13 14namespace quipper { 15 16class PerfFile : public ::testing::TestWithParam<const char*> {}; 17 18TEST_P(PerfFile, TextOutput) { 19 ScopedTempDir output_dir; 20 ASSERT_FALSE(output_dir.path().empty()); 21 const string output_path = output_dir.path(); 22 23 const string test_file = GetParam(); 24 25 FormatAndFile input, output; 26 27 input.filename = GetTestInputFilePath(test_file); 28 input.format = kPerfFormat; 29 output.filename = output_path + test_file + ".pb_text"; 30 output.format = kProtoTextFormat; 31 EXPECT_TRUE(ConvertFile(input, output)); 32 33 string golden_file = GetTestInputFilePath(string(test_file) + ".pb_text"); 34 LOG(INFO) << "golden: " << golden_file; 35 LOG(INFO) << "output: " << output.filename; 36 37 CompareTextProtoFiles<PerfDataProto>(output.filename, golden_file); 38} 39 40INSTANTIATE_TEST_CASE_P( 41 ConversionUtilsTest, PerfFile, 42 ::testing::ValuesIn(perf_test_files::GetPerfDataFiles())); 43} // namespace quipper 44