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

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

Issue 12092051: Reenable synthesized mouse event on win aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/root_window.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <utility> 7 #include <utility>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 EXPECT_FALSE(d1.exited()); 1161 EXPECT_FALSE(d1.exited());
1162 d1.ResetExpectations(); 1162 d1.ResetExpectations();
1163 1163
1164 ui::MouseEvent exit_event( 1164 ui::MouseEvent exit_event(
1165 ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), 0); 1165 ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), 0);
1166 root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit_event); 1166 root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit_event);
1167 EXPECT_FALSE(d1.entered()); 1167 EXPECT_FALSE(d1.entered());
1168 EXPECT_TRUE(d1.exited()); 1168 EXPECT_TRUE(d1.exited());
1169 } 1169 }
1170 1170
1171 #if !defined(OS_WIN)
1172 // Verifies that the WindowDelegate receives MouseExit and MouseEnter events for 1171 // Verifies that the WindowDelegate receives MouseExit and MouseEnter events for
1173 // mouse transitions from window to window, even if the entered window sets 1172 // mouse transitions from window to window, even if the entered window sets
1174 // and releases capture. 1173 // and releases capture.
1175 TEST_F(WindowTest, MouseEnterExitWithClick) { 1174 TEST_F(WindowTest, MouseEnterExitWithClick) {
1176 MouseEnterExitWindowDelegate d1; 1175 MouseEnterExitWindowDelegate d1;
1177 scoped_ptr<Window> w1( 1176 scoped_ptr<Window> w1(
1178 CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(10, 10, 50, 50), 1177 CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(10, 10, 50, 50),
1179 root_window())); 1178 root_window()));
1180 MouseEnterExitWindowDelegate d2; 1179 MouseEnterExitWindowDelegate d2;
1181 scoped_ptr<Window> w2( 1180 scoped_ptr<Window> w2(
(...skipping 13 matching lines...) Expand all
1195 w1->ReleaseCapture(); 1194 w1->ReleaseCapture();
1196 generator.ReleaseLeftButton(); 1195 generator.ReleaseLeftButton();
1197 1196
1198 generator.MoveMouseToCenterOf(w2.get()); 1197 generator.MoveMouseToCenterOf(w2.get());
1199 EXPECT_TRUE(d1.entered()); 1198 EXPECT_TRUE(d1.entered());
1200 EXPECT_TRUE(d1.exited()); 1199 EXPECT_TRUE(d1.exited());
1201 EXPECT_TRUE(d2.entered()); 1200 EXPECT_TRUE(d2.entered());
1202 EXPECT_FALSE(d2.exited()); 1201 EXPECT_FALSE(d2.exited());
1203 } 1202 }
1204 1203
1205 // Temporarily disabled for windows. See crbug.com/112222.
1206 // Verifies that enter / exits are sent if windows appear and are deleted 1204 // Verifies that enter / exits are sent if windows appear and are deleted
1207 // under the current mouse position.. 1205 // under the current mouse position..
1208 TEST_F(WindowTest, MouseEnterExitWithDelete) { 1206 TEST_F(WindowTest, MouseEnterExitWithDelete) {
1209 MouseEnterExitWindowDelegate d1; 1207 MouseEnterExitWindowDelegate d1;
1210 scoped_ptr<Window> w1( 1208 scoped_ptr<Window> w1(
1211 CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(10, 10, 50, 50), 1209 CreateTestWindowWithDelegate(&d1, 1, gfx::Rect(10, 10, 50, 50),
1212 root_window())); 1210 root_window()));
1213 1211
1214 test::EventGenerator generator(root_window()); 1212 test::EventGenerator generator(root_window());
1215 generator.MoveMouseToCenterOf(w1.get()); 1213 generator.MoveMouseToCenterOf(w1.get());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 EXPECT_TRUE(d1.exited()); 1255 EXPECT_TRUE(d1.exited());
1258 EXPECT_TRUE(d2.entered()); 1256 EXPECT_TRUE(d2.entered());
1259 EXPECT_FALSE(d2.exited()); 1257 EXPECT_FALSE(d2.exited());
1260 1258
1261 d1.ResetExpectations(); 1259 d1.ResetExpectations();
1262 w2->Hide(); 1260 w2->Hide();
1263 // Enters / exits can be send asynchronously. 1261 // Enters / exits can be send asynchronously.
1264 RunAllPendingInMessageLoop(); 1262 RunAllPendingInMessageLoop();
1265 EXPECT_TRUE(d1.entered()); 1263 EXPECT_TRUE(d1.entered());
1266 } 1264 }
1267 #endif
1268 1265
1269 // Creates a window with a delegate (w111) that can handle events at a lower 1266 // Creates a window with a delegate (w111) that can handle events at a lower
1270 // z-index than a window without a delegate (w12). w12 is sized to fill the 1267 // z-index than a window without a delegate (w12). w12 is sized to fill the
1271 // entire bounds of the container. This test verifies that 1268 // entire bounds of the container. This test verifies that
1272 // GetEventHandlerForPoint() skips w12 even though its bounds contain the event, 1269 // GetEventHandlerForPoint() skips w12 even though its bounds contain the event,
1273 // because it has no children that can handle the event and it has no delegate 1270 // because it has no children that can handle the event and it has no delegate
1274 // allowing it to handle the event itself. 1271 // allowing it to handle the event itself.
1275 TEST_F(WindowTest, GetEventHandlerForPoint_NoDelegate) { 1272 TEST_F(WindowTest, GetEventHandlerForPoint_NoDelegate) {
1276 TestWindowDelegate d111; 1273 TestWindowDelegate d111;
1277 scoped_ptr<Window> w1(CreateTestWindowWithDelegate(NULL, 1, 1274 scoped_ptr<Window> w1(CreateTestWindowWithDelegate(NULL, 1,
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 EXPECT_FALSE(window->IsVisible()); 2006 EXPECT_FALSE(window->IsVisible());
2010 EXPECT_FALSE(window->layer()->visible()); 2007 EXPECT_FALSE(window->layer()->visible());
2011 window->Show(); 2008 window->Show();
2012 2009
2013 client.set_ignore_visibility_changes(true); 2010 client.set_ignore_visibility_changes(true);
2014 window->Hide(); 2011 window->Hide();
2015 EXPECT_FALSE(window->IsVisible()); 2012 EXPECT_FALSE(window->IsVisible());
2016 EXPECT_TRUE(window->layer()->visible()); 2013 EXPECT_TRUE(window->layer()->visible());
2017 } 2014 }
2018 2015
2019 #if !defined(OS_WIN)
2020 // Temporarily disabled for windows. See crbug.com/112222.
2021
2022 // Tests mouse events on window change. 2016 // Tests mouse events on window change.
2023 TEST_F(WindowTest, MouseEventsOnWindowChange) { 2017 TEST_F(WindowTest, MouseEventsOnWindowChange) {
2024 gfx::Size size = root_window()->GetHostSize(); 2018 gfx::Size size = root_window()->GetHostSize();
2025 2019
2026 EventGenerator generator(root_window()); 2020 EventGenerator generator(root_window());
2027 generator.MoveMouseTo(50, 50); 2021 generator.MoveMouseTo(50, 50);
2028 2022
2029 EventCountDelegate d1; 2023 EventCountDelegate d1;
2030 scoped_ptr<Window> w1(CreateTestWindowWithDelegate(&d1, 1, 2024 scoped_ptr<Window> w1(CreateTestWindowWithDelegate(&d1, 1,
2031 gfx::Rect(0, 0, 100, 100), root_window())); 2025 gfx::Rect(0, 0, 100, 100), root_window()));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 w11->SetTransform(gfx::Transform()); 2081 w11->SetTransform(gfx::Transform());
2088 RunAllPendingInMessageLoop(); 2082 RunAllPendingInMessageLoop();
2089 EXPECT_EQ("0 0 1", d1.GetMouseMotionCountsAndReset()); 2083 EXPECT_EQ("0 0 1", d1.GetMouseMotionCountsAndReset());
2090 EXPECT_EQ("1 1 0", d11.GetMouseMotionCountsAndReset()); 2084 EXPECT_EQ("1 1 0", d11.GetMouseMotionCountsAndReset());
2091 2085
2092 // Closing a window. 2086 // Closing a window.
2093 w11.reset(); 2087 w11.reset();
2094 RunAllPendingInMessageLoop(); 2088 RunAllPendingInMessageLoop();
2095 EXPECT_EQ("1 1 0", d1.GetMouseMotionCountsAndReset()); 2089 EXPECT_EQ("1 1 0", d1.GetMouseMotionCountsAndReset());
2096 } 2090 }
2097 #endif
2098 2091
2099 class StackingMadrigalLayoutManager : public LayoutManager { 2092 class StackingMadrigalLayoutManager : public LayoutManager {
2100 public: 2093 public:
2101 explicit StackingMadrigalLayoutManager(RootWindow* root_window) 2094 explicit StackingMadrigalLayoutManager(RootWindow* root_window)
2102 : root_window_(root_window) { 2095 : root_window_(root_window) {
2103 root_window_->SetLayoutManager(this); 2096 root_window_->SetLayoutManager(this);
2104 } 2097 }
2105 virtual ~StackingMadrigalLayoutManager() { 2098 virtual ~StackingMadrigalLayoutManager() {
2106 } 2099 }
2107 2100
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
2842 o.ValidateState(index++, params); 2835 o.ValidateState(index++, params);
2843 2836
2844 w1.reset(); 2837 w1.reset();
2845 w2.reset(); 2838 w2.reset();
2846 } 2839 }
2847 2840
2848 } 2841 }
2849 2842
2850 } // namespace test 2843 } // namespace test
2851 } // namespace aura 2844 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698