#include <algorithm>
#include <string>
#include <tuple>
#include "base/json/json_reader.h"
#include "base/strings/string_tokenizer.h"
#include "base/strings/stringprintf.h"
#include "base/test/trace_event_analyzer.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/media/webrtc/webrtc_browsertest_base.h"
#include "chrome/browser/media/webrtc/webrtc_browsertest_common.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/test/base/tracing.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "media/base/media_switches.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/perf/perf_test.h"
#include "third_party/blink/public/common/features.h"
#include "ui/gl/gl_switches.h"
TraceEvent;
TraceEventVector;
Query;
namespace {
static const char kStartRenderEventName[] = …;
static const char kEnqueueFrameEventName[] = …;
static const char kSetFrameEventName[] = …;
static const char kGetFrameEventName[] = …;
static const char kVideoResourceEventName[] = …;
static const char kVsyncEventName[] = …;
static const char kVideoFrameSubmitterEventName[] = …;
static const char kEventMatchKey[] = …;
static const char kTestResultString[] = …;
static const char kMainWebrtcTestHtmlPage[] = …;
struct VideoDisplayPerfTestConfig { … };
void CalculateMeanAndMax(const std::vector<double>& inputs,
double* mean,
double* std_dev,
double* max) { … }
void PrintMeanAndMax(const std::string& var_name,
const std::string& name_modifier,
const std::vector<double>& vars) { … }
void FindEvents(trace_analyzer::TraceAnalyzer* analyzer,
const std::string& event_name,
const Query& base_query,
TraceEventVector* events) { … }
void AssociateEvents(trace_analyzer::TraceAnalyzer* analyzer,
const std::vector<std::string>& event_names,
const std::string& match_string,
const Query& base_query) { … }
}
class WebRtcVideoDisplayPerfBrowserTest
: public WebRtcTestBase,
public testing::WithParamInterface<
std::tuple<gfx::Size ,
int ,
bool >> { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(WebRtcVideoDisplayPerfBrowserTest,
MANUAL_TestVideoDisplayPerfVP9) { … }
#if BUILDFLAG(RTC_USE_H264)
IN_PROC_BROWSER_TEST_P(WebRtcVideoDisplayPerfBrowserTest,
MANUAL_TestVideoDisplayPerfH264) {
if (!base::FeatureList::IsEnabled(
blink::features::kWebRtcH264WithOpenH264FFmpeg)) {
LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. "
"Skipping WebRtcVideoDisplayPerfBrowserTest.MANUAL_"
"TestVideoDisplayPerfH264 "
"(test \"OK\")";
return;
}
TestVideoDisplayPerf("H264");
}
#endif