OLD | NEW |
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 "ash/wm/system_modal_container_layout_manager.h" | 5 #include "ash/wm/system_modal_container_layout_manager.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
12 #include "ash/test/capture_tracking_view.h" | |
13 #include "ash/wm/window_util.h" | 12 #include "ash/wm/window_util.h" |
14 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
15 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
16 #include "ui/aura/test/event_generator.h" | 15 #include "ui/aura/test/event_generator.h" |
17 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
18 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
19 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
| 19 #include "ui/views/test/capture_tracking_view.h" |
20 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
21 #include "ui/views/widget/widget_delegate.h" | 21 #include "ui/views/widget/widget_delegate.h" |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 namespace test { | 24 namespace test { |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 aura::Window* GetModalContainer() { | 28 aura::Window* GetModalContainer() { |
29 return Shell::GetPrimaryRootWindowController()->GetContainer( | 29 return Shell::GetPrimaryRootWindowController()->GetContainer( |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 TestWindow::OpenTestWindow(parent.get(), true)); | 326 TestWindow::OpenTestWindow(parent.get(), true)); |
327 parent->Show(); | 327 parent->Show(); |
328 modal_window->Show(); | 328 modal_window->Show(); |
329 } | 329 } |
330 | 330 |
331 // Verifies we generate a capture lost when showing a modal window. | 331 // Verifies we generate a capture lost when showing a modal window. |
332 TEST_F(SystemModalContainerLayoutManagerTest, ChangeCapture) { | 332 TEST_F(SystemModalContainerLayoutManagerTest, ChangeCapture) { |
333 views::Widget* widget = | 333 views::Widget* widget = |
334 views::Widget::CreateWindowWithParent(new TestWindow(false), NULL); | 334 views::Widget::CreateWindowWithParent(new TestWindow(false), NULL); |
335 scoped_ptr<aura::Window> widget_window(widget->GetNativeView()); | 335 scoped_ptr<aura::Window> widget_window(widget->GetNativeView()); |
336 CaptureTrackingView* view = new CaptureTrackingView; | 336 views::test::CaptureTrackingView* view = new views::test::CaptureTrackingView; |
337 widget->GetContentsView()->AddChildView(view); | 337 widget->GetContentsView()->AddChildView(view); |
338 view->SetBoundsRect(widget->GetContentsView()->bounds()); | 338 view->SetBoundsRect(widget->GetContentsView()->bounds()); |
339 widget->Show(); | 339 widget->Show(); |
340 | 340 |
341 gfx::Point center(view->width() / 2, view->height() / 2); | 341 gfx::Point center(view->width() / 2, view->height() / 2); |
342 views::View::ConvertPointToScreen(view, ¢er); | 342 views::View::ConvertPointToScreen(view, ¢er); |
343 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), center); | 343 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), center); |
344 generator.PressLeftButton(); | 344 generator.PressLeftButton(); |
345 EXPECT_TRUE(view->got_press()); | 345 EXPECT_TRUE(view->got_press()); |
346 scoped_ptr<aura::Window> modal_window( | 346 scoped_ptr<aura::Window> modal_window( |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 459 |
460 // No more modal screen. | 460 // No more modal screen. |
461 modal1->Hide(); | 461 modal1->Hide(); |
462 modal1.reset(); | 462 modal1.reset(); |
463 EXPECT_FALSE(AllRootWindowsHaveModalBackgrounds()); | 463 EXPECT_FALSE(AllRootWindowsHaveModalBackgrounds()); |
464 EXPECT_TRUE(wm::IsActiveWindow(normal.get())); | 464 EXPECT_TRUE(wm::IsActiveWindow(normal.get())); |
465 } | 465 } |
466 | 466 |
467 } // namespace test | 467 } // namespace test |
468 } // namespace ash | 468 } // namespace ash |
OLD | NEW |