#include <stddef.h>
#include <cstdio>
#include <unordered_map>
#include <utility>
#include <vector>
#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
#include "components/viz/service/debugger/viz_debugger.h"
#include "components/viz/service/debugger/viz_debugger_unittests/viz_debugger_internal.h"
#include "components/viz/service/debugger/viz_debugger_unittests/viz_debugger_unittest_base.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/skia/include/core/SkAlphaType.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/vector2d_f.h"
#if VIZ_DEBUGGER_IS_ON()
_;
Mock;
namespace viz {
namespace {
static_assert …;
class VisualDebuggerTest : public VisualDebuggerTestBase { … };
TEST_F(VisualDebuggerTest, GeneralDrawSubmission) { … }
static void FunctionNameTest(const char* anno_rect, gfx::RectF rect) { … }
TEST_F(VisualDebuggerTest, FilterDrawSubmission) { … }
constexpr const char kTestFlagFunctionAnnoName[] = …;
DBG_FLAG_FBOOL(kTestFlagFunctionAnnoName, check_flag_enabled)
static bool FlagFunctionTestEnable() { … }
TEST_F(VisualDebuggerTest, TestDebugFlagAnnoAndFunction) { … }
TEST_F(VisualDebuggerTest, NonFilterActiveNoCost) { … }
TEST_F(VisualDebuggerTest, SingleBufferSync) { … }
TEST_F(VisualDebuggerTest, MultipleBuffersSync) { … }
TEST_F(VisualDebuggerTest, SingleBufferAsync) { … }
TEST_F(VisualDebuggerTest, MultipleBuffersAsync) { … }
}
}
#else
class VisualDebuggerTest : public testing::Test {};
DBG_FLAG_FBOOL("unit.test.fake.anno", flag_default_value_check)
TEST_F(VisualDebuggerTest, TestDebugFlagAnnoAndFunction) {
EXPECT_FALSE(viz::VizDebugger::GetInstance()->IsEnabled());
EXPECT_FALSE(flag_default_value_check());
}
TEST_F(VisualDebuggerTest, DefaultDisabledNoExecute) {
const char* kStrA = "anno_A";
int count_a = 0;
auto get_a_string = [&count_a, &kStrA]() {
count_a++;
return std::string(kStrA);
};
DBG_DRAW_TEXT(kStrA, gfx::Point(), get_a_string());
DBG_LOG(kStrA, "%s", get_a_string().c_str());
EXPECT_EQ(0, count_a);
EXPECT_EQ(get_a_string(), kStrA);
EXPECT_EQ(1, count_a);
}
static_assert(flag_default_value_check() == false,
"Default value when debugger is disabled is false.");
#endif