#include "chrome/browser/tracing/chrome_tracing_delegate.h"
#include <string_view>
#include <utility>
#include "base/command_line.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_path_watcher.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/json/json_writer.h"
#include "base/run_loop.h"
#include "base/strings/pattern.h"
#include "base/test/bind.h"
#include "base/threading/thread_restrictions.h"
#include "base/trace_event/named_trigger.h"
#include "build/build_config.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/metrics/metrics_pref_names.h"
#include "components/prefs/pref_service.h"
#include "components/tracing/common/background_tracing_state_manager.h"
#include "components/tracing/common/pref_names.h"
#include "components/variations/variations_params_manager.h"
#include "content/public/browser/background_tracing_config.h"
#include "content/public/browser/background_tracing_manager.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/tracing_controller.h"
#include "content/public/test/background_tracing_test_support.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/test_utils.h"
#include "services/tracing/public/cpp/trace_startup_config.h"
#include "services/tracing/public/cpp/tracing_features.h"
namespace {
class TestBackgroundTracingHelper
: public content::BackgroundTracingManager::EnabledStateTestObserver { … };
}
namespace tracing {
class ChromeTracingDelegateBrowserTest : public InProcessBrowserTest { … };
std::string GetSessionStateJson() { … }
void SetSessionState(base::Value::Dict dict) { … }
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTest,
BackgroundTracingUnexpectedSessionEnd) { … }
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTest,
BackgroundTracingSessionRanLong) { … }
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTest,
BackgroundTracingFinalizationStarted) { … }
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTest,
ExistingIncognitoSessionBlockingTraceStart) { … }
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTest,
FinishedIncognitoSessionBlockingTraceStart) { … }
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTest,
NewIncognitoSessionBlockingTraceFinalization) { … }
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTest,
ShortIncognitoSessionBlockingTraceFinalization) { … }
namespace {
static const char* const kDefaultConfigText = …;
}
class ChromeTracingDelegateBrowserTestOnStartup
: public ChromeTracingDelegateBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup,
PRE_ScenarioSetFromFieldtrial) { … }
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup,
ScenarioSetFromFieldtrial) { … }
class ChromeTracingDelegateBrowserTestFromCommandLine
: public ChromeTracingDelegateBrowserTest { … };
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestFromCommandLine,
ScenarioFromCommandLine) { … }
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestFromCommandLine,
PRE_IgnoreThrottle) { … }
IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestFromCommandLine,
IgnoreThrottle) { … }
}