| 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 "apps/ui/views/app_window_frame_view.h" |
| 7 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" | 8 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" |
| 8 #include "ui/aura/test/aura_test_base.h" | 9 #include "ui/aura/test/aura_test_base.h" |
| 9 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_event_dispatcher.h" | 11 #include "ui/aura/window_event_dispatcher.h" |
| 11 #include "ui/views/controls/webview/webview.h" | 12 #include "ui/views/controls/webview/webview.h" |
| 12 #include "ui/wm/core/easy_resize_window_targeter.h" | 13 #include "ui/wm/core/easy_resize_window_targeter.h" |
| 13 | 14 |
| 14 class ShapedAppWindowTargeterTest : public aura::test::AuraTestBase { | 15 class ShapedAppWindowTargeterTest : public aura::test::AuraTestBase { |
| 15 public: | 16 public: |
| 16 ShapedAppWindowTargeterTest() | 17 ShapedAppWindowTargeterTest() |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // |window| as its target. | 178 // |window| as its target. |
| 178 ui::MouseEvent move(ui::ET_MOUSE_MOVED, | 179 ui::MouseEvent move(ui::ET_MOUSE_MOVED, |
| 179 gfx::Point(32, 37), gfx::Point(32, 37), | 180 gfx::Point(32, 37), gfx::Point(32, 37), |
| 180 ui::EF_NONE, ui::EF_NONE); | 181 ui::EF_NONE, ui::EF_NONE); |
| 181 ui::EventDispatchDetails details = | 182 ui::EventDispatchDetails details = |
| 182 event_processor()->OnEventFromSource(&move); | 183 event_processor()->OnEventFromSource(&move); |
| 183 ASSERT_FALSE(details.dispatcher_destroyed); | 184 ASSERT_FALSE(details.dispatcher_destroyed); |
| 184 EXPECT_EQ(window, move.target()); | 185 EXPECT_EQ(window, move.target()); |
| 185 } | 186 } |
| 186 | 187 |
| 187 // The EasyResizeTargeter specifies an inset of 5px within the window. | 188 #if !defined(OS_CHROMEOS) |
| 188 app_window_views()->InstallEasyResizeTargeterOnContainer(); | 189 // The non standard app frame has a easy resize targetter installed. |
| 189 | 190 scoped_ptr<apps::AppWindowFrameView> frame( |
| 191 app_window_views()->CreateNonStandardAppFrame()); |
| 190 { | 192 { |
| 191 // Ensure that the window has an event targeter (there should be an | 193 // Ensure that the window has an event targeter (there should be an |
| 192 // EasyResizeWindowTargeter installed). | 194 // EasyResizeWindowTargeter installed). |
| 193 EXPECT_TRUE(static_cast<ui::EventTarget*>(window)->GetEventTargeter()); | 195 EXPECT_TRUE(static_cast<ui::EventTarget*>(window)->GetEventTargeter()); |
| 194 } | 196 } |
| 195 { | 197 { |
| 196 // An event in the center of the window should always have | 198 // An event in the center of the window should always have |
| 197 // |window| as its target. | 199 // |window| as its target. |
| 198 // TODO(mgiuca): This isn't really testing anything (note that it has the | 200 // TODO(mgiuca): This isn't really testing anything (note that it has the |
| 199 // same expectation as the border case below). In the real environment, the | 201 // same expectation as the border case below). In the real environment, the |
| (...skipping 16 matching lines...) Expand all Loading... |
| 216 // inside the window and within 5px of an edge should have | 218 // inside the window and within 5px of an edge should have |
| 217 // |window| as its target. | 219 // |window| as its target. |
| 218 ui::MouseEvent move(ui::ET_MOUSE_MOVED, | 220 ui::MouseEvent move(ui::ET_MOUSE_MOVED, |
| 219 gfx::Point(32, 37), gfx::Point(32, 37), | 221 gfx::Point(32, 37), gfx::Point(32, 37), |
| 220 ui::EF_NONE, ui::EF_NONE); | 222 ui::EF_NONE, ui::EF_NONE); |
| 221 ui::EventDispatchDetails details = | 223 ui::EventDispatchDetails details = |
| 222 event_processor()->OnEventFromSource(&move); | 224 event_processor()->OnEventFromSource(&move); |
| 223 ASSERT_FALSE(details.dispatcher_destroyed); | 225 ASSERT_FALSE(details.dispatcher_destroyed); |
| 224 EXPECT_EQ(window, move.target()); | 226 EXPECT_EQ(window, move.target()); |
| 225 } | 227 } |
| 228 #endif // defined (OS_CHROMEOS) |
| 226 } | 229 } |
| OLD | NEW |