#include "third_party/khronos/GLES2/gl2ext.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "ui/gfx/frame_time.h"
-#include "ui/gfx/point_conversions.h"
-#include "ui/gfx/size_conversions.h"
-#include "ui/gfx/vector2d_conversions.h"
+#include "ui/gfx/geometry/point_conversions.h"
+#include "ui/gfx/geometry/size_conversions.h"
+#include "ui/gfx/geometry/vector2d_conversions.h"
using testing::_;
using testing::AnyNumber;
public:
LayerTreeHostTestSetNeedsCommit1() : num_commits_(0), num_draws_(0) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
PostSetNeedsCommitToMainThread();
PostSetNeedsCommitToMainThread();
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
num_draws_++;
if (!impl->active_tree()->source_frame_number())
EndTest();
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
num_commits_++;
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_LE(1, num_commits_);
EXPECT_LE(1, num_draws_);
}
public:
LayerTreeHostTestSetNeedsCommit2() : num_commits_(0), num_draws_(0) {}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- ++num_draws_;
- }
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override { ++num_draws_; }
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
++num_commits_;
switch (num_commits_) {
case 1:
}
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_EQ(2, num_commits_);
EXPECT_LE(1, num_draws_);
}
// Verify that we pass property values in PushPropertiesTo.
class LayerTreeHostTestPushPropertiesTo : public LayerTreeHostTest {
protected:
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
scoped_refptr<Layer> root = Layer::Create();
root->SetBounds(gfx::Size(10, 10));
layer_tree_host()->SetRootLayer(root);
DONE,
};
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
index_ = STARTUP;
PostSetNeedsCommitToMainThread();
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
VerifyAfterValues(impl->active_tree()->root_layer());
}
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
SetBeforeValues(layer_tree_host()->root_layer());
VerifyBeforeValues(layer_tree_host()->root_layer());
SetAfterValues(layer_tree_host()->root_layer());
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
void VerifyBeforeValues(Layer* layer) {
EXPECT_EQ(gfx::Size(10, 10).ToString(), layer->bounds().ToString());
public:
LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
EXPECT_EQ(0, impl->active_tree()->source_frame_number());
if (!num_draws_) {
// Redraw again to verify that the second redraw doesn't commit.
num_draws_++;
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
EXPECT_EQ(0, num_draws_);
num_commits_++;
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_GE(2, num_draws_);
EXPECT_EQ(1, num_commits_);
}
invalid_rect_(10, 10, 20, 20),
root_layer_(ContentLayer::Create(&client_)) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
root_layer_->SetIsDrawable(true);
root_layer_->SetBounds(bounds_);
layer_tree_host()->SetRootLayer(root_layer_);
PostSetNeedsCommitToMainThread();
}
- virtual DrawResult PrepareToDrawOnThread(
- LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame_data,
- DrawResult draw_result) OVERRIDE {
+ DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame_data,
+ DrawResult draw_result) override {
EXPECT_EQ(DRAW_SUCCESS, draw_result);
gfx::RectF root_damage_rect;
return draw_result;
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
if (!num_draws_) {
PostSetNeedsRedrawRectToMainThread(invalid_rect_);
} else {
num_draws_++;
}
- virtual void AfterTest() OVERRIDE { EXPECT_EQ(2, num_draws_); }
+ void AfterTest() override { EXPECT_EQ(2, num_draws_); }
private:
int num_draws_;
class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
public:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->layer_transforms_should_scale_layer_contents = true;
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_layer_ = Layer::Create();
root_layer_->SetBounds(gfx::Size(10, 20));
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
if (host_impl->active_tree()->source_frame_number() == 1)
EndTest();
}
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
switch (layer_tree_host()->source_frame_number()) {
case 1:
// Changing the device scale factor causes a commit. It also changes
}
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_EQ(gfx::Size(4, 4).ToString(),
scaled_layer_->content_bounds().ToString());
}
class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate
: public LayerTreeHostTest {
public:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->layer_transforms_should_scale_layer_contents = true;
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_layer_ = Layer::Create();
root_layer_->SetBounds(gfx::Size(10, 20));
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
if (host_impl->active_tree()->source_frame_number() == 1)
EndTest();
}
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
switch (layer_tree_host()->source_frame_number()) {
case 1:
// Changing the device scale factor causes a commit. It also changes
}
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_EQ(gfx::Size(40, 40).ToString(),
scrollbar_->content_bounds().ToString());
}
invalid_rect_(10, 10, 20, 20),
root_layer_(ContentLayer::Create(&client_)) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
root_layer_->SetIsDrawable(true);
root_layer_->SetBounds(bounds_);
layer_tree_host()->SetRootLayer(root_layer_);
PostSetNeedsCommitToMainThread();
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
if (num_draws_ == 3 && host_impl->settings().impl_side_painting)
host_impl->SetNeedsRedrawRect(invalid_rect_);
}
- virtual DrawResult PrepareToDrawOnThread(
- LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame_data,
- DrawResult draw_result) OVERRIDE {
+ DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame_data,
+ DrawResult draw_result) override {
EXPECT_EQ(DRAW_SUCCESS, draw_result);
gfx::RectF root_damage_rect;
return draw_result;
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
switch (num_draws_) {
case 0:
case 1:
num_draws_++;
}
- virtual void AfterTest() OVERRIDE { EXPECT_EQ(5, num_draws_); }
+ void AfterTest() override { EXPECT_EQ(5, num_draws_); }
private:
int num_draws_;
scoped_refptr<ContentLayer> root_layer_;
};
-SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw);
+SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(
+ LayerTreeHostTestSetNextCommitForcesRedraw);
// Tests that if a layer is not drawn because of some reason in the parent then
// its damage is preserved until the next time it is drawn.
LayerTreeHostTestUndrawnLayersDamageLater()
: root_layer_(ContentLayer::Create(&client_)) {}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_layer_->SetIsDrawable(true);
root_layer_->SetBounds(gfx::Size(50, 50));
layer_tree_host()->SetRootLayer(root_layer_);
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual DrawResult PrepareToDrawOnThread(
- LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame_data,
- DrawResult draw_result) OVERRIDE {
+ DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame_data,
+ DrawResult draw_result) override {
EXPECT_EQ(DRAW_SUCCESS, draw_result);
gfx::RectF root_damage_rect;
return draw_result;
}
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
switch (layer_tree_host()->source_frame_number()) {
case 1:
// Test not owning the surface.
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
FakeContentLayerClient client_;
LayerTreeHostTestUndrawnLayersPushContentBoundsLater()
: root_layer_(Layer::Create()) {}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_layer_->SetIsDrawable(true);
root_layer_->SetBounds(gfx::Size(20, 20));
layer_tree_host()->SetRootLayer(root_layer_);
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
LayerImpl* root = host_impl->active_tree()->root_layer();
LayerImpl* parent = root->children()[0];
LayerImpl* child = parent->children()[0];
}
}
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
switch (layer_tree_host()->source_frame_number()) {
case 1:
parent_layer_->SetOpacity(1.0f);
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
scoped_refptr<Layer> root_layer_;
public:
LayerTreeHostTestCommit() {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
layer_tree_host()->SetViewportSize(gfx::Size(20, 20));
layer_tree_host()->set_background_color(SK_ColorGRAY);
PostSetNeedsCommitToMainThread();
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
EXPECT_EQ(gfx::Size(20, 20), impl->DrawViewportSize());
EXPECT_EQ(SK_ColorGRAY, impl->active_tree()->background_color());
EndTest();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
};
MULTI_THREAD_TEST_F(LayerTreeHostTestCommit);
LayerTreeHostTestFrameTimeUpdatesAfterActivationFails()
: frame_count_with_pending_tree_(0) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
layer_tree_host()->SetViewportSize(gfx::Size(20, 20));
layer_tree_host()->set_background_color(SK_ColorGRAY);
PostSetNeedsCommitToMainThread();
}
- virtual void BeginCommitOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void BeginCommitOnThread(LayerTreeHostImpl* impl) override {
EXPECT_EQ(frame_count_with_pending_tree_, 0);
- impl->BlockNotifyReadyToActivateForTesting(true);
+ if (impl->settings().impl_side_painting)
+ impl->BlockNotifyReadyToActivateForTesting(true);
}
- virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* impl,
- const BeginFrameArgs& args) OVERRIDE {
+ void WillBeginImplFrameOnThread(LayerTreeHostImpl* impl,
+ const BeginFrameArgs& args) override {
if (impl->pending_tree())
frame_count_with_pending_tree_++;
if (frame_count_with_pending_tree_ == 1) {
EXPECT_EQ(first_frame_time_.ToInternalValue(), 0);
first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time;
- } else if (frame_count_with_pending_tree_ == 2) {
+ } else if (frame_count_with_pending_tree_ == 2 &&
+ impl->settings().impl_side_painting) {
impl->BlockNotifyReadyToActivateForTesting(false);
}
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
if (frame_count_with_pending_tree_ > 1) {
EXPECT_NE(first_frame_time_.ToInternalValue(), 0);
EXPECT_NE(first_frame_time_.ToInternalValue(),
EXPECT_FALSE(impl->settings().impl_side_painting);
EndTest();
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
if (impl->settings().impl_side_painting)
EXPECT_NE(frame_count_with_pending_tree_, 1);
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
int frame_count_with_pending_tree_;
base::TimeTicks first_frame_time_;
};
-SINGLE_AND_MULTI_THREAD_TEST_F(
+SINGLE_AND_MULTI_THREAD_BLOCKNOTIFY_TEST_F(
LayerTreeHostTestFrameTimeUpdatesAfterActivationFails);
// This test verifies that LayerTreeHostImpl's current frame time gets
public:
LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
layer_tree_host()->SetViewportSize(gfx::Size(20, 20));
layer_tree_host()->set_background_color(SK_ColorGRAY);
PostSetNeedsCommitToMainThread();
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
frame_++;
if (frame_ == 1) {
first_frame_time_ = impl->CurrentBeginFrameArgs().frame_time;
EndTest();
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
// Ensure there isn't a commit between the two draws, to ensure that a
// commit isn't required for updating the current frame time. We can
// only check for this in the multi-threaded case, since in the single-
EXPECT_EQ(0, frame_);
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
int frame_;
public:
LayerTreeHostTestStartPageScaleAnimation() {}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
LayerTreeHostTest::SetupTree();
if (layer_tree_host()->settings().impl_side_painting) {
scroll_layer_->SetIsContainerForFixedPositionLayers(true);
scroll_layer_->SetBounds(gfx::Size(2 * root_layer->bounds().width(),
2 * root_layer->bounds().height()));
- scroll_layer_->SetScrollOffset(gfx::Vector2d());
+ scroll_layer_->SetScrollOffset(gfx::ScrollOffset());
layer_tree_host()->root_layer()->AddChild(scroll_layer_);
// This test requires the page_scale and inner viewport layers to be
// identified.
layer_tree_host()->SetPageScaleFactorAndLimits(1.f, 0.5f, 2.f);
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta,
- float scale,
- float) OVERRIDE {
- gfx::Vector2d offset = scroll_layer_->scroll_offset();
- scroll_layer_->SetScrollOffset(offset + scroll_delta);
+ void ApplyViewportDeltas(const gfx::Vector2d& scroll_delta,
+ float scale,
+ float) override {
+ gfx::ScrollOffset offset = scroll_layer_->scroll_offset();
+ scroll_layer_->SetScrollOffset(ScrollOffsetWithDelta(offset,
+ scroll_delta));
layer_tree_host()->SetPageScaleFactorAndLimits(scale, 0.5f, 2.f);
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
// We get one commit before the first draw, and the animation doesn't happen
// until the second draw.
switch (impl->active_tree()->source_frame_number()) {
}
}
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
switch (layer_tree_host()->source_frame_number()) {
case 1:
layer_tree_host()->StartPageScaleAnimation(
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
FakeContentLayerClient client_;
scoped_refptr<Layer> scroll_layer_;
public:
LayerTreeHostTestSetVisible() : num_draws_(0) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
PostSetNeedsCommitToMainThread();
PostSetVisibleToMainThread(false);
// This is suppressed while we're invisible.
PostSetVisibleToMainThread(true);
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
EXPECT_TRUE(impl->visible());
++num_draws_;
EndTest();
}
- virtual void AfterTest() OVERRIDE { EXPECT_EQ(1, num_draws_); }
+ void AfterTest() override { EXPECT_EQ(1, num_draws_); }
private:
int num_draws_;
void SetTestLayer(Layer* test_layer) { test_layer_ = test_layer; }
- virtual void PaintContents(
+ void PaintContents(
SkCanvas* canvas,
const gfx::Rect& clip,
- ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE {
+ ContentLayerClient::GraphicsContextStatus gc_status) override {
// Set layer opacity to 0.
if (test_layer_)
test_layer_->SetOpacity(0.f);
}
- virtual void DidChangeLayerCanUseLCDText() OVERRIDE {}
- virtual bool FillsBoundsCompletely() const OVERRIDE { return false; }
+ void DidChangeLayerCanUseLCDText() override {}
+ bool FillsBoundsCompletely() const override { return false; }
private:
Layer* test_layer_;
int PaintContentsCount() { return paint_contents_count_; }
void ResetPaintContentsCount() { paint_contents_count_ = 0; }
- virtual bool Update(ResourceUpdateQueue* queue,
- const OcclusionTracker<Layer>* occlusion) OVERRIDE {
+ bool Update(ResourceUpdateQueue* queue,
+ const OcclusionTracker<Layer>* occlusion) override {
bool updated = ContentLayer::Update(queue, occlusion);
paint_contents_count_++;
return updated;
SetBounds(gfx::Size(10, 10));
SetIsDrawable(true);
}
- virtual ~ContentLayerWithUpdateTracking() {}
+ ~ContentLayerWithUpdateTracking() override {}
int paint_contents_count_;
};
test_opacity_change_delegate_.SetTestLayer(update_check_layer_.get());
}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
layer_tree_host()->root_layer()->AddChild(update_check_layer_);
PostSetNeedsCommitToMainThread();
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- EndTest();
- }
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override { EndTest(); }
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
// Update() should have been called once.
EXPECT_EQ(1, update_check_layer_->PaintContentsCount());
}
return make_scoped_refptr(new NoScaleContentLayer(client));
}
- virtual void CalculateContentsScale(float ideal_contents_scale,
- float* contents_scale_x,
- float* contents_scale_y,
- gfx::Size* contentBounds) OVERRIDE {
+ void CalculateContentsScale(float ideal_contents_scale,
+ float* contents_scale_x,
+ float* contents_scale_y,
+ gfx::Size* contentBounds) override {
// Skip over the ContentLayer's method to the base Layer class.
Layer::CalculateContentsScale(ideal_contents_scale,
contents_scale_x,
private:
explicit NoScaleContentLayer(ContentLayerClient* client)
: ContentLayer(client) {}
- virtual ~NoScaleContentLayer() {}
+ ~NoScaleContentLayer() override {}
};
class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers
: root_layer_(NoScaleContentLayer::Create(&client_)),
child_layer_(ContentLayer::Create(&client_)) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
layer_tree_host()->SetViewportSize(gfx::Size(60, 60));
layer_tree_host()->SetDeviceScaleFactor(1.5);
EXPECT_EQ(gfx::Size(60, 60), layer_tree_host()->device_viewport_size());
PostSetNeedsCommitToMainThread();
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
// Should only do one commit.
EXPECT_EQ(0, impl->active_tree()->source_frame_number());
// Device scale factor should come over to impl.
EndTest();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
FakeContentLayerClient client_;
// Verify atomicity of commits and reuse of textures.
class LayerTreeHostTestDirectRendererAtomicCommit : public LayerTreeHostTest {
public:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->texture_id_allocation_chunk_size = 1;
// Make sure partial texture updates are turned off.
settings->max_partial_texture_updates = 0;
settings->scrollbar_animator = LayerTreeSettings::NoAnimator;
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
layer_ = FakeContentLayer::Create(&client_);
layer_->SetBounds(gfx::Size(10, 20));
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
drew_frame_ = -1;
PostSetNeedsCommitToMainThread();
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates);
TestWebGraphicsContext3D* context = TestContext();
}
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
TestWebGraphicsContext3D* context = TestContext();
if (drew_frame_ == impl->active_tree()->source_frame_number()) {
PostSetNeedsCommitToMainThread();
}
- virtual void Layout() OVERRIDE {
+ void Layout() override {
layer_->SetNeedsDisplay();
scrollbar_->SetNeedsDisplay();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
protected:
FakeContentLayerClient client_;
class LayerTreeHostTestDelegatingRendererAtomicCommit
: public LayerTreeHostTestDirectRendererAtomicCommit {
public:
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates);
TestWebGraphicsContext3D* context = TestContext();
class LayerTreeHostTestAtomicCommitWithPartialUpdate
: public LayerTreeHostTest {
public:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->texture_id_allocation_chunk_size = 1;
// Allow one partial texture update.
settings->max_partial_texture_updates = 1;
settings->impl_side_painting = false;
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
parent_ = FakeContentLayer::Create(&client_);
parent_->SetBounds(gfx::Size(10, 20));
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
switch (layer_tree_host()->source_frame_number()) {
case 1:
parent_->SetNeedsDisplay();
break;
case 2:
// Damage part of layers.
- parent_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f));
- child_->SetNeedsDisplayRect(gfx::RectF(0.f, 0.f, 5.f, 5.f));
+ parent_->SetNeedsDisplayRect(gfx::Rect(5, 5));
+ child_->SetNeedsDisplayRect(gfx::Rect(5, 5));
break;
case 3:
child_->SetNeedsDisplay();
}
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
ASSERT_EQ(1u, layer_tree_host()->settings().max_partial_texture_updates);
TestWebGraphicsContext3D* context = TestContext();
}
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
EXPECT_LT(impl->active_tree()->source_frame_number(), 5);
TestWebGraphicsContext3D* context = TestContext();
context->ResetUsedTextures();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
FakeContentLayerClient client_;
class LayerTreeHostTestSurfaceNotAllocatedForLayersOutsideMemoryLimit
: public LayerTreeHostTest {
protected:
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_layer_ = FakeContentLayer::Create(&client_);
root_layer_->SetBounds(gfx::Size(100, 100));
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
Renderer* renderer = host_impl->renderer();
RenderPassId surface1_render_pass_id = host_impl->active_tree()
->root_layer()
}
}
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
if (layer_tree_host()->source_frame_number() < 2)
root_layer_->SetNeedsDisplay();
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_LE(2u, root_layer_->update_count());
EXPECT_LE(2u, surface_layer1_->update_count());
EXPECT_LE(2u, surface_layer2_->update_count());
return make_scoped_refptr(new EvictionTestLayer());
}
- virtual bool Update(ResourceUpdateQueue*,
- const OcclusionTracker<Layer>*) OVERRIDE;
- virtual bool DrawsContent() const OVERRIDE { return true; }
+ bool Update(ResourceUpdateQueue*, const OcclusionTracker<Layer>*) override;
+ bool DrawsContent() const override { return true; }
- virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
- OVERRIDE;
- virtual void PushPropertiesTo(LayerImpl* impl) OVERRIDE;
- virtual void SetTexturePriorities(const PriorityCalculator&) OVERRIDE;
+ scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
+ void PushPropertiesTo(LayerImpl* impl) override;
+ void SetTexturePriorities(const PriorityCalculator&) override;
bool HaveBackingTexture() const {
return texture_.get() ? texture_->have_backing_texture() : false;
private:
EvictionTestLayer() : Layer() {}
- virtual ~EvictionTestLayer() {}
+ ~EvictionTestLayer() override {}
void CreateTextureIfNeeded() {
if (texture_)
int id) {
return make_scoped_ptr(new EvictionTestLayerImpl(tree_impl, id));
}
- virtual ~EvictionTestLayerImpl() {}
+ ~EvictionTestLayerImpl() override {}
- virtual void AppendQuads(RenderPass* render_pass,
- const OcclusionTracker<LayerImpl>& occlusion_tracker,
- AppendQuadsData* append_quads_data) OVERRIDE {
+ void AppendQuads(RenderPass* render_pass,
+ const Occlusion& occlusion_in_content_space,
+ AppendQuadsData* append_quads_data) override {
ASSERT_TRUE(has_texture_);
ASSERT_NE(0u, layer_tree_impl()->resource_provider()->num_resources());
}
scoped_ptr<LayerImpl> EvictionTestLayer::CreateLayerImpl(
LayerTreeImpl* tree_impl) {
- return EvictionTestLayerImpl::Create(tree_impl, layer_id_)
- .PassAs<LayerImpl>();
+ return EvictionTestLayerImpl::Create(tree_impl, layer_id_);
}
void EvictionTestLayer::PushPropertiesTo(LayerImpl* layer_impl) {
impl_for_evict_textures_(0),
num_commits_(0) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
layer_tree_host()->SetRootLayer(layer_);
layer_tree_host()->SetViewportSize(gfx::Size(10, 20));
// the beginFrame/commit pair.
// Commits 5+6 test the path where an eviction happens during the eviction
// recovery path.
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
switch (num_commits_) {
case 1:
EXPECT_TRUE(layer_->HaveBackingTexture());
}
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
impl_for_evict_textures_ = impl;
}
- virtual void Layout() OVERRIDE {
+ void Layout() override {
++num_commits_;
switch (num_commits_) {
case 1:
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
FakeContentLayerClient client_;
LayerTreeHostTestContinuousInvalidate()
: num_commit_complete_(0), num_draw_layers_(0) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
layer_tree_host()->SetViewportSize(gfx::Size(10, 10));
layer_tree_host()->root_layer()->SetBounds(gfx::Size(10, 10));
PostSetNeedsCommitToMainThread();
}
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
if (num_draw_layers_ == 2)
return;
content_layer_->SetNeedsDisplay();
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
if (num_draw_layers_ == 1)
num_commit_complete_++;
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
num_draw_layers_++;
if (num_draw_layers_ == 2)
EndTest();
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
// Check that we didn't commit twice between first and second draw.
EXPECT_EQ(1, num_commit_complete_);
}
LayerTreeHostTestDeferCommits()
: num_commits_deferred_(0), num_complete_commits_(0) {}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidDeferCommit() OVERRIDE {
+ void DidDeferCommit() override {
num_commits_deferred_++;
layer_tree_host()->SetDeferCommits(false);
}
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
num_complete_commits_++;
switch (num_complete_commits_) {
case 1:
}
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_EQ(1, num_commits_deferred_);
EXPECT_EQ(2, num_complete_commits_);
}
LayerTreeHostWithProxy(FakeLayerTreeHostClient* client,
const LayerTreeSettings& settings,
scoped_ptr<FakeProxy> proxy)
- : LayerTreeHost(client, NULL, settings) {
+ : LayerTreeHost(client, NULL, NULL, settings) {
proxy->SetLayerTreeHost(this);
client->SetLayerTreeHost(this);
- InitializeForTesting(proxy.PassAs<Proxy>());
+ InitializeForTesting(proxy.Pass());
}
};
LayerTreeHost::CreateSingleThreaded(&client,
&client,
shared_bitmap_manager.get(),
+ NULL,
settings,
base::MessageLoopProxy::current());
client.SetLayerTreeHost(host.get());
LayerTreeHost::CreateSingleThreaded(&client,
&client,
shared_bitmap_manager.get(),
+ NULL,
settings,
base::MessageLoopProxy::current());
client.SetLayerTreeHost(host.get());
LayerTreeHost::CreateSingleThreaded(&client,
&client,
shared_bitmap_manager.get(),
+ NULL,
settings,
base::MessageLoopProxy::current());
client.SetLayerTreeHost(host.get());
LayerTreeHost::CreateSingleThreaded(&client,
&client,
shared_bitmap_manager.get(),
+ NULL,
settings,
base::MessageLoopProxy::current());
client.SetLayerTreeHost(host.get());
child_layer2_(FakeContentLayer::Create(&client_)),
num_commits_(0) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
layer_tree_host()->SetViewportSize(gfx::Size(100, 100));
root_layer_->SetBounds(gfx::Size(100, 100));
child_layer1_->SetBounds(gfx::Size(100, 100));
PostSetNeedsCommitToMainThread();
}
- virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl,
- bool visible) OVERRIDE {
+ void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl,
+ bool visible) override {
if (visible) {
// One backing should remain unevicted.
EXPECT_EQ(
EndTest();
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
++num_commits_;
switch (num_commits_) {
case 1:
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
FakeContentLayerClient client_;
int paint_count() const { return paint_count_; }
int lcd_notification_count() const { return lcd_notification_count_; }
- virtual void PaintContents(
+ void PaintContents(
SkCanvas* canvas,
const gfx::Rect& clip,
- ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE {
+ ContentLayerClient::GraphicsContextStatus gc_status) override {
++paint_count_;
}
- virtual void DidChangeLayerCanUseLCDText() OVERRIDE {
+ void DidChangeLayerCanUseLCDText() override {
++lcd_notification_count_;
layer_->SetNeedsDisplay();
}
- virtual bool FillsBoundsCompletely() const OVERRIDE { return false; }
+ bool FillsBoundsCompletely() const override { return false; }
private:
Layer* layer_;
int lcd_notification_count_;
};
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
scoped_refptr<Layer> root_layer;
if (layer_tree_host()->settings().impl_side_painting)
root_layer = PictureLayer::Create(&client_);
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual void AfterTest() OVERRIDE {}
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+ void AfterTest() override {}
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
switch (layer_tree_host()->source_frame_number()) {
case 1:
// The first update consists of one LCD notification and one paint.
// Verify that the BeginFrame notification is used to initiate rendering.
class LayerTreeHostTestBeginFrameNotification : public LayerTreeHostTest {
public:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->begin_frame_scheduling_enabled = true;
}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
// This will trigger a SetNeedsBeginFrame which will trigger a
// BeginFrame.
PostSetNeedsCommitToMainThread();
}
- virtual DrawResult PrepareToDrawOnThread(
- LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame,
- DrawResult draw_result) OVERRIDE {
+ DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame,
+ DrawResult draw_result) override {
EndTest();
return DRAW_SUCCESS;
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
base::TimeTicks frame_time_;
class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled
: public LayerTreeHostTest {
public:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->begin_frame_scheduling_enabled = true;
settings->using_synchronous_renderer_compositor = true;
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
// The BeginFrame notification is turned off now but will get enabled
// once we return. End test while it's enabled.
ImplThreadTaskRunner()->PostTask(
base::Unretained(this)));
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
};
MULTI_THREAD_TEST_F(
LayerTreeHostTestAbortedCommitDoesntStall()
: commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {}
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->begin_frame_scheduling_enabled = true;
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
commit_count_++;
if (commit_count_ == 4) {
// After two aborted commits, request a real commit now to make sure a
}
}
- virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
- bool did_handle) OVERRIDE {
+ void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
+ bool did_handle) override {
commit_abort_count_++;
// Initiate another abortable commit.
host_impl->SetNeedsCommit();
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
commit_complete_count_++;
if (commit_complete_count_ == 1) {
// Initiate an abortable commit after the first commit.
}
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_EQ(commit_count_, 5);
EXPECT_EQ(commit_abort_count_, 3);
EXPECT_EQ(commit_complete_count_, 2);
class LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor
: public LayerTreeHostTestAbortedCommitDoesntStall {
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
LayerTreeHostTestAbortedCommitDoesntStall::InitializeSettings(settings);
settings->using_synchronous_renderer_compositor = true;
}
class LayerTreeHostTestAbortedCommitDoesntStallDisabledVsync
: public LayerTreeHostTestAbortedCommitDoesntStall {
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
LayerTreeHostTestAbortedCommitDoesntStall::InitializeSettings(settings);
settings->throttle_frame_production = false;
}
class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation
: public LayerTreeHostTest {
protected:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->impl_side_painting = true;
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
LayerTreeHostTest::SetupTree();
scoped_refptr<Layer> layer = PictureLayer::Create(&client_);
layer_tree_host()->root_layer()->AddChild(layer);
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
EndTest();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
FakeContentLayerClient client_;
};
void set_layer(Layer* layer) { layer_ = layer; }
- virtual void PaintContents(
+ void PaintContents(
SkCanvas* canvas,
const gfx::Rect& clip,
- ContentLayerClient::GraphicsContextStatus gc_status) OVERRIDE {
+ ContentLayerClient::GraphicsContextStatus gc_status) override {
layer_->SetBounds(gfx::Size(2, 2));
}
- virtual void DidChangeLayerCanUseLCDText() OVERRIDE {}
+ void DidChangeLayerCanUseLCDText() override {}
- virtual bool FillsBoundsCompletely() const OVERRIDE { return false; }
+ bool FillsBoundsCompletely() const override { return false; }
private:
Layer* layer_;
LayerTreeHostTestChangeLayerPropertiesInPaintContents() : num_commits_(0) {}
- virtual void SetupTree() OVERRIDE {
- scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_);
+ void SetupTree() override {
+ if (layer_tree_host()->settings().impl_side_painting) {
+ scoped_refptr<PictureLayer> root_layer = PictureLayer::Create(&client_);
+ layer_tree_host()->SetRootLayer(root_layer);
+ } else {
+ scoped_refptr<ContentLayer> root_layer = ContentLayer::Create(&client_);
+ layer_tree_host()->SetRootLayer(root_layer);
+ }
+ Layer* root_layer = layer_tree_host()->root_layer();
root_layer->SetIsDrawable(true);
root_layer->SetBounds(gfx::Size(1, 1));
- layer_tree_host()->SetRootLayer(root_layer);
- client_.set_layer(root_layer.get());
+ client_.set_layer(root_layer);
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
- virtual void AfterTest() OVERRIDE {}
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+ void AfterTest() override {}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
num_commits_++;
if (num_commits_ == 1) {
LayerImpl* root_layer = host_impl->active_tree()->root_layer();
int num_commits_;
};
-SINGLE_THREAD_TEST_F(LayerTreeHostTestChangeLayerPropertiesInPaintContents);
+SINGLE_AND_MULTI_THREAD_TEST_F(
+ LayerTreeHostTestChangeLayerPropertiesInPaintContents);
class MockIOSurfaceWebGraphicsContext3D : public TestWebGraphicsContext3D {
public:
test_capabilities_.gpu.texture_rectangle = true;
}
- virtual GLuint createTexture() OVERRIDE {
+ virtual GLuint createTexture() override {
return 1;
}
MOCK_METHOD1(activeTexture, void(GLenum texture));
class LayerTreeHostTestIOSurfaceDrawing : public LayerTreeHostTest {
protected:
- virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback)
- OVERRIDE {
+ scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(
+ bool fallback) override {
scoped_ptr<MockIOSurfaceWebGraphicsContext3D> mock_context_owned(
new MockIOSurfaceWebGraphicsContext3D);
mock_context_ = mock_context_owned.get();
- if (delegating_renderer()) {
- return FakeOutputSurface::CreateDelegating3d(
- mock_context_owned.PassAs<TestWebGraphicsContext3D>());
- } else {
- return FakeOutputSurface::Create3d(
- mock_context_owned.PassAs<TestWebGraphicsContext3D>());
- }
+ if (delegating_renderer())
+ return FakeOutputSurface::CreateDelegating3d(mock_context_owned.Pass());
+ else
+ return FakeOutputSurface::Create3d(mock_context_owned.Pass());
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
LayerTreeHostTest::SetupTree();
layer_tree_host()->root_layer()->SetIsDrawable(false);
layer_tree_host()->root_layer()->AddChild(io_surface_layer);
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
EXPECT_EQ(0u, host_impl->resource_provider()->num_resources());
// In WillDraw, the IOSurfaceLayer sets up the io surface texture.
EXPECT_CALL(*mock_context_, bindTexture(_, 0)).Times(AnyNumber());
}
- virtual DrawResult PrepareToDrawOnThread(
- LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame,
- DrawResult draw_result) OVERRIDE {
+ DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame,
+ DrawResult draw_result) override {
Mock::VerifyAndClearExpectations(&mock_context_);
ResourceProvider* resource_provider = host_impl->resource_provider();
EXPECT_EQ(1u, resource_provider->num_resources());
return draw_result;
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
Mock::VerifyAndClearExpectations(&mock_context_);
EXPECT_CALL(*mock_context_, deleteTexture(1)).Times(AtLeast(1));
EndTest();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
int io_surface_id_;
MockIOSurfaceWebGraphicsContext3D* mock_context_;
class LayerTreeHostTestNumFramesPending : public LayerTreeHostTest {
public:
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
frame_ = 0;
PostSetNeedsCommitToMainThread();
}
// Round 2: commit only (no draw/swap)
// Round 3: draw only (no commit)
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
int commit = layer_tree_host()->source_frame_number();
switch (commit) {
case 2:
}
}
- virtual void DidCompleteSwapBuffers() OVERRIDE {
+ void DidCompleteSwapBuffers() override {
int commit = layer_tree_host()->source_frame_number();
++frame_;
switch (frame_) {
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
protected:
int frame_;
class LayerTreeHostTestDeferredInitialize : public LayerTreeHostTest {
public:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
// PictureLayer can only be used with impl side painting enabled.
settings->impl_side_painting = true;
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
layer_ = FakePictureLayer::Create(&client_);
// Force commits to not be aborted so new frames get drawn, otherwise
// the renderer gets deferred initialized but nothing new needs drawing.
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
did_initialize_gl_ = false;
did_release_gl_ = false;
last_source_frame_number_drawn_ = -1; // Never drawn.
PostSetNeedsCommitToMainThread();
}
- virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback)
- OVERRIDE {
+ scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(
+ bool fallback) override {
scoped_ptr<TestWebGraphicsContext3D> context3d(
TestWebGraphicsContext3D::Create());
delegating_renderer());
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
ASSERT_TRUE(host_impl->RootLayer());
FakePictureLayerImpl* layer_impl =
static_cast<FakePictureLayerImpl*>(host_impl->RootLayer());
did_release_gl_ = true;
}
- virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl,
- bool result) OVERRIDE {
+ void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override {
ASSERT_TRUE(result);
DelegatedFrameData* delegated_frame_data =
output_surface()->last_sent_frame().delegated_frame_data.get();
host_impl->ReclaimResources(&ack);
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_TRUE(did_initialize_gl_);
EXPECT_TRUE(did_release_gl_);
}
class LayerTreeHostTestDeferredInitializeWithGpuRasterization
: public LayerTreeHostTestDeferredInitialize {
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
// PictureLayer can only be used with impl side painting enabled.
settings->impl_side_painting = true;
settings->gpu_rasterization_enabled = true;
public:
LayerTreeHostTestUIResource() : num_ui_resources_(0) {}
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->texture_id_allocation_chunk_size = 1;
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
int frame = layer_tree_host()->source_frame_number();
switch (frame) {
case 1:
}
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
if (!layer_tree_host()->settings().impl_side_painting)
PerformTest(impl);
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
if (layer_tree_host()->settings().impl_side_painting)
PerformTest(impl);
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
// Must clear all resources before exiting.
void ClearResources() {
for (int i = 0; i < num_ui_resources_; i++)
- ui_resources_[i].reset();
+ ui_resources_[i] = nullptr;
}
void CreateResource() {
return make_scoped_ptr(new PushPropertiesCountingLayerImpl(tree_impl, id));
}
- virtual ~PushPropertiesCountingLayerImpl() {}
+ ~PushPropertiesCountingLayerImpl() override {}
- virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE {
+ void PushPropertiesTo(LayerImpl* layer) override {
LayerImpl::PushPropertiesTo(layer);
push_properties_count_++;
// Push state to the active tree because we can only access it from there.
layer)->push_properties_count_ = push_properties_count_;
}
- virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
- OVERRIDE {
- return PushPropertiesCountingLayerImpl::Create(tree_impl, id()).
- PassAs<LayerImpl>();
+ scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override {
+ return PushPropertiesCountingLayerImpl::Create(tree_impl, id());
}
size_t push_properties_count() const { return push_properties_count_; }
return new PushPropertiesCountingLayer();
}
- virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE {
+ void PushPropertiesTo(LayerImpl* layer) override {
Layer::PushPropertiesTo(layer);
push_properties_count_++;
if (persist_needs_push_properties_)
needs_push_properties_ = true;
}
- virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl)
- OVERRIDE {
- return PushPropertiesCountingLayerImpl::Create(tree_impl, id()).
- PassAs<LayerImpl>();
+ scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override {
+ return PushPropertiesCountingLayerImpl::Create(tree_impl, id());
}
void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); }
: push_properties_count_(0), persist_needs_push_properties_(false) {
SetBounds(gfx::Size(1, 1));
}
- virtual ~PushPropertiesCountingLayer() {}
+ ~PushPropertiesCountingLayer() override {}
size_t push_properties_count_;
bool persist_needs_push_properties_;
class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest {
protected:
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
num_commits_ = 0;
expected_push_properties_root_ = 0;
expected_push_properties_child_ = 0;
PostSetNeedsCommitToMainThread();
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_ = PushPropertiesCountingLayer::Create();
child_ = PushPropertiesCountingLayer::Create();
child2_ = PushPropertiesCountingLayer::Create();
LayerTreeHostTest::SetupTree();
}
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
++num_commits_;
EXPECT_EQ(expected_push_properties_root_, root_->push_properties_count());
++expected_push_properties_leaf_layer_;
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
int num_commits_;
FakeContentLayerClient client_;
class LayerTreeHostTestImplLayersPushProperties
: public LayerTreeHostTestLayersPushProperties {
protected:
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
expected_push_properties_root_impl_ = 0;
expected_push_properties_child_impl_ = 0;
expected_push_properties_grandchild_impl_ = 0;
LayerTreeHostTestLayersPushProperties::BeginTest();
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
// These commits are in response to the changes made in
// LayerTreeHostTestLayersPushProperties::DidCommitAndDrawFrame()
switch (num_commits_) {
class LayerTreeHostTestPropertyChangesDuringUpdateArePushed
: public LayerTreeHostTest {
protected:
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_ = Layer::Create();
root_->SetBounds(gfx::Size(1, 1));
LayerTreeHostTest::SetupTree();
}
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
switch (layer_tree_host()->source_frame_number()) {
case 0:
break;
// avoid causing a second commit to be scheduled. If a property change
// is made during this, however, it needs to be pushed in the upcoming
// commit.
- scoped_ptr<base::AutoReset<bool> > ignore =
+ scoped_ptr<base::AutoReset<bool>> ignore =
scrollbar_layer_->IgnoreSetNeedsCommit();
scrollbar_layer_->SetBounds(gfx::Size(30, 30));
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
scoped_refptr<Layer> root_;
scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_;
class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest {
protected:
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_ = PushPropertiesCountingLayer::Create();
child_ = PushPropertiesCountingLayer::Create();
root_->AddChild(child_);
LayerTreeHostTest::SetupTree();
}
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
switch (layer_tree_host()->source_frame_number()) {
case 0:
break;
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
scoped_refptr<PushPropertiesCountingLayer> root_;
scoped_refptr<PushPropertiesCountingLayer> child_;
class LayerTreeHostTestCasePushPropertiesThreeGrandChildren
: public LayerTreeHostTest {
protected:
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
expected_push_properties_root_ = 0;
expected_push_properties_child_ = 0;
expected_push_properties_grandchild1_ = 0;
PostSetNeedsCommitToMainThread();
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_ = PushPropertiesCountingLayer::Create();
child_ = PushPropertiesCountingLayer::Create();
grandchild1_ = PushPropertiesCountingLayer::Create();
LayerTreeHostTest::SetupTree();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
FakeContentLayerClient client_;
scoped_refptr<PushPropertiesCountingLayer> root_;
class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush
: public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
protected:
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
switch (last_source_frame_number) {
case 0:
class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion
: public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
protected:
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
switch (last_source_frame_number) {
case 0:
class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence
: public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
protected:
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
switch (last_source_frame_number) {
case 0:
class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree
: public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
protected:
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
switch (last_source_frame_number) {
case 0:
class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild
: public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
protected:
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
switch (last_source_frame_number) {
case 0:
class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent
: public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
protected:
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
int last_source_frame_number = layer_tree_host()->source_frame_number() - 1;
switch (last_source_frame_number) {
case 0:
LayerTreeHostTestTreeActivationCallback()
: num_commits_(0), callback_count_(0) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
EXPECT_TRUE(HasImplThread());
PostSetNeedsCommitToMainThread();
}
- virtual DrawResult PrepareToDrawOnThread(
- LayerTreeHostImpl* host_impl,
- LayerTreeHostImpl::FrameData* frame_data,
- DrawResult draw_result) OVERRIDE {
+ DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
+ LayerTreeHostImpl::FrameData* frame_data,
+ DrawResult draw_result) override {
++num_commits_;
switch (num_commits_) {
case 1:
host_impl, frame_data, draw_result);
}
- virtual void AfterTest() OVERRIDE { EXPECT_EQ(3, num_commits_); }
+ void AfterTest() override { EXPECT_EQ(3, num_commits_); }
void SetCallback(bool enable) {
output_surface()->SetTreeActivationCallback(
public:
LayerInvalidateCausesDraw() : num_commits_(0), num_draws_(0) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
ASSERT_TRUE(!!invalidate_layer_.get())
<< "Derived tests must set this in SetupTree";
PostSetNeedsCommitToMainThread();
}
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
// After commit, invalidate the layer. This should cause a commit.
if (layer_tree_host()->source_frame_number() == 1)
invalidate_layer_->SetNeedsDisplay();
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
num_draws_++;
if (impl->active_tree()->source_frame_number() == 1)
EndTest();
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
num_commits_++;
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_GE(2, num_commits_);
EXPECT_GE(2, num_draws_);
}
// response to that invalidation.
class LayerTreeHostTestVideoLayerInvalidate : public LayerInvalidateCausesDraw {
public:
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
LayerTreeHostTest::SetupTree();
scoped_refptr<VideoLayer> video_layer =
VideoLayer::Create(&provider_, media::VIDEO_ROTATION_0);
class LayerTreeHostTestIOSurfaceLayerInvalidate
: public LayerInvalidateCausesDraw {
public:
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
LayerTreeHostTest::SetupTree();
scoped_refptr<IOSurfaceLayer> layer = IOSurfaceLayer::Create();
layer->SetBounds(gfx::Size(10, 10));
class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest {
protected:
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_layer_ = Layer::Create();
root_layer_->SetPosition(gfx::Point());
root_layer_->SetBounds(gfx::Size(10, 10));
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
switch (layer_tree_host()->source_frame_number()) {
case 1:
// The layer type used does not need to push properties every frame.
}
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
LayerImpl* root = impl->active_tree()->root_layer();
LayerImpl* parent = root->children()[0];
LayerImpl* child = parent->children()[0];
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
scoped_refptr<Layer> root_layer_;
scoped_refptr<SolidColorLayer> parent_layer_;
class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest {
protected:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->impl_side_painting = true;
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_layer_ = FakePictureLayer::Create(&client_);
root_layer_->SetBounds(gfx::Size(10, 10));
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
// The viewport is empty, but we still need to update layers on the main
// thread.
layer_tree_host()->SetViewportSize(gfx::Size(0, 0));
PostSetNeedsCommitToMainThread();
}
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
// The layer should be updated even though the viewport is empty, so we
// are capable of drawing it on the impl tree.
EXPECT_GT(root_layer_->update_count(), 0u);
EndTest();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
FakeContentLayerClient client_;
scoped_refptr<FakePictureLayer> root_layer_;
: num_will_begin_main_frames_(0), num_impl_commits_(0) {}
protected:
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
scoped_refptr<SolidColorLayer> root_layer = SolidColorLayer::Create();
root_layer->SetBounds(gfx::Size(200, 200));
root_layer->SetIsDrawable(true);
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void WillBeginMainFrame() OVERRIDE {
+ void WillBeginMainFrame() override {
num_will_begin_main_frames_++;
switch (num_will_begin_main_frames_) {
case 2:
}
}
- virtual void BeginCommitOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void BeginCommitOnThread(LayerTreeHostImpl* impl) override {
num_impl_commits_++;
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
switch (impl->SourceAnimationFrameNumber()) {
case 1:
// Prevent draws until commit.
}
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
// Ensure that the commit was truly aborted.
EXPECT_EQ(2, num_will_begin_main_frames_);
EXPECT_EQ(1, num_impl_commits_);
class LayerTreeHostTestMaxTransferBufferUsageBytes : public LayerTreeHostTest {
protected:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->impl_side_painting = true;
+ settings->use_zero_copy = false;
+ settings->use_one_copy = false;
}
- virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback)
- OVERRIDE {
+ scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(
+ bool fallback) override {
scoped_refptr<TestContextProvider> context_provider =
TestContextProvider::Create();
- context_provider->SetMaxTransferBufferUsageBytes(1024 * 1024);
+ context_provider->SetMaxTransferBufferUsageBytes(512 * 512);
if (delegating_renderer())
return FakeOutputSurface::CreateDelegating3d(context_provider);
else
return FakeOutputSurface::Create3d(context_provider);
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
client_.set_fill_with_nonsolid_color(true);
scoped_refptr<FakePictureLayer> root_layer =
FakePictureLayer::Create(&client_);
- root_layer->SetBounds(gfx::Size(6000, 6000));
+ root_layer->SetBounds(gfx::Size(1024, 1024));
root_layer->SetIsDrawable(true);
layer_tree_host()->SetRootLayer(root_layer);
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
TestWebGraphicsContext3D* context = TestContext();
// Expect that the transfer buffer memory used is equal to the
// MaxTransferBufferUsageBytes value set in CreateOutputSurface.
- EXPECT_EQ(1024 * 1024u, context->max_used_transfer_buffer_usage_bytes());
+ EXPECT_EQ(512 * 512u, context->max_used_transfer_buffer_usage_bytes());
EndTest();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
FakeContentLayerClient client_;
public:
LayerTreeHostTestMemoryLimits() : num_commits_(0) {}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void WillCommit() OVERRIDE {
+ void WillCommit() override {
// Some commits are aborted, so increment number of attempted commits here.
num_commits_++;
}
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
switch (num_commits_) {
case 1:
// Verify default values.
}
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
switch (num_commits_) {
case 1:
break;
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
private:
int num_commits_;
: first_output_surface_memory_limit_(4321234),
second_output_surface_memory_limit_(1234321) {}
- virtual scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(bool fallback)
- OVERRIDE {
+ scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface(
+ bool fallback) override {
if (!first_context_provider_.get()) {
first_context_provider_ = TestContextProvider::Create();
} else {
return output_surface.Pass();
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
root_ = FakeContentLayer::Create(&client_);
root_->SetBounds(gfx::Size(20, 20));
layer_tree_host()->SetRootLayer(root_);
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidCommitAndDrawFrame() OVERRIDE {
+ void DidCommitAndDrawFrame() override {
// Lost context sometimes takes two frames to recreate. The third frame
// is sometimes aborted, so wait until the fourth frame to verify that
// the memory has been set, and the fifth frame to end the test.
}
}
- virtual void SwapBuffersOnThread(LayerTreeHostImpl* impl,
- bool result) OVERRIDE {
+ void SwapBuffersOnThread(LayerTreeHostImpl* impl, bool result) override {
switch (impl->active_tree()->source_frame_number()) {
case 1:
EXPECT_EQ(first_output_surface_memory_limit_,
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
scoped_refptr<TestContextProvider> first_context_provider_;
scoped_refptr<TestContextProvider> second_context_provider_;
public:
explicit TestSwapPromise(TestSwapPromiseResult* result) : result_(result) {}
- virtual ~TestSwapPromise() {
+ ~TestSwapPromise() override {
base::AutoLock lock(result_->lock);
result_->dtor_called = true;
}
- virtual void DidSwap(CompositorFrameMetadata* metadata) OVERRIDE {
+ void DidSwap(CompositorFrameMetadata* metadata) override {
base::AutoLock lock(result_->lock);
EXPECT_FALSE(result_->did_swap_called);
EXPECT_FALSE(result_->did_not_swap_called);
result_->did_swap_called = true;
}
- virtual void DidNotSwap(DidNotSwapReason reason) OVERRIDE {
+ void DidNotSwap(DidNotSwapReason reason) override {
base::AutoLock lock(result_->lock);
EXPECT_FALSE(result_->did_swap_called);
EXPECT_FALSE(result_->did_not_swap_called);
result_->reason = reason;
}
- virtual int64 TraceId() const OVERRIDE { return 0; }
+ int64 TraceId() const override { return 0; }
private:
// Not owned.
LayerTreeHostTestBreakSwapPromise()
: commit_count_(0), commit_complete_count_(0) {}
- virtual void WillBeginMainFrame() OVERRIDE {
+ void WillBeginMainFrame() override {
ASSERT_LE(commit_count_, 2);
scoped_ptr<SwapPromise> swap_promise(
new TestSwapPromise(&swap_promise_result_[commit_count_]));
layer_tree_host()->QueueSwapPromise(swap_promise.Pass());
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
commit_count_++;
if (commit_count_ == 2) {
// This commit will finish.
}
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
commit_complete_count_++;
if (commit_complete_count_ == 1) {
// This commit will be aborted because no actual update.
}
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
// 3 commits are scheduled. 2 completes. 1 is aborted.
EXPECT_EQ(commit_count_, 3);
EXPECT_EQ(commit_complete_count_, 2);
class LayerTreeHostTestBreakSwapPromiseForVisibilityAbortedCommit
: public LayerTreeHostTest {
protected:
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
layer_tree_host()->SetDeferCommits(true);
layer_tree_host()->SetNeedsCommit();
}
- virtual void DidDeferCommit() OVERRIDE {
+ void DidDeferCommit() override {
layer_tree_host()->SetVisible(false);
scoped_ptr<SwapPromise> swap_promise(
new TestSwapPromise(&swap_promise_result_));
layer_tree_host()->SetDeferCommits(false);
}
- virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
- bool did_handle) OVERRIDE {
+ void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
+ bool did_handle) override {
EndTest();
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
{
base::AutoLock lock(swap_promise_result_.lock);
EXPECT_FALSE(swap_promise_result_.did_swap_called);
class LayerTreeHostTestBreakSwapPromiseForContextAbortedCommit
: public LayerTreeHostTest {
protected:
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
if (TestEnded())
return;
layer_tree_host()->SetDeferCommits(true);
layer_tree_host()->SetNeedsCommit();
}
- virtual void DidDeferCommit() OVERRIDE {
+ void DidDeferCommit() override {
layer_tree_host()->DidLoseOutputSurface();
scoped_ptr<SwapPromise> swap_promise(
new TestSwapPromise(&swap_promise_result_));
layer_tree_host()->SetDeferCommits(false);
}
- virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
- bool did_handle) OVERRIDE {
+ void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
+ bool did_handle) override {
EndTest();
// This lets the test finally commit and exit.
MainThreadTaskRunner()->PostTask(
layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(true);
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
{
base::AutoLock lock(swap_promise_result_.lock);
EXPECT_FALSE(swap_promise_result_.did_swap_called);
: SwapPromiseMonitor(layer_tree_host, layer_tree_host_impl),
set_needs_commit_count_(set_needs_commit_count) {}
- virtual ~SimpleSwapPromiseMonitor() {}
+ ~SimpleSwapPromiseMonitor() override {}
- virtual void OnSetNeedsCommitOnMain() OVERRIDE {
- (*set_needs_commit_count_)++;
- }
+ void OnSetNeedsCommitOnMain() override { (*set_needs_commit_count_)++; }
- virtual void OnSetNeedsRedrawOnImpl() OVERRIDE {
+ void OnSetNeedsRedrawOnImpl() override {
ADD_FAILURE() << "Should not get called on main thread.";
}
- virtual void OnForwardScrollUpdateToMainThreadOnImpl() OVERRIDE {
+ void OnForwardScrollUpdateToMainThreadOnImpl() override {
ADD_FAILURE() << "Should not get called on main thread.";
}
class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest {
public:
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void WillBeginMainFrame() OVERRIDE {
+ void WillBeginMainFrame() override {
if (TestEnded())
return;
EndTest();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
};
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor);
class LayerTreeHostTestHighResRequiredAfterEvictingUIResources
: public LayerTreeHostTest {
protected:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->impl_side_painting = true;
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
LayerTreeHostTest::SetupTree();
ui_resource_ = FakeScopedUIResource::Create(layer_tree_host());
}
- virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
host_impl->EvictAllUIResources();
// Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY
// mode. Active tree should require high-res to draw after entering this
// mode to ensure that high-res tiles are also required for a pending tree
// to be activated.
- EXPECT_TRUE(host_impl->active_tree()->RequiresHighResToDraw());
+ EXPECT_TRUE(host_impl->RequiresHighResToDraw());
}
- virtual void DidCommit() OVERRIDE {
+ void DidCommit() override {
int frame = layer_tree_host()->source_frame_number();
switch (frame) {
case 1:
PostSetNeedsCommitToMainThread();
break;
case 2:
- ui_resource_.reset();
+ ui_resource_ = nullptr;
EndTest();
break;
}
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
FakeContentLayerClient client_;
scoped_ptr<FakeScopedUIResource> ui_resource_;
class LayerTreeHostTestGpuRasterizationDefault : public LayerTreeHostTest {
protected:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->impl_side_painting = true;
EXPECT_FALSE(settings->gpu_rasterization_enabled);
EXPECT_FALSE(settings->gpu_rasterization_forced);
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
LayerTreeHostTest::SetupTree();
scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_);
layer_tree_host()->root_layer()->AddChild(layer);
}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
Layer* root = layer_tree_host()->root_layer();
PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
PicturePile* pile = layer->GetPicturePileForTesting();
PostSetNeedsCommitToMainThread();
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization());
EXPECT_FALSE(host_impl->use_gpu_rasterization());
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
EXPECT_FALSE(host_impl->active_tree()->use_gpu_rasterization());
EXPECT_FALSE(host_impl->use_gpu_rasterization());
EndTest();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
FakeContentLayerClient layer_client_;
};
class LayerTreeHostTestGpuRasterizationEnabled : public LayerTreeHostTest {
protected:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->impl_side_painting = true;
EXPECT_FALSE(settings->gpu_rasterization_enabled);
settings->gpu_rasterization_enabled = true;
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
LayerTreeHostTest::SetupTree();
scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_);
layer_tree_host()->root_layer()->AddChild(layer);
}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
Layer* root = layer_tree_host()->root_layer();
PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
PicturePile* pile = layer->GetPicturePileForTesting();
PostSetNeedsCommitToMainThread();
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
EXPECT_FALSE(host_impl->pending_tree()->use_gpu_rasterization());
EXPECT_FALSE(host_impl->use_gpu_rasterization());
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
EXPECT_FALSE(host_impl->active_tree()->use_gpu_rasterization());
EXPECT_FALSE(host_impl->use_gpu_rasterization());
EndTest();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
FakeContentLayerClient layer_client_;
};
class LayerTreeHostTestGpuRasterizationForced : public LayerTreeHostTest {
protected:
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->impl_side_painting = true;
EXPECT_FALSE(settings->gpu_rasterization_forced);
settings->gpu_rasterization_forced = true;
}
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
LayerTreeHostTest::SetupTree();
scoped_refptr<PictureLayer> layer = PictureLayer::Create(&layer_client_);
layer_tree_host()->root_layer()->AddChild(layer);
}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
Layer* root = layer_tree_host()->root_layer();
PictureLayer* layer = static_cast<PictureLayer*>(root->child_at(0));
PicturePile* pile = layer->GetPicturePileForTesting();
PostSetNeedsCommitToMainThread();
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
EXPECT_TRUE(host_impl->pending_tree()->use_gpu_rasterization());
EXPECT_TRUE(host_impl->use_gpu_rasterization());
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
EXPECT_TRUE(host_impl->active_tree()->use_gpu_rasterization());
EXPECT_TRUE(host_impl->use_gpu_rasterization());
EndTest();
}
- virtual void AfterTest() OVERRIDE {}
+ void AfterTest() override {}
FakeContentLayerClient layer_client_;
};
protected:
enum { kExpectedNumCommits = 10 };
- virtual void SetupTree() OVERRIDE {
+ void SetupTree() override {
scoped_refptr<Layer> root_layer = Layer::Create();
root_layer->SetBounds(bounds_);
LayerTreeHostTest::SetupTree();
}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
MainThreadTaskRunner()->PostTask(
FROM_HERE,
base::Bind(
milliseconds_per_frame));
}
- virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
+ void BeginMainFrame(const BeginFrameArgs& args) override {
child_layer_->SetNeedsDisplay();
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_LE(kExpectedNumCommits, num_commits_);
EXPECT_LE(kExpectedNumCommits, num_draws_);
int update_count = content_layer_.get()
EXPECT_LE(kExpectedNumCommits, update_count);
}
- virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
if (++num_draws_ == kExpectedNumCommits)
EndTest();
}
- virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ void CommitCompleteOnThread(LayerTreeHostImpl* impl) override {
++num_commits_;
}
LayerTreeHostTestActivateOnInvisible()
: activation_count_(0), visible_(true) {}
- virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ void InitializeSettings(LayerTreeSettings* settings) override {
settings->impl_side_painting = true;
}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
// Kick off the test with a commit.
PostSetNeedsCommitToMainThread();
}
- virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override {
// Make sure we don't activate using the notify signal from tile manager.
host_impl->BlockNotifyReadyToActivateForTesting(true);
}
- virtual void DidCommit() OVERRIDE { layer_tree_host()->SetVisible(false); }
+ void DidCommit() override { layer_tree_host()->SetVisible(false); }
- virtual void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl,
- bool visible) OVERRIDE {
+ void DidSetVisibleOnImplTree(LayerTreeHostImpl* host_impl,
+ bool visible) override {
visible_ = visible;
// Once invisible, we can go visible again.
if (!visible) {
PostSetVisibleToMainThread(true);
} else {
- EXPECT_TRUE(host_impl->active_tree()->RequiresHighResToDraw());
+ EXPECT_TRUE(host_impl->RequiresHighResToDraw());
EndTest();
}
}
- virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
++activation_count_;
EXPECT_FALSE(visible_);
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
// Ensure we activated even though the signal was blocked.
EXPECT_EQ(1, activation_count_);
EXPECT_TRUE(visible_);
// TODO(vmpstr): Enable with single thread impl-side painting.
MULTI_THREAD_TEST_F(LayerTreeHostTestActivateOnInvisible);
+// Do a synchronous composite and assert that the swap promise succeeds.
+class LayerTreeHostTestSynchronousCompositeSwapPromise
+ : public LayerTreeHostTest {
+ public:
+ LayerTreeHostTestSynchronousCompositeSwapPromise() : commit_count_(0) {}
+
+ void InitializeSettings(LayerTreeSettings* settings) override {
+ settings->single_thread_proxy_scheduler = false;
+ }
+
+ void BeginTest() override {
+ // Successful composite.
+ scoped_ptr<SwapPromise> swap_promise0(
+ new TestSwapPromise(&swap_promise_result_[0]));
+ layer_tree_host()->QueueSwapPromise(swap_promise0.Pass());
+ layer_tree_host()->Composite(gfx::FrameTime::Now());
+
+ // Fail to swap (no damage).
+ scoped_ptr<SwapPromise> swap_promise1(
+ new TestSwapPromise(&swap_promise_result_[1]));
+ layer_tree_host()->QueueSwapPromise(swap_promise1.Pass());
+ layer_tree_host()->SetNeedsCommit();
+ layer_tree_host()->Composite(gfx::FrameTime::Now());
+
+ // Fail to draw (not visible).
+ scoped_ptr<SwapPromise> swap_promise2(
+ new TestSwapPromise(&swap_promise_result_[2]));
+ layer_tree_host()->QueueSwapPromise(swap_promise2.Pass());
+ layer_tree_host()->SetNeedsDisplayOnAllLayers();
+ layer_tree_host()->SetVisible(false);
+ layer_tree_host()->Composite(gfx::FrameTime::Now());
+
+ EndTest();
+ }
+
+ void DidCommit() override {
+ commit_count_++;
+ ASSERT_LE(commit_count_, 3);
+ }
+
+ void AfterTest() override {
+ EXPECT_EQ(3, commit_count_);
+
+ // Initial swap promise should have succeded.
+ {
+ base::AutoLock lock(swap_promise_result_[0].lock);
+ EXPECT_TRUE(swap_promise_result_[0].did_swap_called);
+ EXPECT_FALSE(swap_promise_result_[0].did_not_swap_called);
+ EXPECT_TRUE(swap_promise_result_[0].dtor_called);
+ }
+
+ // Second swap promise fails to swap.
+ {
+ base::AutoLock lock(swap_promise_result_[1].lock);
+ EXPECT_FALSE(swap_promise_result_[1].did_swap_called);
+ EXPECT_TRUE(swap_promise_result_[1].did_not_swap_called);
+ EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[1].reason);
+ EXPECT_TRUE(swap_promise_result_[1].dtor_called);
+ }
+
+ // Third swap promises also fails to swap (and draw).
+ {
+ base::AutoLock lock(swap_promise_result_[2].lock);
+ EXPECT_FALSE(swap_promise_result_[2].did_swap_called);
+ EXPECT_TRUE(swap_promise_result_[2].did_not_swap_called);
+ EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[2].reason);
+ EXPECT_TRUE(swap_promise_result_[2].dtor_called);
+ }
+ }
+
+ int commit_count_;
+ TestSwapPromiseResult swap_promise_result_[3];
+};
+
+// Impl-side painting is not supported for synchronous compositing.
+SINGLE_THREAD_NOIMPL_TEST_F(LayerTreeHostTestSynchronousCompositeSwapPromise);
+
// Make sure page scale and top control deltas are applied to the client even
// when the LayerTreeHost doesn't have a root layer.
class LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer
LayerTreeHostAcceptsDeltasFromImplWithoutRootLayer()
: deltas_sent_to_client_(false) {}
- virtual void BeginTest() OVERRIDE {
+ void BeginTest() override {
layer_tree_host()->SetRootLayer(nullptr);
info_.page_scale_delta = 3.14f;
info_.top_controls_delta = 2.73f;
PostSetNeedsCommitToMainThread();
}
- virtual void BeginMainFrame(const BeginFrameArgs& args) OVERRIDE {
+ void BeginMainFrame(const BeginFrameArgs& args) override {
EXPECT_EQ(nullptr, layer_tree_host()->root_layer());
layer_tree_host()->ApplyScrollAndScale(&info_);
EndTest();
}
- virtual void ApplyViewportDeltas(
+ void ApplyViewportDeltas(
+ const gfx::Vector2d& inner,
+ const gfx::Vector2d& outer,
+ float scale_delta,
+ float top_controls_delta) override {
+ EXPECT_EQ(info_.page_scale_delta, scale_delta);
+ EXPECT_EQ(info_.top_controls_delta, top_controls_delta);
+ deltas_sent_to_client_ = true;
+ }
+
+ void ApplyViewportDeltas(
const gfx::Vector2d& scroll,
float scale_delta,
- float top_controls_delta) OVERRIDE {
+ float top_controls_delta) override {
EXPECT_EQ(info_.page_scale_delta, scale_delta);
EXPECT_EQ(info_.top_controls_delta, top_controls_delta);
deltas_sent_to_client_ = true;
}
- virtual void AfterTest() OVERRIDE {
+ void AfterTest() override {
EXPECT_TRUE(deltas_sent_to_client_);
}