#include "chrome/browser/extensions/api/tab_capture/tab_capture_performance_test_base.h"
#include <stdint.h>
#include <cmath>
#include <string_view>
#include "base/base64.h"
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/tracing.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/common/content_features.h"
#include "content/public/test/browser_test_utils.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/common/extension.h"
#include "extensions/common/switches.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "sandbox/policy/features.h"
#include "third_party/zlib/google/compression_utils.h"
#include "ui/gl/gl_switches.h"
namespace {
constexpr std::string_view kFullPerformanceRunSwitch = …;
}
TabCapturePerformanceTestBase::TabCapturePerformanceTestBase() = default;
TabCapturePerformanceTestBase::~TabCapturePerformanceTestBase() = default;
void TabCapturePerformanceTestBase::SetUp() { … }
void TabCapturePerformanceTestBase::SetUpOnMainThread() { … }
void TabCapturePerformanceTestBase::SetUpCommandLine(
base::CommandLine* command_line) { … }
void TabCapturePerformanceTestBase::LoadExtension(
const base::FilePath& unpacked_dir) { … }
void TabCapturePerformanceTestBase::NavigateToTestPage(
const std::string& test_page_html_content) { … }
base::Value TabCapturePerformanceTestBase::SendMessageToExtension(
const std::string& json) { … }
TabCapturePerformanceTestBase::TraceAnalyzerUniquePtr
TabCapturePerformanceTestBase::TraceAndObserve(
const std::string& category_patterns,
const std::vector<std::string_view>& event_names,
int required_event_count) { … }
base::FilePath TabCapturePerformanceTestBase::GetApiTestDataDir() { … }
std::string TabCapturePerformanceTestBase::MakeBase64EncodedGZippedString(
const std::string& input) { … }
void TabCapturePerformanceTestBase::ContinueBrowserFor(
base::TimeDelta duration) { … }
void TabCapturePerformanceTestBase::QueryTraceEvents(
trace_analyzer::TraceAnalyzer* analyzer,
std::string_view event_name,
trace_analyzer::TraceEventVector* events) { … }
std::unique_ptr<net::test_server::HttpResponse>
TabCapturePerformanceTestBase::HandleRequest(
const net::test_server::HttpRequest& request) { … }
constexpr base::TimeDelta
TabCapturePerformanceTestBase::kFullRunObservationPeriod;
constexpr base::TimeDelta
TabCapturePerformanceTestBase::kQuickRunObservationPeriod;
constexpr base::TimeDelta
TabCapturePerformanceTestBase::kSendMessageRetryPeriod;
const char TabCapturePerformanceTestBase::kTestWebPageHostname[] = …;
const char TabCapturePerformanceTestBase::kTestWebPagePath[] = …;
const char TabCapturePerformanceTestBase::kExtensionId[] = …;