Commit 33e02e37 authored by danakj@chromium.org's avatar danakj@chromium.org

cc: Prevent unit tests from using Now() as the impl frame time.

Unit tests using FakeLayerTreeHostImpl should not use Now() as the
frame time, as this is racey/problematic. For instance it may not change
fast enough to let your test produce 2 outputs at different Now() times.

Re-enable 2 tests that were failing because of this problem in the test
harness.

R=enne, jbedley
BUG=393733

Review URL: https://codereview.chromium.org/444053004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288029 0039d316-1c4b-4281-b951-d872f2087c98
parent f3fcec39
......@@ -494,10 +494,6 @@ TEST_F(PictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
}
TEST_F(PictureLayerImplTest, InvalidViewportAfterReleaseResources) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
host_impl_.SetCurrentFrameTimeTicks(time_ticks);
gfx::Size tile_size(100, 100);
gfx::Size layer_bounds(400, 400);
......@@ -2764,10 +2760,6 @@ TEST_F(NoLowResPictureLayerImplTest, InvalidViewportForPrioritizingTiles) {
}
TEST_F(NoLowResPictureLayerImplTest, InvalidViewportAfterReleaseResources) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
host_impl_.SetCurrentFrameTimeTicks(time_ticks);
gfx::Size tile_size(100, 100);
gfx::Size layer_bounds(400, 400);
......@@ -3168,15 +3160,12 @@ class OcclusionTrackingPictureLayerImplTest : public PictureLayerImplTest {
}
};
#if defined(OS_WIN)
#define MAYBE_OccludedTilesSkippedDuringRasterization \
DISABLED_OccludedTilesSkippedDuringRasterization
#else
#define MAYBE_OccludedTilesSkippedDuringRasterization \
OccludedTilesSkippedDuringRasterization
#endif
TEST_F(OcclusionTrackingPictureLayerImplTest,
MAYBE_OccludedTilesSkippedDuringRasterization) {
OccludedTilesSkippedDuringRasterization) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
host_impl_.SetCurrentFrameTimeTicks(time_ticks);
gfx::Size tile_size(102, 102);
gfx::Size layer_bounds(1000, 1000);
gfx::Size viewport_size(500, 500);
......@@ -3219,6 +3208,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
layer1->SetContentsOpaque(true);
layer1->SetPosition(occluding_layer_position);
time_ticks += base::TimeDelta::FromMilliseconds(200);
host_impl_.SetCurrentFrameTimeTicks(time_ticks);
host_impl_.pending_tree()->UpdateDrawProperties();
unoccluded_tile_count = 0;
......@@ -3240,6 +3231,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
// Full occlusion.
layer1->SetPosition(gfx::Point(0, 0));
time_ticks += base::TimeDelta::FromMilliseconds(200);
host_impl_.SetCurrentFrameTimeTicks(time_ticks);
host_impl_.pending_tree()->UpdateDrawProperties();
unoccluded_tile_count = 0;
......@@ -3259,14 +3252,12 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
EXPECT_EQ(unoccluded_tile_count, 0);
}
#if defined(OS_WIN)
#define MAYBE_OccludedTilesNotMarkedAsRequired \
DISABLED_OccludedTilesNotMarkedAsRequired
#else
#define MAYBE_OccludedTilesNotMarkedAsRequired OccludedTilesNotMarkedAsRequired
#endif
TEST_F(OcclusionTrackingPictureLayerImplTest,
MAYBE_OccludedTilesNotMarkedAsRequired) {
OccludedTilesNotMarkedAsRequired) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
host_impl_.SetCurrentFrameTimeTicks(time_ticks);
gfx::Size tile_size(102, 102);
gfx::Size layer_bounds(1000, 1000);
gfx::Size viewport_size(500, 500);
......@@ -3314,6 +3305,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
layer1->SetContentsOpaque(true);
layer1->SetPosition(occluding_layer_position);
time_ticks += base::TimeDelta::FromMilliseconds(200);
host_impl_.SetCurrentFrameTimeTicks(time_ticks);
host_impl_.pending_tree()->UpdateDrawProperties();
for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) {
......@@ -3350,6 +3343,8 @@ TEST_F(OcclusionTrackingPictureLayerImplTest,
// Full occlusion.
layer1->SetPosition(gfx::PointF(0, 0));
time_ticks += base::TimeDelta::FromMilliseconds(200);
host_impl_.SetCurrentFrameTimeTicks(time_ticks);
host_impl_.pending_tree()->UpdateDrawProperties();
for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) {
......
......@@ -19,6 +19,10 @@ FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(Proxy* proxy,
// Explicitly clear all debug settings.
SetDebugState(LayerTreeDebugState());
SetViewportSize(gfx::Size(100, 100));
// Avoid using Now() as the frame time in unit tests.
base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1);
SetCurrentFrameTimeTicks(time_ticks);
}
FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
......@@ -32,6 +36,10 @@ FakeLayerTreeHostImpl::FakeLayerTreeHostImpl(const LayerTreeSettings& settings,
0) {
// Explicitly clear all debug settings.
SetDebugState(LayerTreeDebugState());
// Avoid using Now() as the frame time in unit tests.
base::TimeTicks time_ticks = base::TimeTicks::FromInternalValue(1);
SetCurrentFrameTimeTicks(time_ticks);
}
FakeLayerTreeHostImpl::~FakeLayerTreeHostImpl() {}
......
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