Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: components/exo/surface_unittest.cc

Issue 2046493005: exo: Implement Surface::SetSurfaceLayerContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/exo/surface.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/surface_unittest.cc
diff --git a/components/exo/surface_unittest.cc b/components/exo/surface_unittest.cc
index f75c33aa370d41ecc1dbf3f42ee6561dd1b05a41..a349d54d6ce4a1a5fcc74f7dffd1c10d77ecc8fb 100644
--- a/components/exo/surface_unittest.cc
+++ b/components/exo/surface_unittest.cc
@@ -8,7 +8,9 @@
#include "components/exo/test/exo_test_base.h"
#include "components/exo/test/exo_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/compositor/layer_tree_owner.h"
#include "ui/gfx/gpu_memory_buffer.h"
+#include "ui/wm/core/window_util.h"
namespace exo {
namespace {
@@ -124,6 +126,26 @@ TEST_P(SurfaceTest, SetBufferScale) {
surface->bounds().size().ToString());
}
+TEST_P(SurfaceTest, RecreateLayer) {
+ gfx::Size buffer_size(512, 512);
+ std::unique_ptr<Buffer> buffer(
+ new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
+ std::unique_ptr<Surface> surface(new Surface);
+
+ surface->Attach(buffer.get());
+ surface->Commit();
+
+ EXPECT_EQ(buffer_size, surface->bounds().size());
+ EXPECT_EQ(buffer_size, surface->layer()->bounds().size());
+ std::unique_ptr<ui::LayerTreeOwner> old_layer_owner =
+ ::wm::RecreateLayers(surface.get(), nullptr);
+ EXPECT_EQ(buffer_size, surface->bounds().size());
+ EXPECT_EQ(buffer_size, surface->layer()->bounds().size());
+ EXPECT_EQ(buffer_size, old_layer_owner->root()->bounds().size());
+ EXPECT_TRUE(surface->layer()->has_external_content());
+ EXPECT_TRUE(old_layer_owner->root()->has_external_content());
+}
+
TEST_P(SurfaceTest, SetViewport) {
gfx::Size buffer_size(1, 1);
std::unique_ptr<Buffer> buffer(
« no previous file with comments | « components/exo/surface.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698