[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / components / metrics / log_decoder_unittest.cc
1 // Copyright 2020 The Chromium Authors
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 "components/metrics/log_decoder.h"
6
7 #include <string>
8
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/metrics_proto/chrome_user_metrics_extension.pb.h"
11 #include "third_party/zlib/google/compression_utils.h"
12
13 namespace metrics {
14
15 TEST(LogDecoderTest, DecodeLogDataToProto) {
16   ChromeUserMetricsExtension uma_log1;
17   uma_log1.mutable_system_profile()->set_application_locale("fr");
18
19   std::string log_data1;
20   ASSERT_TRUE(uma_log1.SerializeToString(&log_data1));
21   std::string compressed_log_data;
22   ASSERT_TRUE(compression::GzipCompress(log_data1, &compressed_log_data));
23
24   ChromeUserMetricsExtension uma_log2;
25   EXPECT_TRUE(DecodeLogDataToProto(compressed_log_data, &uma_log2));
26
27   std::string log_data2;
28   uma_log2.SerializeToString(&log_data2);
29   EXPECT_EQ(log_data1, log_data2);
30 }
31
32 }  // namespace metrics