| 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/aura/window.h" | 5 #include "ui/aura/window.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ui/aura/client/window_parenting_client.h" | 23 #include "ui/aura/client/window_parenting_client.h" |
| 24 #include "ui/aura/layout_manager.h" | 24 #include "ui/aura/layout_manager.h" |
| 25 #include "ui/aura/test/aura_test_base.h" | 25 #include "ui/aura/test/aura_test_base.h" |
| 26 #include "ui/aura/test/aura_test_utils.h" | 26 #include "ui/aura/test/aura_test_utils.h" |
| 27 #include "ui/aura/test/test_window_delegate.h" | 27 #include "ui/aura/test/test_window_delegate.h" |
| 28 #include "ui/aura/test/test_windows.h" | 28 #include "ui/aura/test/test_windows.h" |
| 29 #include "ui/aura/test/window_test_api.h" | 29 #include "ui/aura/test/window_test_api.h" |
| 30 #include "ui/aura/window_delegate.h" | 30 #include "ui/aura/window_delegate.h" |
| 31 #include "ui/aura/window_event_dispatcher.h" | 31 #include "ui/aura/window_event_dispatcher.h" |
| 32 #include "ui/aura/window_observer.h" | 32 #include "ui/aura/window_observer.h" |
| 33 #include "ui/aura/window_property.h" | |
| 34 #include "ui/aura/window_tree_host.h" | 33 #include "ui/aura/window_tree_host.h" |
| 34 #include "ui/base/class_property.h" |
| 35 #include "ui/base/hit_test.h" | 35 #include "ui/base/hit_test.h" |
| 36 #include "ui/compositor/layer.h" | 36 #include "ui/compositor/layer.h" |
| 37 #include "ui/compositor/layer_animation_observer.h" | 37 #include "ui/compositor/layer_animation_observer.h" |
| 38 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 38 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
| 39 #include "ui/compositor/scoped_layer_animation_settings.h" | 39 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 40 #include "ui/compositor/test/test_layers.h" | 40 #include "ui/compositor/test/test_layers.h" |
| 41 #include "ui/display/screen.h" | 41 #include "ui/display/screen.h" |
| 42 #include "ui/events/event.h" | 42 #include "ui/events/event.h" |
| 43 #include "ui/events/event_utils.h" | 43 #include "ui/events/event_utils.h" |
| 44 #include "ui/events/gesture_detection/gesture_configuration.h" | 44 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 45 #include "ui/events/keycodes/keyboard_codes.h" | 45 #include "ui/events/keycodes/keyboard_codes.h" |
| 46 #include "ui/events/test/event_generator.h" | 46 #include "ui/events/test/event_generator.h" |
| 47 #include "ui/gfx/canvas.h" | 47 #include "ui/gfx/canvas.h" |
| 48 #include "ui/gfx/geometry/vector2d.h" | 48 #include "ui/gfx/geometry/vector2d.h" |
| 49 #include "ui/gfx/skia_util.h" | 49 #include "ui/gfx/skia_util.h" |
| 50 | 50 |
| 51 DECLARE_WINDOW_PROPERTY_TYPE(const char*) | 51 DECLARE_CLASS_PROPERTY_TYPE(const char*) |
| 52 | 52 |
| 53 namespace { | 53 namespace { |
| 54 | 54 |
| 55 enum class DeletionOrder { | 55 enum class DeletionOrder { |
| 56 LAYOUT_MANAGER_FIRST, | 56 LAYOUT_MANAGER_FIRST, |
| 57 PROPERTY_FIRST, | 57 PROPERTY_FIRST, |
| 58 UNKNOWN, | 58 UNKNOWN, |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 class DeletionTracker { | 61 class DeletionTracker { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 static TestProperty* last_deleted() { return last_deleted_; } | 107 static TestProperty* last_deleted() { return last_deleted_; } |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 static TestProperty* last_deleted_; | 110 static TestProperty* last_deleted_; |
| 111 DISALLOW_COPY_AND_ASSIGN(TestProperty); | 111 DISALLOW_COPY_AND_ASSIGN(TestProperty); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 TestProperty* TestProperty::last_deleted_ = nullptr; | 114 TestProperty* TestProperty::last_deleted_ = nullptr; |
| 115 | 115 |
| 116 DEFINE_OWNED_WINDOW_PROPERTY_KEY(TestProperty, kOwnedKey, NULL); | 116 DEFINE_OWNED_CLASS_PROPERTY_KEY(TestProperty, kOwnedKey, NULL); |
| 117 DEFINE_OWNED_WINDOW_PROPERTY_KEY(DeletionTestProperty, | 117 DEFINE_OWNED_CLASS_PROPERTY_KEY(DeletionTestProperty, |
| 118 kDeletionTestPropertyKey, | 118 kDeletionTestPropertyKey, |
| 119 nullptr); | 119 nullptr); |
| 120 | 120 |
| 121 } // namespace | 121 } // namespace |
| 122 | 122 |
| 123 DECLARE_WINDOW_PROPERTY_TYPE(TestProperty*); | 123 DECLARE_CLASS_PROPERTY_TYPE(TestProperty*); |
| 124 | 124 |
| 125 DECLARE_WINDOW_PROPERTY_TYPE(DeletionTestProperty*); | 125 DECLARE_CLASS_PROPERTY_TYPE(DeletionTestProperty*); |
| 126 | 126 |
| 127 namespace aura { | 127 namespace aura { |
| 128 namespace test { | 128 namespace test { |
| 129 | 129 |
| 130 class WindowTest : public AuraTestBaseWithType { | 130 class WindowTest : public AuraTestBaseWithType { |
| 131 public: | 131 public: |
| 132 WindowTest() : max_separation_(0) { | 132 WindowTest() : max_separation_(0) { |
| 133 } | 133 } |
| 134 | 134 |
| 135 void SetUp() override { | 135 void SetUp() override { |
| (...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 transform.Rotate(90.0); | 1649 transform.Rotate(90.0); |
| 1650 host()->SetRootTransform(transform); | 1650 host()->SetRootTransform(transform); |
| 1651 | 1651 |
| 1652 ui::TouchEvent press( | 1652 ui::TouchEvent press( |
| 1653 ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime()); | 1653 ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime()); |
| 1654 DispatchEventUsingWindowDispatcher(&press); | 1654 DispatchEventUsingWindowDispatcher(&press); |
| 1655 EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString()); | 1655 EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString()); |
| 1656 } | 1656 } |
| 1657 | 1657 |
| 1658 namespace { | 1658 namespace { |
| 1659 DEFINE_WINDOW_PROPERTY_KEY(int, kIntKey, -2); | 1659 DEFINE_CLASS_PROPERTY_KEY(int, kIntKey, -2); |
| 1660 DEFINE_WINDOW_PROPERTY_KEY(const char*, kStringKey, "squeamish"); | 1660 DEFINE_CLASS_PROPERTY_KEY(const char*, kStringKey, "squeamish"); |
| 1661 } | 1661 } |
| 1662 | 1662 |
| 1663 TEST_P(WindowTest, Property) { | 1663 TEST_P(WindowTest, Property) { |
| 1664 std::unique_ptr<Window> w(CreateTestWindowWithId(0, root_window())); | 1664 std::unique_ptr<Window> w(CreateTestWindowWithId(0, root_window())); |
| 1665 | 1665 |
| 1666 static const char native_prop_key[] = "fnord"; | 1666 static const char native_prop_key[] = "fnord"; |
| 1667 | 1667 |
| 1668 // Non-existent properties should return the default values. | 1668 // Non-existent properties should return the default values. |
| 1669 EXPECT_EQ(-2, w->GetProperty(kIntKey)); | 1669 EXPECT_EQ(-2, w->GetProperty(kIntKey)); |
| 1670 EXPECT_EQ(std::string("squeamish"), w->GetProperty(kStringKey)); | 1670 EXPECT_EQ(std::string("squeamish"), w->GetProperty(kStringKey)); |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2987 ::testing::Values(BackendType::CLASSIC, | 2987 ::testing::Values(BackendType::CLASSIC, |
| 2988 BackendType::MUS)); | 2988 BackendType::MUS)); |
| 2989 | 2989 |
| 2990 INSTANTIATE_TEST_CASE_P(/* no prefix */, | 2990 INSTANTIATE_TEST_CASE_P(/* no prefix */, |
| 2991 WindowObserverTest, | 2991 WindowObserverTest, |
| 2992 ::testing::Values(BackendType::CLASSIC, | 2992 ::testing::Values(BackendType::CLASSIC, |
| 2993 BackendType::MUS)); | 2993 BackendType::MUS)); |
| 2994 | 2994 |
| 2995 } // namespace test | 2995 } // namespace test |
| 2996 } // namespace aura | 2996 } // namespace aura |
| OLD | NEW |