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

Unified Diff: ash/wm/window_state_unittest.cc

Issue 1474993003: Ensure View invalidates Widget::root_layers_ when LayerOwner::RecreateLayer is invoked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ordering is hard Created 5 years, 1 month 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 | « no previous file | ui/compositor/layer_owner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_state_unittest.cc
diff --git a/ash/wm/window_state_unittest.cc b/ash/wm/window_state_unittest.cc
index d816cf7d11ba78e0f66a6fd659b7367f98e785fa..cbb6ab5855a18491e24607adc79beaa64b1ec1cb 100644
--- a/ash/wm/window_state_unittest.cc
+++ b/ash/wm/window_state_unittest.cc
@@ -12,6 +12,7 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window.h"
+#include "ui/views/widget/widget.h"
namespace ash {
namespace wm {
@@ -337,5 +338,32 @@ TEST_F(WindowStateTest, RestoredWindowBoundsShrink) {
// TODO(skuhne): Add more unit test to verify the correctness for the restore
// operation.
+// Tests for correct ownership of window sublayers during crossfade transitions.
+TEST_F(WindowStateTest, RecreateLayersDuringCrossfade) {
sky 2015/11/30 16:52:09 This test is ok, but you're relying on maximize re
tapted 2015/12/01 04:34:43 I did this in Patchset 4, but it made the connecti
+ views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds(
+ nullptr, CurrentContext(), gfx::Rect(100, 100, 100, 100));
+
+ views::View* view = new views::View;
+ view->SetBounds(20, 20, 20, 20);
+ widget->GetContentsView()->AddChildView(view);
+ widget->Show();
+
+ EXPECT_EQ(0u, widget->GetRootLayers().size());
+ view->SetPaintToLayer(true);
+ EXPECT_EQ(1u, widget->GetRootLayers().size());
+ ui::Layer* old_layer = widget->GetRootLayers()[0];
+
+ // On Ash, Maximize will trigger WindowState::SetBoundsDirectCrossFade() to
+ // start a crossfade animation after invoking ::wm::RecreateLayers().
+ widget->Maximize();
+
+ EXPECT_EQ(1u, widget->GetRootLayers().size());
+
+ // The layer should be different, since the old layer is in the crossfade.
+ EXPECT_NE(old_layer, widget->GetRootLayers()[0]);
+
+ widget->CloseNow();
+}
+
} // namespace wm
} // namespace ash
« no previous file with comments | « no previous file | ui/compositor/layer_owner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698