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

Unified Diff: ui/aura_shell/stacking_controller_unittest.cc

Issue 8926004: Revert 114095 - Move the concept of Activation to the Shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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/aura_shell/stacking_controller.cc ('k') | ui/aura_shell/test/test_activation_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_shell/stacking_controller_unittest.cc
===================================================================
--- ui/aura_shell/stacking_controller_unittest.cc (revision 114099)
+++ ui/aura_shell/stacking_controller_unittest.cc (working copy)
@@ -0,0 +1,59 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/aura_shell/stacking_controller.h"
+
+#include "ui/aura/root_window.h"
+#include "ui/aura/test/event_generator.h"
+#include "ui/aura/test/test_windows.h"
+#include "ui/aura/test/test_window_delegate.h"
+#include "ui/aura_shell/test/aura_shell_test_base.h"
+
+namespace aura_shell {
+namespace test {
+
+typedef aura_shell::test::AuraShellTestBase StackingControllerTest;
+
+TEST_F(StackingControllerTest, GetTopmostWindowToActivate) {
+ aura::test::ActivateWindowDelegate activate;
+ aura::test::ActivateWindowDelegate non_activate(false);
+
+ scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(
+ &non_activate, 1, gfx::Rect(), NULL));
+ scoped_ptr<aura::Window> w2(aura::test::CreateTestWindowWithDelegate(
+ &activate, 2, gfx::Rect(), NULL));
+ scoped_ptr<aura::Window> w3(aura::test::CreateTestWindowWithDelegate(
+ &non_activate, 3, gfx::Rect(), NULL));
+ EXPECT_EQ(w2.get(), aura::RootWindow::GetInstance()->stacking_client()->
+ GetTopmostWindowToActivate(NULL));
+}
+
+// Test if the clicking on a menu picks the transient parent as activatable
+// window.
+TEST_F(StackingControllerTest, ClickOnMenu) {
+ aura::test::ActivateWindowDelegate activate;
+ aura::test::ActivateWindowDelegate non_activate(false);
+
+ scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(
+ &activate, 1, gfx::Rect(100, 100), NULL));
+ EXPECT_EQ(NULL, aura::RootWindow::GetInstance()->active_window());
+
+ // Clicking on an activatable window activtes the window.
+ aura::test::EventGenerator generator(w1.get());
+ generator.ClickLeftButton();
+ EXPECT_EQ(w1.get(), aura::RootWindow::GetInstance()->active_window());
+
+ // Creates a menu that covers the transient parent.
+ scoped_ptr<aura::Window> menu(aura::test::CreateTestWindowWithDelegateAndType(
+ &non_activate, aura::WINDOW_TYPE_MENU, 2, gfx::Rect(100, 100), NULL));
+ w1->AddTransientChild(menu.get());
+
+ // Clicking on a menu whose transient parent is active window shouldn't
+ // change the active window.
+ generator.ClickLeftButton();
+ EXPECT_EQ(w1.get(), aura::RootWindow::GetInstance()->active_window());
+}
+
+} // namespace test
+} // namespace aura_shell
Property changes on: ui\aura_shell\stacking_controller_unittest.cc
___________________________________________________________________
Added: svn:mergeinfo
« no previous file with comments | « ui/aura_shell/stacking_controller.cc ('k') | ui/aura_shell/test/test_activation_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698