Flutter Engine
The Flutter Engine
logger_listener.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter 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 "flutter/testing/logger_listener.h"
6
7namespace flutter::testing {
8
10
12
14 const ::testing::TestInfo& test_info) {
15 FML_LOG(IMPORTANT) << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>";
16 FML_LOG(IMPORTANT) << "Starting Test: " << test_info.test_suite_name() << ":"
17 << test_info.name();
18}
19
20std::string TestStatusAsString(const ::testing::TestResult* result) {
21 if (result == nullptr) {
22 return "UNKNOWN";
23 }
24 if (result->Passed()) {
25 return "PASSED";
26 }
27 if (result->Skipped()) {
28 return "SKIPPED";
29 }
30 if (result->Failed()) {
31 return "FAILED";
32 }
33 return "UNKNOWN";
34}
35
36std::string TestLabel(const ::testing::TestInfo& info) {
37 return std::string{info.test_suite_name()} + "." + info.name();
38}
39
40std::string TestTimeAsString(const ::testing::TestResult* result) {
41 if (result == nullptr) {
42 return "UNKNOWN";
43 }
44 return std::to_string(result->elapsed_time()) + " ms";
45}
46
47void testing::LoggerListener::OnTestEnd(const ::testing::TestInfo& info) {
48 FML_LOG(IMPORTANT) << "Test " << TestStatusAsString(info.result()) << " ("
49 << TestTimeAsString(info.result())
50 << "): " << TestLabel(info);
51 FML_LOG(IMPORTANT) << "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";
52}
53
54void testing::LoggerListener::OnTestDisabled(const ::testing::TestInfo& info) {
55 FML_LOG(IMPORTANT) << "Test Disabled: " << TestLabel(info);
56}
57
58} // namespace flutter::testing
static void test_info(skiatest::Reporter *r, Codec *codec, const SkImageInfo &info, SkCodec::Result expectedResult, const SkMD5::Digest *goodDigest)
Definition: CodecTest.cpp:106
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
void OnTestDisabled(const ::testing::TestInfo &test_info) override
void OnTestStart(const ::testing::TestInfo &test_info) override
void OnTestEnd(const ::testing::TestInfo &test_info) override
GAsyncResult * result
#define FML_LOG(severity)
Definition: logging.h:82
std::string TestTimeAsString(const ::testing::TestResult *result)
std::string TestStatusAsString(const ::testing::TestResult *result)
std::string TestLabel(const ::testing::TestInfo &info)
static SkString to_string(int n)
Definition: nanobench.cpp:119