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

Side by Side Diff: ui/aura/window_unittest.cc

Issue 8570011: Aura: windows in aura should honor Widget::InitParams::accept_events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: modified according to comments Created 9 years, 1 month 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/window.cc ('k') | views/widget/native_widget_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/aura/window.h" 5 #include "ui/aura/window.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 w121->Focus(); 657 w121->Focus();
658 EXPECT_EQ(w121.get(), w1->GetFocusManager()->GetFocusedWindow()); 658 EXPECT_EQ(w121.get(), w1->GetFocusManager()->GetFocusedWindow());
659 659
660 // An attempt to focus 111 should be ignored and w121 should retain focus, 660 // An attempt to focus 111 should be ignored and w121 should retain focus,
661 // since a consumes_events_ window with a child is in the z-index above w111. 661 // since a consumes_events_ window with a child is in the z-index above w111.
662 EXPECT_FALSE(w111->CanFocus()); 662 EXPECT_FALSE(w111->CanFocus());
663 w111->Focus(); 663 w111->Focus();
664 EXPECT_EQ(w121.get(), w1->GetFocusManager()->GetFocusedWindow()); 664 EXPECT_EQ(w121.get(), w1->GetFocusManager()->GetFocusedWindow());
665 } 665 }
666 666
667 TEST_F(WindowTest, IgnoreEventsTest) {
668 TestWindowDelegate d11;
669 TestWindowDelegate d12;
670 TestWindowDelegate d111;
671 TestWindowDelegate d121;
672 scoped_ptr<Window> w1(CreateTestWindowWithDelegate(NULL, 1,
673 gfx::Rect(0, 0, 500, 500), NULL));
674 scoped_ptr<Window> w11(CreateTestWindowWithDelegate(&d11, 11,
675 gfx::Rect(0, 0, 500, 500), w1.get()));
676 scoped_ptr<Window> w111(CreateTestWindowWithDelegate(&d111, 111,
677 gfx::Rect(50, 50, 450, 450), w11.get()));
678 scoped_ptr<Window> w12(CreateTestWindowWithDelegate(&d12, 12,
679 gfx::Rect(0, 0, 500, 500), w1.get()));
680 scoped_ptr<Window> w121(CreateTestWindowWithDelegate(&d121, 121,
681 gfx::Rect(150, 150, 50, 50), w12.get()));
682
683 EXPECT_EQ(w12.get(), w1->GetEventHandlerForPoint(gfx::Point(10, 10)));
684 w12->set_ignore_events(true);
685 EXPECT_EQ(w11.get(), w1->GetEventHandlerForPoint(gfx::Point(10, 10)));
686 w12->set_ignore_events(false);
687
688 EXPECT_EQ(w121.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160)));
689 w121->set_ignore_events(true);
690 EXPECT_EQ(w12.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160)));
691 w12->set_ignore_events(true);
692 EXPECT_EQ(w111.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160)));
693 w111->set_ignore_events(true);
694 EXPECT_EQ(w11.get(), w1->GetEventHandlerForPoint(gfx::Point(160, 160)));
695 }
696
667 // Various assertions for activating/deactivating. 697 // Various assertions for activating/deactivating.
668 TEST_F(WindowTest, Deactivate) { 698 TEST_F(WindowTest, Deactivate) {
669 TestWindowDelegate d1; 699 TestWindowDelegate d1;
670 TestWindowDelegate d2; 700 TestWindowDelegate d2;
671 scoped_ptr<Window> w1( 701 scoped_ptr<Window> w1(
672 CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(), NULL)); 702 CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(), NULL));
673 scoped_ptr<Window> w2( 703 scoped_ptr<Window> w2(
674 CreateTestWindowWithDelegate(&d2, 2, gfx::Rect(), NULL)); 704 CreateTestWindowWithDelegate(&d2, 2, gfx::Rect(), NULL));
675 Window* parent = w1->parent(); 705 Window* parent = w1->parent();
676 parent->Show(); 706 parent->Show();
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 1086
1057 w3->Activate(); 1087 w3->Activate();
1058 EXPECT_EQ(w2.get(), active()); 1088 EXPECT_EQ(w2.get(), active());
1059 1089
1060 w1->Activate(); 1090 w1->Activate();
1061 EXPECT_EQ(w1.get(), active()); 1091 EXPECT_EQ(w1.get(), active());
1062 } 1092 }
1063 1093
1064 } // namespace test 1094 } // namespace test
1065 } // namespace aura 1095 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window.cc ('k') | views/widget/native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698