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 "ui/views/widget/native_widget_aura.h" | 5 #include "ui/views/widget/native_widget_aura.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 12 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
15 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
16 #include "ui/aura/layout_manager.h" | 16 #include "ui/aura/layout_manager.h" |
17 #include "ui/aura/test/aura_test_base.h" | 17 #include "ui/aura/test/aura_test_base.h" |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/aura/window_observer.h" | 19 #include "ui/aura/window_observer.h" |
20 #include "ui/aura/window_tree_host.h" | 20 #include "ui/aura/window_tree_host.h" |
| 21 #include "ui/compositor/layer_type.h" |
21 #include "ui/events/event.h" | 22 #include "ui/events/event.h" |
22 #include "ui/events/event_utils.h" | 23 #include "ui/events/event_utils.h" |
23 #include "ui/views/layout/fill_layout.h" | 24 #include "ui/views/layout/fill_layout.h" |
24 #include "ui/views/test/widget_test.h" | 25 #include "ui/views/test/widget_test.h" |
25 #include "ui/views/widget/root_view.h" | 26 #include "ui/views/widget/root_view.h" |
26 #include "ui/views/widget/widget_delegate.h" | 27 #include "ui/views/widget/widget_delegate.h" |
27 #include "ui/wm/core/base_focus_rules.h" | 28 #include "ui/wm/core/base_focus_rules.h" |
28 #include "ui/wm/core/default_activation_client.h" | 29 #include "ui/wm/core/default_activation_client.h" |
29 #include "ui/wm/core/focus_controller.h" | 30 #include "ui/wm/core/focus_controller.h" |
30 | 31 |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 479 |
479 // Point is over |child|. | 480 // Point is over |child|. |
480 EXPECT_EQ(child->GetNativeWindow(), | 481 EXPECT_EQ(child->GetNativeWindow(), |
481 parent->GetNativeWindow()->GetEventHandlerForPoint( | 482 parent->GetNativeWindow()->GetEventHandlerForPoint( |
482 gfx::Point(50, 50))); | 483 gfx::Point(50, 50))); |
483 | 484 |
484 // Create a view with a layer and stack it at the bottom (below |child|). | 485 // Create a view with a layer and stack it at the bottom (below |child|). |
485 views::View* view_with_layer = new views::View; | 486 views::View* view_with_layer = new views::View; |
486 parent_root->AddChildView(view_with_layer); | 487 parent_root->AddChildView(view_with_layer); |
487 view_with_layer->SetBounds(0, 0, 50, 50); | 488 view_with_layer->SetBounds(0, 0, 50, 50); |
488 view_with_layer->SetPaintToLayer(true); | 489 view_with_layer->SetPaintToLayer(ui::LAYER_TEXTURED); |
489 | 490 |
490 // Make sure that |child| still gets the event. | 491 // Make sure that |child| still gets the event. |
491 EXPECT_EQ(child->GetNativeWindow(), | 492 EXPECT_EQ(child->GetNativeWindow(), |
492 parent->GetNativeWindow()->GetEventHandlerForPoint( | 493 parent->GetNativeWindow()->GetEventHandlerForPoint( |
493 gfx::Point(20, 20))); | 494 gfx::Point(20, 20))); |
494 | 495 |
495 // Move |view_with_layer| to the top and make sure it gets the | 496 // Move |view_with_layer| to the top and make sure it gets the |
496 // event when the point is within |view_with_layer|'s bounds. | 497 // event when the point is within |view_with_layer|'s bounds. |
497 view_with_layer->layer()->parent()->StackAtTop( | 498 view_with_layer->layer()->parent()->StackAtTop( |
498 view_with_layer->layer()); | 499 view_with_layer->layer()); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 EXPECT_FALSE(delegate.view()->HasFocus()); | 598 EXPECT_FALSE(delegate.view()->HasFocus()); |
598 | 599 |
599 test_focus_rules()->set_can_activate(true); | 600 test_focus_rules()->set_can_activate(true); |
600 views::test::TestInitialFocusWidgetDelegate delegate2(root_window()); | 601 views::test::TestInitialFocusWidgetDelegate delegate2(root_window()); |
601 delegate2.GetWidget()->Show(); | 602 delegate2.GetWidget()->Show(); |
602 EXPECT_TRUE(delegate2.view()->HasFocus()); | 603 EXPECT_TRUE(delegate2.view()->HasFocus()); |
603 } | 604 } |
604 | 605 |
605 } // namespace | 606 } // namespace |
606 } // namespace views | 607 } // namespace views |
OLD | NEW |