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

Unified Diff: ash/wm/shadow_controller_unittest.cc

Issue 9414028: Aura: New window shadows, desktop background debug toggle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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
Index: ash/wm/shadow_controller_unittest.cc
diff --git a/ash/wm/shadow_controller_unittest.cc b/ash/wm/shadow_controller_unittest.cc
index d91ced72c6b2fbb71578468e959fdaf65151fe85..2d07f5077b862880a6e2413352884322956763e9 100644
--- a/ash/wm/shadow_controller_unittest.cc
+++ b/ash/wm/shadow_controller_unittest.cc
@@ -12,13 +12,14 @@
#include "ash/wm/shadow.h"
#include "ash/wm/shadow_types.h"
#include "ash/wm/window_properties.h"
+#include "ash/wm/window_util.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
#include "ui/gfx/compositor/layer.h"
namespace ash {
-namespace test {
+namespace internal {
typedef ash::test::AuraShellTestBase ShadowControllerTest;
@@ -87,5 +88,39 @@ TEST_F(ShadowControllerTest, ShadowBounds) {
shadow->content_bounds().ToString());
}
-} // namespace test
+// Tests that activating a window changes the shadow style.
+TEST_F(ShadowControllerTest, ShadowStyle) {
+ ShadowController::TestApi api(
+ ash::Shell::GetInstance()->shadow_controller());
+
+ scoped_ptr<aura::Window> window1(new aura::Window(NULL));
+ window1->SetType(aura::client::WINDOW_TYPE_NORMAL);
+ window1->Init(ui::Layer::LAYER_TEXTURED);
+ window1->SetParent(NULL);
+ window1->SetBounds(gfx::Rect(10, 20, 300, 400));
+ window1->Show();
+ ActivateWindow(window1.get());
+
+ // window1 is active, so style should have active appearance.
+ Shadow* shadow1 = api.GetShadowForWindow(window1.get());
+ ASSERT_TRUE(shadow1 != NULL);
+ EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow1->style());
+
+ // Create another window and activate it.
+ scoped_ptr<aura::Window> window2(new aura::Window(NULL));
+ window2->SetType(aura::client::WINDOW_TYPE_NORMAL);
+ window2->Init(ui::Layer::LAYER_TEXTURED);
+ window2->SetParent(NULL);
+ window2->SetBounds(gfx::Rect(11, 21, 301, 401));
+ window2->Show();
+ ActivateWindow(window2.get());
+
+ // window1 is now inactive, so shadow should go inactive.
+ Shadow* shadow2 = api.GetShadowForWindow(window2.get());
+ ASSERT_TRUE(shadow2 != NULL);
+ EXPECT_EQ(Shadow::STYLE_INACTIVE, shadow1->style());
+ EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow2->style());
+}
+
+} // namespace internal
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698