0

Move WebRTC logging tests out of //jingle

Move the tests to //components/webrtc_logging

Bug: 1287596, 843104, 1241660
Change-Id: Iad2efb0f5a417df1dde8a815eff7959f96a14209
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3389888
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: Elad Alon <eladalon@chromium.org>
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
Commit-Queue: Mirko Bonadei <mbonadei@chromium.org>
Cr-Commit-Position: refs/heads/main@{#960863}
This commit is contained in:
Sergey Ulanov
2022-01-19 09:47:38 +00:00
committed by Chromium LUCI CQ
parent de67a6ef94
commit 0e22a2ebab
11 changed files with 48 additions and 62 deletions

@ -354,6 +354,7 @@ test("components_unittests") {
"//components/webapps/browser:unit_tests",
"//components/webapps/services/web_app_origin_association:unit_tests",
"//components/webcrypto:unit_tests",
"//components/webrtc_logging:unit_tests",
"//components/webrtc_logging/browser:unit_tests",
"//components/webrtc_logging/common:unit_tests",
]

@ -0,0 +1,16 @@
# Copyright 2022 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("unit_tests") {
testonly = true
sources = [ "logging_unittest.cc" ]
deps = [
"//base",
"//testing/gmock",
"//testing/gtest",
"//third_party/webrtc_overrides:webrtc_component",
]
}

@ -0,0 +1,5 @@
specific_include_rules = {
'logging_unittest\.cc': [
"+third_party/webrtc_overrides",
]
}

@ -15,17 +15,17 @@
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
// The following include come before including logging.h. It ensures that
// libjingle style logging is used.
// The following #include come before including logging.h. It ensures that
// WebRTC-style logging is used.
#define LOGGING_INSIDE_WEBRTC
#include "build/build_config.h"
#include "third_party/webrtc_overrides/rtc_base/logging.h"
#if BUILDFLAG(IS_WIN)
static const wchar_t* const log_file_name = L"libjingle_logging.log";
static const wchar_t* const log_file_name = L"webrtc_logging.log";
#else
static const char* const log_file_name = "libjingle_logging.log";
static const char* const log_file_name = "webrtc_logging.log";
#endif
static const int kDefaultVerbosity = 0;
@ -76,7 +76,15 @@ static bool Initialize(int verbosity_level) {
return true;
}
TEST(LibjingleLogTest, DefaultConfiguration) {
// LibjingleLogTest fail on Android (crbug.com/843104) and Fuchsia
// (crbug.com/1241660).
#if defined(OS_ANDROID) || defined(OS_FUCHSIA)
#define MAYBE_WebRtcTextLogTest DISABLED_WebRtcTextLogTest
#else
#define MAYBE_WebRtcTextLogTest WebRtcTextLogTest
#endif
TEST(MAYBE_WebRtcTextLogTest, DefaultConfiguration) {
ASSERT_TRUE(Initialize(kDefaultVerbosity));
// In the default configuration only warnings and errors should be logged.
@ -95,13 +103,11 @@ TEST(LibjingleLogTest, DefaultConfiguration) {
EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_ERROR)));
EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_WARNING)));
EXPECT_FALSE(ContainsString(contents_of_file, AsString(rtc::LS_INFO)));
EXPECT_FALSE(ContainsString(contents_of_file,
AsString(rtc::LS_VERBOSE)));
EXPECT_FALSE(ContainsString(contents_of_file,
AsString(rtc::LS_SENSITIVE)));
EXPECT_FALSE(ContainsString(contents_of_file, AsString(rtc::LS_VERBOSE)));
EXPECT_FALSE(ContainsString(contents_of_file, AsString(rtc::LS_SENSITIVE)));
}
TEST(LibjingleLogTest, InfoConfiguration) {
TEST(MAYBE_WebRtcTextLogTest, InfoConfiguration) {
ASSERT_TRUE(Initialize(0)); // 0 == Chrome's 'info' level.
// In this configuration everything lower or equal to LS_INFO should be
@ -119,13 +125,10 @@ TEST(LibjingleLogTest, InfoConfiguration) {
// Make sure string contains the expected values.
EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_ERROR)));
EXPECT_TRUE(ContainsString(contents_of_file,
AsString(rtc::LS_WARNING)));
EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_WARNING)));
EXPECT_FALSE(ContainsString(contents_of_file, AsString(rtc::LS_INFO)));
EXPECT_FALSE(ContainsString(contents_of_file,
AsString(rtc::LS_VERBOSE)));
EXPECT_FALSE(ContainsString(contents_of_file,
AsString(rtc::LS_SENSITIVE)));
EXPECT_FALSE(ContainsString(contents_of_file, AsString(rtc::LS_VERBOSE)));
EXPECT_FALSE(ContainsString(contents_of_file, AsString(rtc::LS_SENSITIVE)));
// Also check that the log is proper.
EXPECT_TRUE(ContainsString(contents_of_file, "logging_unittest.cc"));
@ -133,7 +136,7 @@ TEST(LibjingleLogTest, InfoConfiguration) {
EXPECT_FALSE(ContainsString(contents_of_file, "logging.cc"));
}
TEST(LibjingleLogTest, LogEverythingConfiguration) {
TEST(MAYBE_WebRtcTextLogTest, LogEverythingConfiguration) {
ASSERT_TRUE(Initialize(2)); // verbosity at level 2 allows LS_SENSITIVE.
// In this configuration everything should be logged.
@ -141,8 +144,8 @@ TEST(LibjingleLogTest, LogEverythingConfiguration) {
RTC_LOG_V(rtc::LS_WARNING) << AsString(rtc::LS_WARNING);
RTC_LOG(LS_INFO) << AsString(rtc::LS_INFO);
static const int kFakeError = 1;
RTC_LOG_E(LS_INFO, EN, kFakeError) << "RTC_LOG_E(" << AsString(rtc::LS_INFO)
<< ")";
RTC_LOG_E(LS_INFO, EN, kFakeError)
<< "RTC_LOG_E(" << AsString(rtc::LS_INFO) << ")";
RTC_LOG_V(rtc::LS_VERBOSE) << AsString(rtc::LS_VERBOSE);
RTC_LOG_V(rtc::LS_SENSITIVE) << AsString(rtc::LS_SENSITIVE);
@ -153,13 +156,10 @@ TEST(LibjingleLogTest, LogEverythingConfiguration) {
// Make sure string contains the expected values.
EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_ERROR)));
EXPECT_TRUE(ContainsString(contents_of_file,
AsString(rtc::LS_WARNING)));
EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_WARNING)));
EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_INFO)));
// RTC_LOG_E
EXPECT_TRUE(ContainsString(contents_of_file, strerror(kFakeError)));
EXPECT_TRUE(ContainsString(contents_of_file,
AsString(rtc::LS_VERBOSE)));
EXPECT_TRUE(ContainsString(contents_of_file,
AsString(rtc::LS_SENSITIVE)));
EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_VERBOSE)));
EXPECT_TRUE(ContainsString(contents_of_file, AsString(rtc::LS_SENSITIVE)));
}

@ -31,16 +31,10 @@ source_set("webrtc_glue") {
test("jingle_unittests") {
sources = [
"glue/fake_ssl_client_socket_unittest.cc",
"glue/logging_unittest.cc",
"glue/thread_wrapper_unittest.cc",
"run_all_unittests.cc",
]
if (is_android) {
# LibjingleLogTest don't pass on Android (crbug.com/843104).
sources -= [ "glue/logging_unittest.cc" ]
}
deps = [
":webrtc_glue",
"//base",

@ -9489,9 +9489,6 @@
"test_id_prefix": "ninja://ipc:ipc_tests/"
},
{
"args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.jingle_unittests.filter"
],
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
@ -11099,9 +11096,6 @@
"test_id_prefix": "ninja://ipc:ipc_tests/"
},
{
"args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.jingle_unittests.filter"
],
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"

@ -18922,7 +18922,6 @@
},
{
"args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.jingle_unittests.filter",
"--ram-size-mb=16384",
"--code-coverage",
"--code-coverage-dir=${ISOLATED_OUTDIR}"
@ -20111,9 +20110,6 @@
"test_id_prefix": "ninja://ipc:ipc_tests/"
},
{
"args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.jingle_unittests.filter"
],
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
@ -21351,7 +21347,6 @@
},
{
"args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.jingle_unittests.filter",
"--device=aemu"
],
"merge": {
@ -22741,9 +22736,6 @@
"test_id_prefix": "ninja://ipc:ipc_tests/"
},
{
"args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.jingle_unittests.filter"
],
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
@ -24034,9 +24026,6 @@
"test_id_prefix": "ninja://ipc:ipc_tests/"
},
{
"args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.jingle_unittests.filter"
],
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"

@ -2466,9 +2466,6 @@
"test_id_prefix": "ninja://ipc:ipc_tests/"
},
{
"args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.jingle_unittests.filter"
],
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"
@ -3719,9 +3716,6 @@
"test_id_prefix": "ninja://ipc:ipc_tests/"
},
{
"args": [
"--test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.jingle_unittests.filter"
],
"merge": {
"args": [],
"script": "//testing/merge_scripts/standard_gtest_merge.py"

@ -188,7 +188,6 @@ source_set("fuchsia_filters") {
"//testing/buildbot/filters/fuchsia.debug.snapshot_unittests.filter",
"//testing/buildbot/filters/fuchsia.debug.views_unittests.filter",
"//testing/buildbot/filters/fuchsia.headless_browsertests.filter",
"//testing/buildbot/filters/fuchsia.jingle_unittests.filter",
"//testing/buildbot/filters/fuchsia.net_perftests.filter",
"//testing/buildbot/filters/fuchsia.services_unittests.filter",
"//testing/buildbot/filters/fuchsia.storage_unittests.filter",

@ -1,2 +0,0 @@
# https://crbug.com/1241660
-LibjingleLogTest.*

@ -1698,11 +1698,7 @@
],
},
'ipc_tests': {},
'jingle_unittests': {
'args': [
'--test-launcher-filter-file=../../testing/buildbot/filters/fuchsia.jingle_unittests.filter',
],
},
'jingle_unittests': {},
'latency_unittests': {},
'media_unittests': {},
'midi_unittests': {},