Commit 983b20a2 authored by Chan Li's avatar Chan Li Committed by Commit Bot

Revert "Use timeout to wait until there is no presentation callback."

This reverts commit a54e29af.

Reason for revert: This change breaks ash_unittests on Linux Chromium OS ASan LSan Tests (1) builder:
https://ci.chromium.org/p/chromium/builders/ci/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20%281%29/36800

Findit analysis:
https://findit-for-me.appspot.com/waterfall/failure?url=https://luci-milo.appspot.com/buildbot/chromium.memory/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20(1)/36800

Original change's description:
> Use timeout to wait until there is no presentation callback.
> 
> R=​yigu@chromium.org
> 
> Bug: 1043465
> Test: run 100 times and no flaky
> Change-Id: I64aef46f8f61a5bde32d678a91301f9ea9304b74
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2026508
> Reviewed-by: Jun Mukai <mukai@chromium.org>
> Commit-Queue: Mitsuru Oshima (slow in TOK) <oshima@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#736206}

TBR=mukai@chromium.org,oshima@chromium.org,yigu@chromium.org

Change-Id: I5294b8fcb958f02af01ab1e8bfb00358bf3b36e1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1043465
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2027897Reviewed-by: default avatarChan Li <chanli@chromium.org>
Commit-Queue: Chan Li <chanli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736415}
parent 122a9def
......@@ -6,9 +6,8 @@
#include "ash/test/ash_test_base.h"
#include "base/run_loop.h"
#include "base/test/bind_test_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "ui/aura/window.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/layer.h"
......@@ -23,33 +22,25 @@ using PresentationTimeRecorderTest = ash::AshTestBase;
constexpr char kName[] = "Histogram";
constexpr char kMaxLatencyName[] = "MaxLatency.Histogram";
TEST_F(PresentationTimeRecorderTest, Histogram) {
// The test is flaky on CrOS. crbug.com/1043465.
#if defined(OS_CHROMEOS)
#define MAYBE_Histogram DISABLED_Histogram
#else
#define MAYBE_Histogram Histogram
#endif
TEST_F(PresentationTimeRecorderTest, MAYBE_Histogram) {
base::HistogramTester histogram_tester;
auto* compositor = CurrentContext()->layer()->GetCompositor();
auto test_recorder = CreatePresentationTimeHistogramRecorder(
compositor, kName, kMaxLatencyName);
bool timeout = false;
// Flush pending draw callbask by waiting for presentation until it times out.
do {
std::unique_ptr<base::RunLoop> runloop = std::make_unique<base::RunLoop>();
compositor->RequestPresentationTimeForNextFrame(base::BindLambdaForTesting(
[&runloop](const gfx::PresentationFeedback& feedback) {
if (runloop)
runloop->Quit();
}));
base::OneShotTimer timer;
// We assume if the new frame wasn't generated for 100ms (6 frames worth
// time) there is no pending draw request.
timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(100),
base::BindLambdaForTesting([&runloop, &timeout]() {
if (runloop)
runloop->Quit();
timeout = true;
}));
runloop->Run();
timer.Stop();
} while (!timeout);
// Flush pending draw requests.
for (int i = 0; i < 30; i++) {
compositor->ScheduleFullRedraw();
WaitForNextFrameToBePresented(compositor);
base::RunLoop().RunUntilIdle();
}
compositor->ScheduleFullRedraw();
histogram_tester.ExpectTotalCount(kName, 0);
......
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