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

Side by Side Diff: ui/aura_shell/stacking_controller_unittest.cc

Issue 8894018: 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/aura_shell/stacking_controller.h"
6
7 #include "ui/aura/root_window.h"
8 #include "ui/aura/test/event_generator.h"
9 #include "ui/aura/test/test_windows.h"
10 #include "ui/aura/test/test_window_delegate.h"
11 #include "ui/aura_shell/test/aura_shell_test_base.h"
12
13 namespace aura_shell {
14 namespace test {
15
16 typedef aura_shell::test::AuraShellTestBase StackingControllerTest;
17
18 TEST_F(StackingControllerTest, GetTopmostWindowToActivate) {
19 aura::test::ActivateWindowDelegate activate;
20 aura::test::ActivateWindowDelegate non_activate(false);
21
22 scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(
23 &non_activate, 1, gfx::Rect(), NULL));
24 scoped_ptr<aura::Window> w2(aura::test::CreateTestWindowWithDelegate(
25 &activate, 2, gfx::Rect(), NULL));
26 scoped_ptr<aura::Window> w3(aura::test::CreateTestWindowWithDelegate(
27 &non_activate, 3, gfx::Rect(), NULL));
28 EXPECT_EQ(w2.get(), aura::RootWindow::GetInstance()->stacking_client()->
29 GetTopmostWindowToActivate(NULL));
30 }
31
32 // Test if the clicking on a menu picks the transient parent as activatable
33 // window.
34 TEST_F(StackingControllerTest, ClickOnMenu) {
35 aura::test::ActivateWindowDelegate activate;
36 aura::test::ActivateWindowDelegate non_activate(false);
37
38 scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(
39 &activate, 1, gfx::Rect(100, 100), NULL));
40 EXPECT_EQ(NULL, aura::RootWindow::GetInstance()->active_window());
41
42 // Clicking on an activatable window activtes the window.
43 aura::test::EventGenerator generator(w1.get());
44 generator.ClickLeftButton();
45 EXPECT_EQ(w1.get(), aura::RootWindow::GetInstance()->active_window());
46
47 // Creates a menu that covers the transient parent.
48 scoped_ptr<aura::Window> menu(aura::test::CreateTestWindowWithDelegateAndType(
49 &non_activate, aura::WINDOW_TYPE_MENU, 2, gfx::Rect(100, 100), NULL));
50 w1->AddTransientChild(menu.get());
51
52 // Clicking on a menu whose transient parent is active window shouldn't
53 // change the active window.
54 generator.ClickLeftButton();
55 EXPECT_EQ(w1.get(), aura::RootWindow::GetInstance()->active_window());
56 }
57
58 } // namespace test
59 } // namespace aura_shell
OLDNEW
« 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