Commit fc50c147 authored by Yuri Wiitala's avatar Yuri Wiitala

performance_browser_tests: Add temporary logging to RCR freezes.

TBR=sullivan@chromium.org

Bug: 906656
Change-Id: I6eb1c8604b8dc6307fde4df09bfbe7c2918aeb8a
Reviewed-on: https://chromium-review.googlesource.com/c/1343062Reviewed-by: default avatarYuri Wiitala <miu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609542}
parent 42fe4045
...@@ -348,7 +348,9 @@ class TestPatternReceiver : public media::cast::InProcessReceiver { ...@@ -348,7 +348,9 @@ class TestPatternReceiver : public media::cast::InProcessReceiver {
class CastV2PerformanceTest : public extensions::ExtensionApiTest, class CastV2PerformanceTest : public extensions::ExtensionApiTest,
public testing::WithParamInterface<int> { public testing::WithParamInterface<int> {
public: public:
CastV2PerformanceTest() {} CastV2PerformanceTest() { LOG(ERROR) << __func__ << ": Hello!"; }
~CastV2PerformanceTest() override { LOG(ERROR) << __func__ << ": Goodbye!"; }
bool HasFlag(TestFlags flag) const { bool HasFlag(TestFlags flag) const {
return (GetParam() & flag) == flag; return (GetParam() & flag) == flag;
...@@ -397,13 +399,23 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest, ...@@ -397,13 +399,23 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest,
} }
void SetUp() override { void SetUp() override {
LOG(ERROR) << __func__ << ": Starting...";
EnablePixelOutput(); EnablePixelOutput();
if (!HasFlag(kUseGpu)) if (!HasFlag(kUseGpu))
UseSoftwareCompositing(); UseSoftwareCompositing();
LOG(ERROR) << __func__ << ": Doing normal SetUp()...";
extensions::ExtensionApiTest::SetUp(); extensions::ExtensionApiTest::SetUp();
LOG(ERROR) << __func__ << ": Completed.";
}
void SetUpOnMainThread() override {
LOG(ERROR) << __func__ << ": Doing normal SetUpOnMainThread()...";
extensions::ExtensionApiTest::SetUpOnMainThread();
LOG(ERROR) << __func__ << ": Completed.";
} }
void SetUpCommandLine(base::CommandLine* command_line) override { void SetUpCommandLine(base::CommandLine* command_line) override {
LOG(ERROR) << __func__ << ": Starting...";
// Some of the tests may launch http requests through JSON or AJAX // Some of the tests may launch http requests through JSON or AJAX
// which causes a security error (cross domain request) when the page // which causes a security error (cross domain request) when the page
// is loaded from the local file system ( file:// ). The following switch // is loaded from the local file system ( file:// ). The following switch
...@@ -423,7 +435,9 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest, ...@@ -423,7 +435,9 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest,
extensions::switches::kWhitelistedExtensionID, extensions::switches::kWhitelistedExtensionID,
kExtensionId); kExtensionId);
LOG(ERROR) << __func__ << ": Doing normal SetUpCommandLine()...";
extensions::ExtensionApiTest::SetUpCommandLine(command_line); extensions::ExtensionApiTest::SetUpCommandLine(command_line);
LOG(ERROR) << __func__ << ": Completed.";
} }
void GetTraceEvents(trace_analyzer::TraceAnalyzer* analyzer, void GetTraceEvents(trace_analyzer::TraceAnalyzer* analyzer,
...@@ -605,6 +619,8 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest, ...@@ -605,6 +619,8 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest,
} }
void RunTest(const std::string& test_name) { void RunTest(const std::string& test_name) {
LOG(ERROR) << __func__ << ": Starting...";
if (HasFlag(kUseGpu) && !IsGpuAvailable()) { if (HasFlag(kUseGpu) && !IsGpuAvailable()) {
LOG(WARNING) << LOG(WARNING) <<
"Test skipped: requires gpu. Pass --enable-gpu on the command " "Test skipped: requires gpu. Pass --enable-gpu on the command "
...@@ -618,6 +634,8 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest, ...@@ -618,6 +634,8 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest,
(HasFlag(k60fps) ? 1 : 0)); (HasFlag(k60fps) ? 1 : 0));
net::IPEndPoint receiver_end_point = media::cast::test::GetFreeLocalPort(); net::IPEndPoint receiver_end_point = media::cast::test::GetFreeLocalPort();
LOG(ERROR) << __func__ << ": Got local UDP port for testing: "
<< receiver_end_point.ToString();
// Start the in-process receiver that examines audio/video for the expected // Start the in-process receiver that examines audio/video for the expected
// test patterns. // test patterns.
...@@ -632,8 +650,10 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest, ...@@ -632,8 +650,10 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest,
new SkewedCastEnvironment(delta)); new SkewedCastEnvironment(delta));
TestPatternReceiver* const receiver = TestPatternReceiver* const receiver =
new TestPatternReceiver(cast_environment, receiver_end_point); new TestPatternReceiver(cast_environment, receiver_end_point);
LOG(ERROR) << __func__ << ": Starting receiver...";
receiver->Start(); receiver->Start();
LOG(ERROR) << __func__ << ": Creating UDPProxy...";
std::unique_ptr<media::cast::test::UDPProxy> udp_proxy; std::unique_ptr<media::cast::test::UDPProxy> udp_proxy;
if (HasFlag(kProxyWifi) || HasFlag(kProxySlow) || HasFlag(kProxyBad)) { if (HasFlag(kProxyWifi) || HasFlag(kProxySlow) || HasFlag(kProxyBad)) {
net::IPEndPoint proxy_end_point = media::cast::test::GetFreeLocalPort(); net::IPEndPoint proxy_end_point = media::cast::test::GetFreeLocalPort();
...@@ -656,6 +676,7 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest, ...@@ -656,6 +676,7 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest,
receiver_end_point = proxy_end_point; receiver_end_point = proxy_end_point;
} }
LOG(ERROR) << __func__ << ": Starting tracing...";
std::string json_events; std::string json_events;
ASSERT_TRUE(tracing::BeginTracing("gpu.capture,cast_perf_test")); ASSERT_TRUE(tracing::BeginTracing("gpu.capture,cast_perf_test"));
const std::string page_url = base::StringPrintf( const std::string page_url = base::StringPrintf(
...@@ -664,13 +685,18 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest, ...@@ -664,13 +685,18 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest,
HasFlag(kAutoThrottling) ? "true" : "false", HasFlag(kAutoThrottling) ? "true" : "false",
base::HexEncode(kAesKey, sizeof(kAesKey)).c_str(), base::HexEncode(kAesKey, sizeof(kAesKey)).c_str(),
base::HexEncode(kAesIvMask, sizeof(kAesIvMask)).c_str()); base::HexEncode(kAesIvMask, sizeof(kAesIvMask)).c_str());
LOG(ERROR) << __func__ << ": Running extension subtest...";
ASSERT_TRUE(RunExtensionSubtest("cast_streaming", page_url)) << message_; ASSERT_TRUE(RunExtensionSubtest("cast_streaming", page_url)) << message_;
LOG(ERROR) << __func__ << ": Extension subtest finished. Ending tracing...";
ASSERT_TRUE(tracing::EndTracing(&json_events)); ASSERT_TRUE(tracing::EndTracing(&json_events));
LOG(ERROR) << __func__ << ": Stopping receiver...";
receiver->Stop(); receiver->Stop();
// Stop all threads, removes the need for synchronization when analyzing // Stop all threads, removes the need for synchronization when analyzing
// the data. // the data.
LOG(ERROR) << __func__ << ": Shutting-down CastEnvironment...";
cast_environment->Shutdown(); cast_environment->Shutdown();
LOG(ERROR) << __func__ << ": Analyzing...";
std::unique_ptr<trace_analyzer::TraceAnalyzer> analyzer; std::unique_ptr<trace_analyzer::TraceAnalyzer> analyzer;
analyzer.reset(trace_analyzer::TraceAnalyzer::Create(json_events)); analyzer.reset(trace_analyzer::TraceAnalyzer::Create(json_events));
analyzer->AssociateAsyncBeginEndEvents(); analyzer->AssociateAsyncBeginEndEvents();
...@@ -690,13 +716,16 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest, ...@@ -690,13 +716,16 @@ class CastV2PerformanceTest : public extensions::ExtensionApiTest,
receiver->Analyze(test_name, GetSuffixForTestFlags()); receiver->Analyze(test_name, GetSuffixForTestFlags());
AnalyzeLatency(test_name, analyzer.get()); AnalyzeLatency(test_name, analyzer.get());
LOG(ERROR) << __func__ << ": Completed.";
} }
}; };
} // namespace } // namespace
IN_PROC_BROWSER_TEST_P(CastV2PerformanceTest, Performance) { IN_PROC_BROWSER_TEST_P(CastV2PerformanceTest, Performance) {
LOG(ERROR) << __func__ << ": Test procedure started.";
RunTest("CastV2Performance"); RunTest("CastV2Performance");
LOG(ERROR) << __func__ << ": Completed.";
} }
// Note: First argument is optional and intentionally left blank. // Note: First argument is optional and intentionally left blank.
......
...@@ -4,8 +4,12 @@ ...@@ -4,8 +4,12 @@
// Run a cast v2 mirroring session for 15 seconds. // Run a cast v2 mirroring session for 15 seconds.
console.log('Starting eval of performance.js...');
chrome.test.runTests([ chrome.test.runTests([
function sendTestPatterns() { function sendTestPatterns() {
console.log('Starting sendTestPatterns()...');
const kMaxFrameRate = 30; const kMaxFrameRate = 30;
const kCallbackTimeoutMillis = 10000; const kCallbackTimeoutMillis = 10000;
const kTestRunTimeMillis = 15000; const kTestRunTimeMillis = 15000;
...@@ -51,7 +55,9 @@ chrome.test.runTests([ ...@@ -51,7 +55,9 @@ chrome.test.runTests([
} }
} }
}; };
console.log('About to call chrome.tabCapture.capture()...');
chrome.tabCapture.capture(captureOptions, captureStream => { chrome.tabCapture.capture(captureOptions, captureStream => {
console.log('chrome.tabCapture.capture() callback is running...');
clearTimeout(timeoutId); clearTimeout(timeoutId);
if (captureStream) { if (captureStream) {
console.log('Started tab capture.'); console.log('Started tab capture.');
...@@ -69,16 +75,19 @@ chrome.test.runTests([ ...@@ -69,16 +75,19 @@ chrome.test.runTests([
// Then, start Cast Streaming and wait up to kCallbackTimeoutMillis for it // Then, start Cast Streaming and wait up to kCallbackTimeoutMillis for it
// to start. // to start.
const startStreamingPromise = startCapturePromise.then(captureStream => { const startStreamingPromise = startCapturePromise.then(captureStream => {
console.log('Starting streaming...');
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const timeoutId = setTimeout(() => { const timeoutId = setTimeout(() => {
reject(Error( reject(Error(
'chrome.cast.streaming.session.create() did not call back')); 'chrome.cast.streaming.session.create() did not call back'));
}, kCallbackTimeoutMillis); }, kCallbackTimeoutMillis);
console.log('Creating cast streaming session...');
chrome.cast.streaming.session.create( chrome.cast.streaming.session.create(
captureStream.getAudioTracks()[0], captureStream.getAudioTracks()[0],
captureStream.getVideoTracks()[0], captureStream.getVideoTracks()[0],
(audioId, videoId, udpId) => { (audioId, videoId, udpId) => {
console.log('Cast streaming session create callback is running...');
clearTimeout(timeoutId); clearTimeout(timeoutId);
try { try {
...@@ -114,6 +123,7 @@ chrome.test.runTests([ ...@@ -114,6 +123,7 @@ chrome.test.runTests([
console.log(`Running test for ${kTestRunTimeMillis} ms.`); console.log(`Running test for ${kTestRunTimeMillis} ms.`);
setTimeout(resolve, kTestRunTimeMillis); setTimeout(resolve, kTestRunTimeMillis);
}).then(() => { }).then(() => {
console.log('Stopping cast streaming...');
rtpStream.stop(audioId); rtpStream.stop(audioId);
rtpStream.stop(videoId); rtpStream.stop(videoId);
rtpStream.destroy(audioId); rtpStream.destroy(audioId);
...@@ -121,6 +131,7 @@ chrome.test.runTests([ ...@@ -121,6 +131,7 @@ chrome.test.runTests([
chrome.cast.streaming.udpTransport.destroy(udpId); chrome.cast.streaming.udpTransport.destroy(udpId);
console.log('Stopping tab capture (MediaStreamTracks)...');
const tracks = captureStream.getTracks(); const tracks = captureStream.getTracks();
for (let i = 0; i < tracks.length; ++i) { for (let i = 0; i < tracks.length; ++i) {
tracks[i].stop(); tracks[i].stop();
...@@ -131,7 +142,9 @@ chrome.test.runTests([ ...@@ -131,7 +142,9 @@ chrome.test.runTests([
// If all of the above completed without error, the test run has succeeded. // If all of the above completed without error, the test run has succeeded.
// Otherwise, flag that the test has failed with the cause. // Otherwise, flag that the test has failed with the cause.
doneTestingPromise.then(() => { doneTestingPromise.then(() => {
console.log('About to chrome.test.succeed()...');
chrome.test.succeed(); chrome.test.succeed();
console.log('Did chrome.test.succeed()...');
}).catch(error => { }).catch(error => {
if (typeof error === 'object' && if (typeof error === 'object' &&
('stack' in error || 'message' in error)) { ('stack' in error || 'message' in error)) {
...@@ -140,5 +153,9 @@ chrome.test.runTests([ ...@@ -140,5 +153,9 @@ chrome.test.runTests([
chrome.test.fail(String(error)); chrome.test.fail(String(error));
} }
}); });
console.log('Completed sendTestPatterns(). (Waiting for promises...)');
} }
]); ]);
console.log('Completed eval of performance.js.');
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment