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

Unified Diff: ui/compositor/layer_unittest.cc

Issue 228083002: Make ReflectorImpl use mailboxes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 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 | « ui/compositor/layer_owner_delegate.h ('k') | ui/views/view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_unittest.cc
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index 4c838a30188ab9676f71d1726e7e809618ebb118..52051c1cb00ee4e8624624cf98569924ef825aed 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -642,17 +642,6 @@ class LayerWithNullDelegateTest : public LayerWithDelegateTest {
DISALLOW_COPY_AND_ASSIGN(LayerWithNullDelegateTest);
};
-class FakeTexture : public Texture {
- public:
- FakeTexture(bool flipped, const gfx::Size& size, float device_scale_factor)
- : Texture(flipped, size, device_scale_factor) {}
-
- virtual unsigned int PrepareTexture() OVERRIDE { return 0; }
-
- protected:
- virtual ~FakeTexture() {}
-};
-
TEST_F(LayerWithNullDelegateTest, EscapedDebugNames) {
scoped_ptr<Layer> layer(CreateLayer(LAYER_NOT_DRAWN));
std::string name = "\"\'\\/\b\f\n\r\t\n";
@@ -673,6 +662,10 @@ TEST_F(LayerWithNullDelegateTest, EscapedDebugNames) {
EXPECT_EQ(name, roundtrip);
}
+void ReturnMailbox(bool* run, uint32 sync_point, bool is_lost) {
+ *run = true;
+}
+
TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) {
scoped_ptr<Layer> l1(CreateColorLayer(SK_ColorRED,
gfx::Rect(20, 20, 400, 400)));
@@ -689,9 +682,12 @@ TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) {
cc::Layer* before_layer = l1->cc_layer();
- scoped_refptr<Texture> texture =
- new FakeTexture(false, gfx::Size(10, 10), 1.f);
- l1->SetExternalTexture(texture.get());
+ bool callback1_run = false;
+ cc::TextureMailbox mailbox(gpu::Mailbox::Generate(), 0, 0);
+ l1->SetTextureMailbox(mailbox,
+ cc::SingleReleaseCallback::Create(
+ base::Bind(ReturnMailbox, &callback1_run)),
+ gfx::Size(1, 1));
EXPECT_NE(before_layer, l1->cc_layer());
@@ -701,6 +697,25 @@ TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) {
EXPECT_TRUE(l1->cc_layer()->contents_opaque());
EXPECT_TRUE(l1->cc_layer()->force_render_surface());
EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree());
+ EXPECT_FALSE(callback1_run);
+
+ bool callback2_run = false;
+ mailbox = cc::TextureMailbox(gpu::Mailbox::Generate(), 0, 0);
+ l1->SetTextureMailbox(mailbox,
+ cc::SingleReleaseCallback::Create(
+ base::Bind(ReturnMailbox, &callback2_run)),
+ gfx::Size(1, 1));
+ EXPECT_TRUE(callback1_run);
+ EXPECT_FALSE(callback2_run);
+
+ l1->SetShowPaintedContent();
+ EXPECT_EQ(gfx::PointF().ToString(),
+ l1->cc_layer()->anchor_point().ToString());
+ EXPECT_TRUE(l1->cc_layer()->DrawsContent());
+ EXPECT_TRUE(l1->cc_layer()->contents_opaque());
+ EXPECT_TRUE(l1->cc_layer()->force_render_surface());
+ EXPECT_TRUE(l1->cc_layer()->hide_layer_and_subtree());
+ EXPECT_TRUE(callback2_run);
}
// Various visibile/drawn assertions.
« no previous file with comments | « ui/compositor/layer_owner_delegate.h ('k') | ui/views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698