chromium/chrome/test/base/memory_tracing_browsertest.cc

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/test/base/tracing.h"

#include "base/allocator/buildflags.h"
#include "base/command_line.h"
#include "base/location.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/trace_config_memory_test_util.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

MemoryDumpDeterminism;
MemoryDumpManager;
MemoryDumpType;
BeginTracingWithTraceConfig;
EndTracing;

void RequestGlobalDumpCallback(base::OnceClosure quit_closure,
                               bool success,
                               uint64_t) {}

void OnStartTracingDoneCallback(
    base::trace_event::MemoryDumpLevelOfDetail explicit_dump_type,
    base::OnceClosure quit_closure) {}

class MemoryTracingBrowserTest : public InProcessBrowserTest {};

// TODO(crbug.com/41367720): Disabled due to excessive output on lsan bots and
// timeouts on debug bots.
#if defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || !defined(NDEBUG)
#define MAYBE_TestMemoryInfra
#else
#define MAYBE_TestMemoryInfra
#endif
IN_PROC_BROWSER_TEST_F(MemoryTracingBrowserTest, MAYBE_TestMemoryInfra) {}

// crbug.com/808152: This test is flakily failing on LSAN. This test also
// flakily fails with timeout on Linux debug.
#if defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || !defined(NDEBUG)
#define MAYBE_TestBackgroundMemoryInfra
#else
#define MAYBE_TestBackgroundMemoryInfra
#endif
IN_PROC_BROWSER_TEST_F(MemoryTracingBrowserTest,
                       MAYBE_TestBackgroundMemoryInfra) {}

}  // namespace