Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/views/apps/shaped_app_window_targeter.h" | 5 #include "chrome/browser/ui/views/apps/shaped_app_window_targeter.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" | 7 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" |
| 8 #include "ui/aura/test/aura_test_base.h" | 8 #include "ui/aura/test/aura_test_base.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 ui::EventDispatchDetails details = | 181 ui::EventDispatchDetails details = |
| 182 event_processor()->OnEventFromSource(&move); | 182 event_processor()->OnEventFromSource(&move); |
| 183 ASSERT_FALSE(details.dispatcher_destroyed); | 183 ASSERT_FALSE(details.dispatcher_destroyed); |
| 184 EXPECT_EQ(window, move.target()); | 184 EXPECT_EQ(window, move.target()); |
| 185 } | 185 } |
| 186 | 186 |
| 187 // The EasyResizeTargeter specifies an inset of 5px within the window. | 187 // The EasyResizeTargeter specifies an inset of 5px within the window. |
| 188 app_window_views()->InstallEasyResizeTargeterOnContainer(); | 188 app_window_views()->InstallEasyResizeTargeterOnContainer(); |
| 189 | 189 |
| 190 { | 190 { |
| 191 // Ensure that the window has an event targeter (there should be an | |
| 192 // EasyResizeWindowTargeter installed). | |
| 193 EXPECT_TRUE(static_cast<ui::EventTarget*>(window)->GetEventTargeter()); | |
| 194 } | |
| 195 { | |
| 191 // An event in the center of the window should always have | 196 // An event in the center of the window should always have |
| 192 // |window| as its target. | 197 // |window| as its target. |
| 193 ui::MouseEvent move(ui::ET_MOUSE_MOVED, | 198 ui::MouseEvent move(ui::ET_MOUSE_MOVED, |
| 194 gfx::Point(80, 80), gfx::Point(80, 80), | 199 gfx::Point(80, 80), gfx::Point(80, 80), |
| 195 ui::EF_NONE, ui::EF_NONE); | 200 ui::EF_NONE, ui::EF_NONE); |
| 196 ui::EventDispatchDetails details = | 201 ui::EventDispatchDetails details = |
| 197 event_processor()->OnEventFromSource(&move); | 202 event_processor()->OnEventFromSource(&move); |
| 198 ASSERT_FALSE(details.dispatcher_destroyed); | 203 ASSERT_FALSE(details.dispatcher_destroyed); |
| 199 EXPECT_EQ(window, move.target()); | 204 EXPECT_EQ(window, move.target()); |
| 200 } | 205 } |
| 201 { | 206 { |
| 202 // With an EasyResizeTargeter on the container, an event | 207 // With an EasyResizeTargeter on the container, an event |
| 203 // inside the window and within 5px of an edge should have | 208 // inside the window and within 5px of an edge should have |
| 204 // root_window() as its target. | 209 // window as its target. |
| 210 // TODO(mgiuca): This basically tests nothing now. The target is |window| | |
| 211 // either way. This expectation will pass even if the | |
| 212 // EasyResizeWindowTargeter is not installed (but the earlier expectation | |
| 213 // will fail). | |
|
Matt Giuca
2014/04/08 09:24:32
Please see my comment #17 and #18 on http://crbug.
| |
| 205 ui::MouseEvent move(ui::ET_MOUSE_MOVED, | 214 ui::MouseEvent move(ui::ET_MOUSE_MOVED, |
| 206 gfx::Point(32, 37), gfx::Point(32, 37), | 215 gfx::Point(32, 37), gfx::Point(32, 37), |
| 207 ui::EF_NONE, ui::EF_NONE); | 216 ui::EF_NONE, ui::EF_NONE); |
| 208 ui::EventDispatchDetails details = | 217 ui::EventDispatchDetails details = |
| 209 event_processor()->OnEventFromSource(&move); | 218 event_processor()->OnEventFromSource(&move); |
| 210 ASSERT_FALSE(details.dispatcher_destroyed); | 219 ASSERT_FALSE(details.dispatcher_destroyed); |
| 211 EXPECT_EQ(root_window(), move.target()); | 220 EXPECT_EQ(window, move.target()); |
| 212 } | 221 } |
| 213 } | 222 } |
| OLD | NEW |