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

Unified Diff: ash/wm/activation_controller_unittest.cc

Issue 9719037: Aura: Add non-browser windows into the list of "Alt + Tab" cycle list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix Created 8 years, 9 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 | « ash/wm/activation_controller.cc ('k') | ash/wm/window_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/activation_controller_unittest.cc
diff --git a/ash/wm/activation_controller_unittest.cc b/ash/wm/activation_controller_unittest.cc
index 9bcabc5de211ffaee66ab51eeb6622595a171e66..99773e9e4cf8a6f8642c62e31e0c449fe34c8580 100644
--- a/ash/wm/activation_controller_unittest.cc
+++ b/ash/wm/activation_controller_unittest.cc
@@ -9,6 +9,7 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/test_activation_delegate.h"
#include "ash/wm/window_util.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/focus_manager.h"
#include "ui/aura/root_window.h"
#include "ui/aura/test/event_generator.h"
@@ -318,7 +319,7 @@ TEST_F(ActivationControllerTest, PreventFocusToNonActivatableWindow) {
aura::test::TestWindowDelegate wd;
scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(
&wd, -1, gfx::Rect(50, 50), NULL));
- // The RootWindow itself is a non-activatable parent.
+ // The RootWindow is a non-activatable parent.
scoped_ptr<aura::Window> w2(aura::test::CreateTestWindowWithDelegate(
&wd, -2, gfx::Rect(50, 50), Shell::GetRootWindow()));
scoped_ptr<aura::Window> w21(aura::test::CreateTestWindowWithDelegate(
@@ -350,6 +351,53 @@ TEST_F(ActivationControllerTest, PreventFocusToNonActivatableWindow) {
EXPECT_TRUE(w1->HasFocus());
}
+TEST_F(ActivationControllerTest, CanActivateWindowIteselfTest)
+{
+ aura::test::TestWindowDelegate wd;
+
+ // Normal Window
+ scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(
+ &wd, -1, gfx::Rect(50, 50), NULL));
+ EXPECT_TRUE(wm::CanActivateWindow(w1.get()));
+
+ // The RootWindow is a non-activatable parent.
+ scoped_ptr<aura::Window> w2(aura::test::CreateTestWindowWithDelegate(
+ &wd, -2, gfx::Rect(50, 50), Shell::GetRootWindow()));
+ scoped_ptr<aura::Window> w21(aura::test::CreateTestWindowWithDelegate(
+ &wd, -21, gfx::Rect(50, 50), w2.get()));
+ EXPECT_FALSE(wm::CanActivateWindow(w2.get()));
+ EXPECT_FALSE(wm::CanActivateWindow(w21.get()));
+
+ // The window has a transient child.
+ scoped_ptr<aura::Window> w3(aura::test::CreateTestWindowWithDelegate(
+ &wd, -3, gfx::Rect(50, 50), NULL));
+ scoped_ptr<aura::Window> w31(aura::test::CreateTestWindowWithDelegate(
+ &wd, -31, gfx::Rect(50, 50), NULL));
+ w3->AddTransientChild(w31.get());
+ EXPECT_TRUE(wm::CanActivateWindow(w3.get()));
+ EXPECT_TRUE(wm::CanActivateWindow(w31.get()));
+
+ // The window has a transient window-modal child.
+ scoped_ptr<aura::Window> w4(aura::test::CreateTestWindowWithDelegate(
+ &wd, -4, gfx::Rect(50, 50), NULL));
+ scoped_ptr<aura::Window> w41(aura::test::CreateTestWindowWithDelegate(
+ &wd, -41, gfx::Rect(50, 50), NULL));
+ w4->AddTransientChild(w41.get());
+ w41->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW);
+ EXPECT_FALSE(wm::CanActivateWindow(w4.get()));
+ EXPECT_TRUE(wm::CanActivateWindow(w41.get()));
+
+ // The window has a transient system-modal child.
+ scoped_ptr<aura::Window> w5(aura::test::CreateTestWindowWithDelegate(
+ &wd, -5, gfx::Rect(50, 50), NULL));
+ scoped_ptr<aura::Window> w51(aura::test::CreateTestWindowWithDelegate(
+ &wd, -51, gfx::Rect(50, 50), NULL));
+ w5->AddTransientChild(w51.get());
+ w51->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_SYSTEM);
+ EXPECT_TRUE(wm::CanActivateWindow(w5.get()));
+ EXPECT_TRUE(wm::CanActivateWindow(w51.get()));
+}
+
// Verifies code in ActivationController::OnWindowVisibilityChanged() that keeps
// hiding windows layers stacked above the newly active window while they
// animate away.
« no previous file with comments | « ash/wm/activation_controller.cc ('k') | ash/wm/window_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698