lin
2025-08-01 633231e833e21d5b8b1c00cb15aedb62b3b78e8f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
 
#include "base/logging.h"
 
#include "compat/string.h"
#include "compat/test.h"
#include "conversion_utils.h"
#include "perf_test_files.h"
#include "scoped_temp_path.h"
#include "test_utils.h"
 
namespace quipper {
 
class PerfFile : public ::testing::TestWithParam<const char*> {};
 
TEST_P(PerfFile, TextOutput) {
  ScopedTempDir output_dir;
  ASSERT_FALSE(output_dir.path().empty());
  const string output_path = output_dir.path();
 
  const string test_file = GetParam();
 
  FormatAndFile input, output;
 
  input.filename = GetTestInputFilePath(test_file);
  input.format = kPerfFormat;
  output.filename = output_path + test_file + ".pb_text";
  output.format = kProtoTextFormat;
  EXPECT_TRUE(ConvertFile(input, output));
 
  string golden_file = GetTestInputFilePath(string(test_file) + ".pb_text");
  LOG(INFO) << "golden: " << golden_file;
  LOG(INFO) << "output: " << output.filename;
 
  CompareTextProtoFiles<PerfDataProto>(output.filename, golden_file);
}
 
INSTANTIATE_TEST_CASE_P(
    ConversionUtilsTest, PerfFile,
    ::testing::ValuesIn(perf_test_files::GetPerfDataFiles()));
}  // namespace quipper