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

Unified Diff: ui/wm/core/shadow_controller_unittest.cc

Issue 455543004: Use ShadowController instead of creating its own. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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/wm/core/shadow_controller.cc ('k') | ui/wm/core/shadow_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/shadow_controller_unittest.cc
diff --git a/ui/wm/core/shadow_controller_unittest.cc b/ui/wm/core/shadow_controller_unittest.cc
index d82d015f1a0badb133c8414215b6a138b72bb496..477e3ace9bae9d137bdff74f88e63355847621a7 100644
--- a/ui/wm/core/shadow_controller_unittest.cc
+++ b/ui/wm/core/shadow_controller_unittest.cc
@@ -216,4 +216,58 @@ TEST_F(ShadowControllerTest, TransientParentKeepsActiveShadow) {
EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow1->style());
}
+TEST_F(ShadowControllerTest, AlwaysActive) {
+ ShadowController::TestApi api(shadow_controller());
+
+ scoped_ptr<aura::Window> window1(new aura::Window(NULL));
+ window1->SetType(ui::wm::WINDOW_TYPE_NORMAL);
+ window1->Init(aura::WINDOW_LAYER_TEXTURED);
+ ParentWindow(window1.get());
+ window1->SetBounds(gfx::Rect(10, 20, 300, 400));
+ SetShadowType(window1.get(), SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE);
+ window1->Show();
+
+ // Showing the window with SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE should
+ // have active shadow.
+ EXPECT_EQ(Shadow::STYLE_ACTIVE,
+ api.GetShadowForWindow(window1.get())->style());
+
+ scoped_ptr<aura::Window> window2(new aura::Window(NULL));
+ window2->SetType(ui::wm::WINDOW_TYPE_NORMAL);
+ window2->Init(aura::WINDOW_LAYER_TEXTURED);
+ ParentWindow(window2.get());
+ window2->SetBounds(gfx::Rect(11, 21, 301, 401));
+ window2->Show();
+
+ // Setting SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE to the visible window
+ // should set the active shadow.
+ EXPECT_EQ(Shadow::STYLE_INACTIVE,
+ api.GetShadowForWindow(window2.get())->style());
+ SetShadowType(window2.get(), SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE);
+ EXPECT_EQ(Shadow::STYLE_ACTIVE,
+ api.GetShadowForWindow(window2.get())->style());
+
+ // Activation should not change the shadow style.
+ ActivateWindow(window2.get());
+ EXPECT_EQ(Shadow::STYLE_ACTIVE,
+ api.GetShadowForWindow(window1.get())->style());
+ EXPECT_EQ(Shadow::STYLE_ACTIVE,
+ api.GetShadowForWindow(window2.get())->style());
+
+ ActivateWindow(window1.get());
+ EXPECT_EQ(Shadow::STYLE_ACTIVE,
+ api.GetShadowForWindow(window1.get())->style());
+ EXPECT_EQ(Shadow::STYLE_ACTIVE,
+ api.GetShadowForWindow(window2.get())->style());
+
+ // Restore the style to plain RECTANGULAR and make sure the inactive window
+ // gets the inactive shadow.
+ SetShadowType(window1.get(), SHADOW_TYPE_RECTANGULAR);
+ SetShadowType(window2.get(), SHADOW_TYPE_RECTANGULAR);
+ EXPECT_EQ(Shadow::STYLE_ACTIVE,
+ api.GetShadowForWindow(window1.get())->style());
+ EXPECT_EQ(Shadow::STYLE_INACTIVE,
+ api.GetShadowForWindow(window2.get())->style());
+}
+
} // namespace wm
« no previous file with comments | « ui/wm/core/shadow_controller.cc ('k') | ui/wm/core/shadow_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698