| Index: content/browser/compositor/reflector_impl_unittest.cc
|
| diff --git a/content/browser/compositor/reflector_impl_unittest.cc b/content/browser/compositor/reflector_impl_unittest.cc
|
| index 867a9de10a224963725337381ad761f822e20318..9960484789ce045a4595896e3315c5997a99f99b 100644
|
| --- a/content/browser/compositor/reflector_impl_unittest.cc
|
| +++ b/content/browser/compositor/reflector_impl_unittest.cc
|
| @@ -11,6 +11,7 @@
|
| #include "content/browser/compositor/browser_compositor_output_surface.h"
|
| #include "content/browser/compositor/browser_compositor_overlay_candidate_validator.h"
|
| #include "content/browser/compositor/reflector_impl.h"
|
| +#include "content/browser/compositor/reflector_texture.h"
|
| #include "content/browser/compositor/test/no_transport_image_transport_factory.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "ui/compositor/compositor.h"
|
| @@ -80,6 +81,15 @@ class TestOutputSurface : public BrowserCompositorOutputSurface {
|
|
|
| void SwapBuffers(cc::CompositorFrame* frame) override {}
|
|
|
| + void OnReflectorChanged() override {
|
| + if (!reflector_) {
|
| + reflector_texture_.reset();
|
| + } else {
|
| + reflector_texture_.reset(new ReflectorTexture(context_provider()));
|
| + reflector_->OnSourceTextureMailboxUpdated(reflector_texture_->mailbox());
|
| + }
|
| + }
|
| +
|
| #if defined(OS_MACOSX)
|
| void OnSurfaceDisplayed() override {}
|
| void SetSurfaceSuspendedForRecycle(bool suspended) override {}
|
| @@ -89,6 +99,9 @@ class TestOutputSurface : public BrowserCompositorOutputSurface {
|
| #endif
|
|
|
| gfx::Size SurfaceSize() const override { return gfx::Size(256, 256); }
|
| +
|
| + private:
|
| + scoped_ptr<ReflectorTexture> reflector_texture_;
|
| };
|
|
|
| const gfx::Rect kSubRect(0, 0, 64, 64);
|
| @@ -118,7 +131,10 @@ class ReflectorImplTest : public testing::Test {
|
| compositor_->vsync_manager())).Pass();
|
| CHECK(output_surface_->BindToClient(&output_surface_client_));
|
|
|
| + root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
|
| + compositor_->SetRootLayer(root_layer_.get());
|
| mirroring_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
|
| + compositor_->root_layer()->Add(mirroring_layer_.get());
|
| gfx::Size size = output_surface_->SurfaceSize();
|
| mirroring_layer_->SetBounds(gfx::Rect(size.width(), size.height()));
|
| }
|
| @@ -130,6 +146,8 @@ class ReflectorImplTest : public testing::Test {
|
| }
|
|
|
| void TearDown() override {
|
| + if (reflector_)
|
| + reflector_->RemoveMirroringLayer(mirroring_layer_.get());
|
| cc::TextureMailbox mailbox;
|
| scoped_ptr<cc::SingleReleaseCallback> release;
|
| if (mirroring_layer_->PrepareTextureMailbox(&mailbox, &release, false)) {
|
| @@ -149,6 +167,7 @@ class ReflectorImplTest : public testing::Test {
|
| scoped_ptr<base::MessageLoop> message_loop_;
|
| scoped_refptr<base::MessageLoopProxy> proxy_;
|
| scoped_ptr<ui::Compositor> compositor_;
|
| + scoped_ptr<ui::Layer> root_layer_;
|
| scoped_ptr<ui::Layer> mirroring_layer_;
|
| scoped_ptr<ReflectorImpl> reflector_;
|
| scoped_ptr<TestOutputSurface> output_surface_;
|
|
|