| 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 <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 DECLARE_WINDOW_PROPERTY_TYPE(int) | 48 DECLARE_WINDOW_PROPERTY_TYPE(int) |
| 49 | 49 |
| 50 namespace aura { | 50 namespace aura { |
| 51 namespace test { | 51 namespace test { |
| 52 | 52 |
| 53 class WindowTest : public AuraTestBase { | 53 class WindowTest : public AuraTestBase { |
| 54 public: | 54 public: |
| 55 WindowTest() : max_separation_(0) { | 55 WindowTest() : max_separation_(0) { |
| 56 } | 56 } |
| 57 | 57 |
| 58 virtual void SetUp() override { | 58 void SetUp() override { |
| 59 AuraTestBase::SetUp(); | 59 AuraTestBase::SetUp(); |
| 60 // TODO: there needs to be an easier way to do this. | 60 // TODO: there needs to be an easier way to do this. |
| 61 max_separation_ = ui::GestureConfiguration:: | 61 max_separation_ = ui::GestureConfiguration:: |
| 62 max_separation_for_gesture_touches_in_pixels(); | 62 max_separation_for_gesture_touches_in_pixels(); |
| 63 ui::GestureConfiguration:: | 63 ui::GestureConfiguration:: |
| 64 set_max_separation_for_gesture_touches_in_pixels(0); | 64 set_max_separation_for_gesture_touches_in_pixels(0); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual void TearDown() override { | 67 void TearDown() override { |
| 68 AuraTestBase::TearDown(); | 68 AuraTestBase::TearDown(); |
| 69 ui::GestureConfiguration:: | 69 ui::GestureConfiguration:: |
| 70 set_max_separation_for_gesture_touches_in_pixels(max_separation_); | 70 set_max_separation_for_gesture_touches_in_pixels(max_separation_); |
| 71 } | 71 } |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 float max_separation_; | 74 float max_separation_; |
| 75 | 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(WindowTest); | 76 DISALLOW_COPY_AND_ASSIGN(WindowTest); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 namespace { | 79 namespace { |
| 80 | 80 |
| 81 // Used for verifying destruction methods are invoked. | 81 // Used for verifying destruction methods are invoked. |
| 82 class DestroyTrackingDelegateImpl : public TestWindowDelegate { | 82 class DestroyTrackingDelegateImpl : public TestWindowDelegate { |
| 83 public: | 83 public: |
| 84 DestroyTrackingDelegateImpl() | 84 DestroyTrackingDelegateImpl() |
| 85 : destroying_count_(0), | 85 : destroying_count_(0), |
| 86 destroyed_count_(0), | 86 destroyed_count_(0), |
| 87 in_destroying_(false) {} | 87 in_destroying_(false) {} |
| 88 | 88 |
| 89 void clear_destroying_count() { destroying_count_ = 0; } | 89 void clear_destroying_count() { destroying_count_ = 0; } |
| 90 int destroying_count() const { return destroying_count_; } | 90 int destroying_count() const { return destroying_count_; } |
| 91 | 91 |
| 92 void clear_destroyed_count() { destroyed_count_ = 0; } | 92 void clear_destroyed_count() { destroyed_count_ = 0; } |
| 93 int destroyed_count() const { return destroyed_count_; } | 93 int destroyed_count() const { return destroyed_count_; } |
| 94 | 94 |
| 95 bool in_destroying() const { return in_destroying_; } | 95 bool in_destroying() const { return in_destroying_; } |
| 96 | 96 |
| 97 virtual void OnWindowDestroying(Window* window) override { | 97 void OnWindowDestroying(Window* window) override { |
| 98 EXPECT_FALSE(in_destroying_); | 98 EXPECT_FALSE(in_destroying_); |
| 99 in_destroying_ = true; | 99 in_destroying_ = true; |
| 100 destroying_count_++; | 100 destroying_count_++; |
| 101 } | 101 } |
| 102 | 102 |
| 103 virtual void OnWindowDestroyed(Window* window) override { | 103 void OnWindowDestroyed(Window* window) override { |
| 104 EXPECT_TRUE(in_destroying_); | 104 EXPECT_TRUE(in_destroying_); |
| 105 in_destroying_ = false; | 105 in_destroying_ = false; |
| 106 destroyed_count_++; | 106 destroyed_count_++; |
| 107 } | 107 } |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 int destroying_count_; | 110 int destroying_count_; |
| 111 int destroyed_count_; | 111 int destroyed_count_; |
| 112 bool in_destroying_; | 112 bool in_destroying_; |
| 113 | 113 |
| 114 DISALLOW_COPY_AND_ASSIGN(DestroyTrackingDelegateImpl); | 114 DISALLOW_COPY_AND_ASSIGN(DestroyTrackingDelegateImpl); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 // Used to verify that when OnWindowDestroying is invoked the parent is also | 117 // Used to verify that when OnWindowDestroying is invoked the parent is also |
| 118 // is in the process of being destroyed. | 118 // is in the process of being destroyed. |
| 119 class ChildWindowDelegateImpl : public DestroyTrackingDelegateImpl { | 119 class ChildWindowDelegateImpl : public DestroyTrackingDelegateImpl { |
| 120 public: | 120 public: |
| 121 explicit ChildWindowDelegateImpl( | 121 explicit ChildWindowDelegateImpl( |
| 122 DestroyTrackingDelegateImpl* parent_delegate) | 122 DestroyTrackingDelegateImpl* parent_delegate) |
| 123 : parent_delegate_(parent_delegate) { | 123 : parent_delegate_(parent_delegate) { |
| 124 } | 124 } |
| 125 | 125 |
| 126 virtual void OnWindowDestroying(Window* window) override { | 126 void OnWindowDestroying(Window* window) override { |
| 127 EXPECT_TRUE(parent_delegate_->in_destroying()); | 127 EXPECT_TRUE(parent_delegate_->in_destroying()); |
| 128 DestroyTrackingDelegateImpl::OnWindowDestroying(window); | 128 DestroyTrackingDelegateImpl::OnWindowDestroying(window); |
| 129 } | 129 } |
| 130 | 130 |
| 131 private: | 131 private: |
| 132 DestroyTrackingDelegateImpl* parent_delegate_; | 132 DestroyTrackingDelegateImpl* parent_delegate_; |
| 133 | 133 |
| 134 DISALLOW_COPY_AND_ASSIGN(ChildWindowDelegateImpl); | 134 DISALLOW_COPY_AND_ASSIGN(ChildWindowDelegateImpl); |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 // Used to verify that a Window is removed from its parent when | 137 // Used to verify that a Window is removed from its parent when |
| 138 // OnWindowDestroyed is called. | 138 // OnWindowDestroyed is called. |
| 139 class DestroyOrphanDelegate : public TestWindowDelegate { | 139 class DestroyOrphanDelegate : public TestWindowDelegate { |
| 140 public: | 140 public: |
| 141 DestroyOrphanDelegate() : window_(NULL) { | 141 DestroyOrphanDelegate() : window_(NULL) { |
| 142 } | 142 } |
| 143 | 143 |
| 144 void set_window(Window* window) { window_ = window; } | 144 void set_window(Window* window) { window_ = window; } |
| 145 | 145 |
| 146 virtual void OnWindowDestroyed(Window* window) override { | 146 void OnWindowDestroyed(Window* window) override { |
| 147 EXPECT_FALSE(window_->parent()); | 147 EXPECT_FALSE(window_->parent()); |
| 148 } | 148 } |
| 149 | 149 |
| 150 private: | 150 private: |
| 151 Window* window_; | 151 Window* window_; |
| 152 DISALLOW_COPY_AND_ASSIGN(DestroyOrphanDelegate); | 152 DISALLOW_COPY_AND_ASSIGN(DestroyOrphanDelegate); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 // Used in verifying mouse capture. | 155 // Used in verifying mouse capture. |
| 156 class CaptureWindowDelegateImpl : public TestWindowDelegate { | 156 class CaptureWindowDelegateImpl : public TestWindowDelegate { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 168 } | 168 } |
| 169 | 169 |
| 170 int capture_changed_event_count() const { | 170 int capture_changed_event_count() const { |
| 171 return capture_changed_event_count_; | 171 return capture_changed_event_count_; |
| 172 } | 172 } |
| 173 int capture_lost_count() const { return capture_lost_count_; } | 173 int capture_lost_count() const { return capture_lost_count_; } |
| 174 int mouse_event_count() const { return mouse_event_count_; } | 174 int mouse_event_count() const { return mouse_event_count_; } |
| 175 int touch_event_count() const { return touch_event_count_; } | 175 int touch_event_count() const { return touch_event_count_; } |
| 176 int gesture_event_count() const { return gesture_event_count_; } | 176 int gesture_event_count() const { return gesture_event_count_; } |
| 177 | 177 |
| 178 virtual void OnMouseEvent(ui::MouseEvent* event) override { | 178 void OnMouseEvent(ui::MouseEvent* event) override { |
| 179 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) | 179 if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) |
| 180 capture_changed_event_count_++; | 180 capture_changed_event_count_++; |
| 181 mouse_event_count_++; | 181 mouse_event_count_++; |
| 182 } | 182 } |
| 183 virtual void OnTouchEvent(ui::TouchEvent* event) override { | 183 void OnTouchEvent(ui::TouchEvent* event) override { touch_event_count_++; } |
| 184 touch_event_count_++; | 184 void OnGestureEvent(ui::GestureEvent* event) override { |
| 185 } | |
| 186 virtual void OnGestureEvent(ui::GestureEvent* event) override { | |
| 187 gesture_event_count_++; | 185 gesture_event_count_++; |
| 188 } | 186 } |
| 189 virtual void OnCaptureLost() override { | 187 void OnCaptureLost() override { capture_lost_count_++; } |
| 190 capture_lost_count_++; | |
| 191 } | |
| 192 | 188 |
| 193 private: | 189 private: |
| 194 int capture_changed_event_count_; | 190 int capture_changed_event_count_; |
| 195 int capture_lost_count_; | 191 int capture_lost_count_; |
| 196 int mouse_event_count_; | 192 int mouse_event_count_; |
| 197 int touch_event_count_; | 193 int touch_event_count_; |
| 198 int gesture_event_count_; | 194 int gesture_event_count_; |
| 199 | 195 |
| 200 DISALLOW_COPY_AND_ASSIGN(CaptureWindowDelegateImpl); | 196 DISALLOW_COPY_AND_ASSIGN(CaptureWindowDelegateImpl); |
| 201 }; | 197 }; |
| 202 | 198 |
| 203 // Keeps track of the location of the gesture. | 199 // Keeps track of the location of the gesture. |
| 204 class GestureTrackPositionDelegate : public TestWindowDelegate { | 200 class GestureTrackPositionDelegate : public TestWindowDelegate { |
| 205 public: | 201 public: |
| 206 GestureTrackPositionDelegate() {} | 202 GestureTrackPositionDelegate() {} |
| 207 | 203 |
| 208 virtual void OnGestureEvent(ui::GestureEvent* event) override { | 204 void OnGestureEvent(ui::GestureEvent* event) override { |
| 209 position_ = event->location(); | 205 position_ = event->location(); |
| 210 event->StopPropagation(); | 206 event->StopPropagation(); |
| 211 } | 207 } |
| 212 | 208 |
| 213 const gfx::Point& position() const { return position_; } | 209 const gfx::Point& position() const { return position_; } |
| 214 | 210 |
| 215 private: | 211 private: |
| 216 gfx::Point position_; | 212 gfx::Point position_; |
| 217 | 213 |
| 218 DISALLOW_COPY_AND_ASSIGN(GestureTrackPositionDelegate); | 214 DISALLOW_COPY_AND_ASSIGN(GestureTrackPositionDelegate); |
| 219 }; | 215 }; |
| 220 | 216 |
| 221 base::TimeDelta getTime() { | 217 base::TimeDelta getTime() { |
| 222 return ui::EventTimeForNow(); | 218 return ui::EventTimeForNow(); |
| 223 } | 219 } |
| 224 | 220 |
| 225 class SelfEventHandlingWindowDelegate : public TestWindowDelegate { | 221 class SelfEventHandlingWindowDelegate : public TestWindowDelegate { |
| 226 public: | 222 public: |
| 227 SelfEventHandlingWindowDelegate() {} | 223 SelfEventHandlingWindowDelegate() {} |
| 228 | 224 |
| 229 virtual bool ShouldDescendIntoChildForEventHandling( | 225 bool ShouldDescendIntoChildForEventHandling( |
| 230 Window* child, | 226 Window* child, |
| 231 const gfx::Point& location) override { | 227 const gfx::Point& location) override { |
| 232 return false; | 228 return false; |
| 233 } | 229 } |
| 234 | 230 |
| 235 private: | 231 private: |
| 236 DISALLOW_COPY_AND_ASSIGN(SelfEventHandlingWindowDelegate); | 232 DISALLOW_COPY_AND_ASSIGN(SelfEventHandlingWindowDelegate); |
| 237 }; | 233 }; |
| 238 | 234 |
| 239 // The delegate deletes itself when the window is being destroyed. | 235 // The delegate deletes itself when the window is being destroyed. |
| 240 class DestroyWindowDelegate : public TestWindowDelegate { | 236 class DestroyWindowDelegate : public TestWindowDelegate { |
| 241 public: | 237 public: |
| 242 DestroyWindowDelegate() {} | 238 DestroyWindowDelegate() {} |
| 243 | 239 |
| 244 private: | 240 private: |
| 245 virtual ~DestroyWindowDelegate() {} | 241 ~DestroyWindowDelegate() override {} |
| 246 | 242 |
| 247 // Overridden from WindowDelegate. | 243 // Overridden from WindowDelegate. |
| 248 virtual void OnWindowDestroyed(Window* window) override { | 244 void OnWindowDestroyed(Window* window) override { delete this; } |
| 249 delete this; | |
| 250 } | |
| 251 | 245 |
| 252 DISALLOW_COPY_AND_ASSIGN(DestroyWindowDelegate); | 246 DISALLOW_COPY_AND_ASSIGN(DestroyWindowDelegate); |
| 253 }; | 247 }; |
| 254 | 248 |
| 255 } // namespace | 249 } // namespace |
| 256 | 250 |
| 257 TEST_F(WindowTest, GetChildById) { | 251 TEST_F(WindowTest, GetChildById) { |
| 258 scoped_ptr<Window> w1(CreateTestWindowWithId(1, root_window())); | 252 scoped_ptr<Window> w1(CreateTestWindowWithId(1, root_window())); |
| 259 scoped_ptr<Window> w11(CreateTestWindowWithId(11, w1.get())); | 253 scoped_ptr<Window> w11(CreateTestWindowWithId(11, w1.get())); |
| 260 scoped_ptr<Window> w111(CreateTestWindowWithId(111, w11.get())); | 254 scoped_ptr<Window> w111(CreateTestWindowWithId(111, w11.get())); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 EXPECT_TRUE(w1->GetToplevelWindow() == NULL); | 563 EXPECT_TRUE(w1->GetToplevelWindow() == NULL); |
| 570 EXPECT_EQ(w11.get(), w11->GetToplevelWindow()); | 564 EXPECT_EQ(w11.get(), w11->GetToplevelWindow()); |
| 571 EXPECT_EQ(w11.get(), w111->GetToplevelWindow()); | 565 EXPECT_EQ(w11.get(), w111->GetToplevelWindow()); |
| 572 EXPECT_EQ(w11.get(), w1111->GetToplevelWindow()); | 566 EXPECT_EQ(w11.get(), w1111->GetToplevelWindow()); |
| 573 } | 567 } |
| 574 | 568 |
| 575 class AddedToRootWindowObserver : public WindowObserver { | 569 class AddedToRootWindowObserver : public WindowObserver { |
| 576 public: | 570 public: |
| 577 AddedToRootWindowObserver() : called_(false) {} | 571 AddedToRootWindowObserver() : called_(false) {} |
| 578 | 572 |
| 579 virtual void OnWindowAddedToRootWindow(Window* window) override { | 573 void OnWindowAddedToRootWindow(Window* window) override { called_ = true; } |
| 580 called_ = true; | |
| 581 } | |
| 582 | 574 |
| 583 bool called() const { return called_; } | 575 bool called() const { return called_; } |
| 584 | 576 |
| 585 private: | 577 private: |
| 586 bool called_; | 578 bool called_; |
| 587 | 579 |
| 588 DISALLOW_COPY_AND_ASSIGN(AddedToRootWindowObserver); | 580 DISALLOW_COPY_AND_ASSIGN(AddedToRootWindowObserver); |
| 589 }; | 581 }; |
| 590 | 582 |
| 591 TEST_F(WindowTest, WindowAddedToRootWindowShouldNotifyChildAndNotParent) { | 583 TEST_F(WindowTest, WindowAddedToRootWindowShouldNotifyChildAndNotParent) { |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 // The |child| window is moved to the 0,0 in screen coordinates. | 1072 // The |child| window is moved to the 0,0 in screen coordinates. |
| 1081 // |GetBoundsInRootWindow()| should return 0,0. | 1073 // |GetBoundsInRootWindow()| should return 0,0. |
| 1082 child->SetBounds(gfx::Rect(100, 100, 100, 100)); | 1074 child->SetBounds(gfx::Rect(100, 100, 100, 100)); |
| 1083 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString()); | 1075 EXPECT_EQ("0,0 100x100", child->GetBoundsInRootWindow().ToString()); |
| 1084 } | 1076 } |
| 1085 | 1077 |
| 1086 class MouseEnterExitWindowDelegate : public TestWindowDelegate { | 1078 class MouseEnterExitWindowDelegate : public TestWindowDelegate { |
| 1087 public: | 1079 public: |
| 1088 MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {} | 1080 MouseEnterExitWindowDelegate() : entered_(false), exited_(false) {} |
| 1089 | 1081 |
| 1090 virtual void OnMouseEvent(ui::MouseEvent* event) override { | 1082 void OnMouseEvent(ui::MouseEvent* event) override { |
| 1091 switch (event->type()) { | 1083 switch (event->type()) { |
| 1092 case ui::ET_MOUSE_ENTERED: | 1084 case ui::ET_MOUSE_ENTERED: |
| 1093 EXPECT_TRUE(event->flags() & ui::EF_IS_SYNTHESIZED); | 1085 EXPECT_TRUE(event->flags() & ui::EF_IS_SYNTHESIZED); |
| 1094 entered_ = true; | 1086 entered_ = true; |
| 1095 break; | 1087 break; |
| 1096 case ui::ET_MOUSE_EXITED: | 1088 case ui::ET_MOUSE_EXITED: |
| 1097 EXPECT_TRUE(event->flags() & ui::EF_IS_SYNTHESIZED); | 1089 EXPECT_TRUE(event->flags() & ui::EF_IS_SYNTHESIZED); |
| 1098 exited_ = true; | 1090 exited_ = true; |
| 1099 break; | 1091 break; |
| 1100 default: | 1092 default: |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 hidden_(0) { | 1357 hidden_(0) { |
| 1366 } | 1358 } |
| 1367 | 1359 |
| 1368 int shown() const { return shown_; } | 1360 int shown() const { return shown_; } |
| 1369 int hidden() const { return hidden_; } | 1361 int hidden() const { return hidden_; } |
| 1370 void Clear() { | 1362 void Clear() { |
| 1371 shown_ = 0; | 1363 shown_ = 0; |
| 1372 hidden_ = 0; | 1364 hidden_ = 0; |
| 1373 } | 1365 } |
| 1374 | 1366 |
| 1375 virtual void OnWindowTargetVisibilityChanged(bool visible) override { | 1367 void OnWindowTargetVisibilityChanged(bool visible) override { |
| 1376 if (visible) | 1368 if (visible) |
| 1377 shown_++; | 1369 shown_++; |
| 1378 else | 1370 else |
| 1379 hidden_++; | 1371 hidden_++; |
| 1380 } | 1372 } |
| 1381 | 1373 |
| 1382 private: | 1374 private: |
| 1383 int shown_; | 1375 int shown_; |
| 1384 int hidden_; | 1376 int hidden_; |
| 1385 | 1377 |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1668 int changed_count; | 1660 int changed_count; |
| 1669 }; | 1661 }; |
| 1670 | 1662 |
| 1671 WindowObserverTest() | 1663 WindowObserverTest() |
| 1672 : added_count_(0), | 1664 : added_count_(0), |
| 1673 removed_count_(0), | 1665 removed_count_(0), |
| 1674 destroyed_count_(0), | 1666 destroyed_count_(0), |
| 1675 old_property_value_(-3) { | 1667 old_property_value_(-3) { |
| 1676 } | 1668 } |
| 1677 | 1669 |
| 1678 virtual ~WindowObserverTest() {} | 1670 ~WindowObserverTest() override {} |
| 1679 | 1671 |
| 1680 const VisibilityInfo* GetVisibilityInfo() const { | 1672 const VisibilityInfo* GetVisibilityInfo() const { |
| 1681 return visibility_info_.get(); | 1673 return visibility_info_.get(); |
| 1682 } | 1674 } |
| 1683 | 1675 |
| 1684 void ResetVisibilityInfo() { | 1676 void ResetVisibilityInfo() { |
| 1685 visibility_info_.reset(); | 1677 visibility_info_.reset(); |
| 1686 } | 1678 } |
| 1687 | 1679 |
| 1688 // Returns a description of the WindowObserver methods that have been invoked. | 1680 // Returns a description of the WindowObserver methods that have been invoked. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1714 transform_notifications_.begin(); | 1706 transform_notifications_.begin(); |
| 1715 it != transform_notifications_.end(); | 1707 it != transform_notifications_.end(); |
| 1716 ++it) { | 1708 ++it) { |
| 1717 base::StringAppendF(&result, "(%d,%d)", it->first, it->second); | 1709 base::StringAppendF(&result, "(%d,%d)", it->first, it->second); |
| 1718 } | 1710 } |
| 1719 transform_notifications_.clear(); | 1711 transform_notifications_.clear(); |
| 1720 return result; | 1712 return result; |
| 1721 } | 1713 } |
| 1722 | 1714 |
| 1723 private: | 1715 private: |
| 1724 virtual void OnWindowAdded(Window* new_window) override { | 1716 void OnWindowAdded(Window* new_window) override { added_count_++; } |
| 1725 added_count_++; | |
| 1726 } | |
| 1727 | 1717 |
| 1728 virtual void OnWillRemoveWindow(Window* window) override { | 1718 void OnWillRemoveWindow(Window* window) override { removed_count_++; } |
| 1729 removed_count_++; | |
| 1730 } | |
| 1731 | 1719 |
| 1732 virtual void OnWindowVisibilityChanged(Window* window, | 1720 void OnWindowVisibilityChanged(Window* window, bool visible) override { |
| 1733 bool visible) override { | |
| 1734 if (!visibility_info_) { | 1721 if (!visibility_info_) { |
| 1735 visibility_info_.reset(new VisibilityInfo); | 1722 visibility_info_.reset(new VisibilityInfo); |
| 1736 visibility_info_->changed_count = 0; | 1723 visibility_info_->changed_count = 0; |
| 1737 } | 1724 } |
| 1738 visibility_info_->window_visible = window->IsVisible(); | 1725 visibility_info_->window_visible = window->IsVisible(); |
| 1739 visibility_info_->visible_param = visible; | 1726 visibility_info_->visible_param = visible; |
| 1740 visibility_info_->changed_count++; | 1727 visibility_info_->changed_count++; |
| 1741 } | 1728 } |
| 1742 | 1729 |
| 1743 virtual void OnWindowDestroyed(Window* window) override { | 1730 void OnWindowDestroyed(Window* window) override { |
| 1744 EXPECT_FALSE(window->parent()); | 1731 EXPECT_FALSE(window->parent()); |
| 1745 destroyed_count_++; | 1732 destroyed_count_++; |
| 1746 } | 1733 } |
| 1747 | 1734 |
| 1748 virtual void OnWindowPropertyChanged(Window* window, | 1735 void OnWindowPropertyChanged(Window* window, |
| 1749 const void* key, | 1736 const void* key, |
| 1750 intptr_t old) override { | 1737 intptr_t old) override { |
| 1751 property_key_ = key; | 1738 property_key_ = key; |
| 1752 old_property_value_ = old; | 1739 old_property_value_ = old; |
| 1753 } | 1740 } |
| 1754 | 1741 |
| 1755 virtual void OnAncestorWindowTransformed(Window* source, | 1742 void OnAncestorWindowTransformed(Window* source, Window* window) override { |
| 1756 Window* window) override { | |
| 1757 transform_notifications_.push_back( | 1743 transform_notifications_.push_back( |
| 1758 std::make_pair(source->id(), window->id())); | 1744 std::make_pair(source->id(), window->id())); |
| 1759 } | 1745 } |
| 1760 | 1746 |
| 1761 int added_count_; | 1747 int added_count_; |
| 1762 int removed_count_; | 1748 int removed_count_; |
| 1763 int destroyed_count_; | 1749 int destroyed_count_; |
| 1764 scoped_ptr<VisibilityInfo> visibility_info_; | 1750 scoped_ptr<VisibilityInfo> visibility_info_; |
| 1765 const void* property_key_; | 1751 const void* property_key_; |
| 1766 intptr_t old_property_value_; | 1752 intptr_t old_property_value_; |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2027 EXPECT_EQ("3 1 2", | 2013 EXPECT_EQ("3 1 2", |
| 2028 ui::test::ChildLayerNamesAsString(*root_window()->layer())); | 2014 ui::test::ChildLayerNamesAsString(*root_window()->layer())); |
| 2029 } | 2015 } |
| 2030 | 2016 |
| 2031 class TestVisibilityClient : public client::VisibilityClient { | 2017 class TestVisibilityClient : public client::VisibilityClient { |
| 2032 public: | 2018 public: |
| 2033 explicit TestVisibilityClient(Window* root_window) | 2019 explicit TestVisibilityClient(Window* root_window) |
| 2034 : ignore_visibility_changes_(false) { | 2020 : ignore_visibility_changes_(false) { |
| 2035 client::SetVisibilityClient(root_window, this); | 2021 client::SetVisibilityClient(root_window, this); |
| 2036 } | 2022 } |
| 2037 virtual ~TestVisibilityClient() { | 2023 ~TestVisibilityClient() override {} |
| 2038 } | |
| 2039 | 2024 |
| 2040 void set_ignore_visibility_changes(bool ignore_visibility_changes) { | 2025 void set_ignore_visibility_changes(bool ignore_visibility_changes) { |
| 2041 ignore_visibility_changes_ = ignore_visibility_changes; | 2026 ignore_visibility_changes_ = ignore_visibility_changes; |
| 2042 } | 2027 } |
| 2043 | 2028 |
| 2044 // Overridden from client::VisibilityClient: | 2029 // Overridden from client::VisibilityClient: |
| 2045 virtual void UpdateLayerVisibility(aura::Window* window, | 2030 void UpdateLayerVisibility(aura::Window* window, bool visible) override { |
| 2046 bool visible) override { | |
| 2047 if (!ignore_visibility_changes_) | 2031 if (!ignore_visibility_changes_) |
| 2048 window->layer()->SetVisible(visible); | 2032 window->layer()->SetVisible(visible); |
| 2049 } | 2033 } |
| 2050 | 2034 |
| 2051 private: | 2035 private: |
| 2052 bool ignore_visibility_changes_; | 2036 bool ignore_visibility_changes_; |
| 2053 DISALLOW_COPY_AND_ASSIGN(TestVisibilityClient); | 2037 DISALLOW_COPY_AND_ASSIGN(TestVisibilityClient); |
| 2054 }; | 2038 }; |
| 2055 | 2039 |
| 2056 TEST_F(WindowTest, VisibilityClientIsVisible) { | 2040 TEST_F(WindowTest, VisibilityClientIsVisible) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2161 // Closing windows | 2145 // Closing windows |
| 2162 w11.reset(); | 2146 w11.reset(); |
| 2163 RunAllPendingInMessageLoop(); | 2147 RunAllPendingInMessageLoop(); |
| 2164 EXPECT_EQ("0 0 0", d1.GetMouseMotionCountsAndReset()); | 2148 EXPECT_EQ("0 0 0", d1.GetMouseMotionCountsAndReset()); |
| 2165 EXPECT_EQ("0 0 0", d11.GetMouseMotionCountsAndReset()); | 2149 EXPECT_EQ("0 0 0", d11.GetMouseMotionCountsAndReset()); |
| 2166 } | 2150 } |
| 2167 | 2151 |
| 2168 class RootWindowAttachmentObserver : public WindowObserver { | 2152 class RootWindowAttachmentObserver : public WindowObserver { |
| 2169 public: | 2153 public: |
| 2170 RootWindowAttachmentObserver() : added_count_(0), removed_count_(0) {} | 2154 RootWindowAttachmentObserver() : added_count_(0), removed_count_(0) {} |
| 2171 virtual ~RootWindowAttachmentObserver() {} | 2155 ~RootWindowAttachmentObserver() override {} |
| 2172 | 2156 |
| 2173 int added_count() const { return added_count_; } | 2157 int added_count() const { return added_count_; } |
| 2174 int removed_count() const { return removed_count_; } | 2158 int removed_count() const { return removed_count_; } |
| 2175 | 2159 |
| 2176 void Clear() { | 2160 void Clear() { |
| 2177 added_count_ = 0; | 2161 added_count_ = 0; |
| 2178 removed_count_ = 0; | 2162 removed_count_ = 0; |
| 2179 } | 2163 } |
| 2180 | 2164 |
| 2181 // Overridden from WindowObserver: | 2165 // Overridden from WindowObserver: |
| 2182 virtual void OnWindowAddedToRootWindow(Window* window) override { | 2166 void OnWindowAddedToRootWindow(Window* window) override { ++added_count_; } |
| 2183 ++added_count_; | 2167 void OnWindowRemovingFromRootWindow(Window* window, |
| 2184 } | 2168 Window* new_root) override { |
| 2185 virtual void OnWindowRemovingFromRootWindow(Window* window, | |
| 2186 Window* new_root) override { | |
| 2187 ++removed_count_; | 2169 ++removed_count_; |
| 2188 } | 2170 } |
| 2189 | 2171 |
| 2190 private: | 2172 private: |
| 2191 int added_count_; | 2173 int added_count_; |
| 2192 int removed_count_; | 2174 int removed_count_; |
| 2193 | 2175 |
| 2194 DISALLOW_COPY_AND_ASSIGN(RootWindowAttachmentObserver); | 2176 DISALLOW_COPY_AND_ASSIGN(RootWindowAttachmentObserver); |
| 2195 }; | 2177 }; |
| 2196 | 2178 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2256 w11 = NULL; | 2238 w11 = NULL; |
| 2257 w111 = NULL; | 2239 w111 = NULL; |
| 2258 EXPECT_EQ(2, observer.added_count()); | 2240 EXPECT_EQ(2, observer.added_count()); |
| 2259 EXPECT_EQ(2, observer.removed_count()); | 2241 EXPECT_EQ(2, observer.removed_count()); |
| 2260 } | 2242 } |
| 2261 | 2243 |
| 2262 class BoundsChangedWindowObserver : public WindowObserver { | 2244 class BoundsChangedWindowObserver : public WindowObserver { |
| 2263 public: | 2245 public: |
| 2264 BoundsChangedWindowObserver() : root_set_(false) {} | 2246 BoundsChangedWindowObserver() : root_set_(false) {} |
| 2265 | 2247 |
| 2266 virtual void OnWindowBoundsChanged(Window* window, | 2248 void OnWindowBoundsChanged(Window* window, |
| 2267 const gfx::Rect& old_bounds, | 2249 const gfx::Rect& old_bounds, |
| 2268 const gfx::Rect& new_bounds) override { | 2250 const gfx::Rect& new_bounds) override { |
| 2269 root_set_ = window->GetRootWindow() != NULL; | 2251 root_set_ = window->GetRootWindow() != NULL; |
| 2270 } | 2252 } |
| 2271 | 2253 |
| 2272 bool root_set() const { return root_set_; } | 2254 bool root_set() const { return root_set_; } |
| 2273 | 2255 |
| 2274 private: | 2256 private: |
| 2275 bool root_set_; | 2257 bool root_set_; |
| 2276 | 2258 |
| 2277 DISALLOW_COPY_AND_ASSIGN(BoundsChangedWindowObserver); | 2259 DISALLOW_COPY_AND_ASSIGN(BoundsChangedWindowObserver); |
| 2278 }; | 2260 }; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2337 // Used By DeleteWindowFromOnWindowDestroyed. Destroys a Window from | 2319 // Used By DeleteWindowFromOnWindowDestroyed. Destroys a Window from |
| 2338 // OnWindowDestroyed(). | 2320 // OnWindowDestroyed(). |
| 2339 class OwningWindowDelegate : public TestWindowDelegate { | 2321 class OwningWindowDelegate : public TestWindowDelegate { |
| 2340 public: | 2322 public: |
| 2341 OwningWindowDelegate() {} | 2323 OwningWindowDelegate() {} |
| 2342 | 2324 |
| 2343 void SetOwnedWindow(Window* window) { | 2325 void SetOwnedWindow(Window* window) { |
| 2344 owned_window_.reset(window); | 2326 owned_window_.reset(window); |
| 2345 } | 2327 } |
| 2346 | 2328 |
| 2347 virtual void OnWindowDestroyed(Window* window) override { | 2329 void OnWindowDestroyed(Window* window) override { owned_window_.reset(NULL); } |
| 2348 owned_window_.reset(NULL); | |
| 2349 } | |
| 2350 | 2330 |
| 2351 private: | 2331 private: |
| 2352 scoped_ptr<Window> owned_window_; | 2332 scoped_ptr<Window> owned_window_; |
| 2353 | 2333 |
| 2354 DISALLOW_COPY_AND_ASSIGN(OwningWindowDelegate); | 2334 DISALLOW_COPY_AND_ASSIGN(OwningWindowDelegate); |
| 2355 }; | 2335 }; |
| 2356 | 2336 |
| 2357 } // namespace | 2337 } // namespace |
| 2358 | 2338 |
| 2359 // Creates a window with two child windows. When the first child window is | 2339 // Creates a window with two child windows. When the first child window is |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2382 class BoundsChangeDelegate : public TestWindowDelegate { | 2362 class BoundsChangeDelegate : public TestWindowDelegate { |
| 2383 public: | 2363 public: |
| 2384 BoundsChangeDelegate() : bounds_changed_(false) {} | 2364 BoundsChangeDelegate() : bounds_changed_(false) {} |
| 2385 | 2365 |
| 2386 void clear_bounds_changed() { bounds_changed_ = false; } | 2366 void clear_bounds_changed() { bounds_changed_ = false; } |
| 2387 bool bounds_changed() const { | 2367 bool bounds_changed() const { |
| 2388 return bounds_changed_; | 2368 return bounds_changed_; |
| 2389 } | 2369 } |
| 2390 | 2370 |
| 2391 // Window | 2371 // Window |
| 2392 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 2372 void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 2393 const gfx::Rect& new_bounds) override { | 2373 const gfx::Rect& new_bounds) override { |
| 2394 bounds_changed_ = true; | 2374 bounds_changed_ = true; |
| 2395 } | 2375 } |
| 2396 | 2376 |
| 2397 private: | 2377 private: |
| 2398 // Was OnBoundsChanged() invoked? | 2378 // Was OnBoundsChanged() invoked? |
| 2399 bool bounds_changed_; | 2379 bool bounds_changed_; |
| 2400 | 2380 |
| 2401 DISALLOW_COPY_AND_ASSIGN(BoundsChangeDelegate); | 2381 DISALLOW_COPY_AND_ASSIGN(BoundsChangeDelegate); |
| 2402 }; | 2382 }; |
| 2403 | 2383 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2491 AddChildNotificationsObserver() : added_count_(0), removed_count_(0) {} | 2471 AddChildNotificationsObserver() : added_count_(0), removed_count_(0) {} |
| 2492 | 2472 |
| 2493 std::string CountStringAndReset() { | 2473 std::string CountStringAndReset() { |
| 2494 std::string result = base::IntToString(added_count_) + " " + | 2474 std::string result = base::IntToString(added_count_) + " " + |
| 2495 base::IntToString(removed_count_); | 2475 base::IntToString(removed_count_); |
| 2496 added_count_ = removed_count_ = 0; | 2476 added_count_ = removed_count_ = 0; |
| 2497 return result; | 2477 return result; |
| 2498 } | 2478 } |
| 2499 | 2479 |
| 2500 // WindowObserver overrides: | 2480 // WindowObserver overrides: |
| 2501 virtual void OnWindowAddedToRootWindow(Window* window) override { | 2481 void OnWindowAddedToRootWindow(Window* window) override { added_count_++; } |
| 2502 added_count_++; | 2482 void OnWindowRemovingFromRootWindow(Window* window, |
| 2503 } | 2483 Window* new_root) override { |
| 2504 virtual void OnWindowRemovingFromRootWindow(Window* window, | |
| 2505 Window* new_root) override { | |
| 2506 removed_count_++; | 2484 removed_count_++; |
| 2507 } | 2485 } |
| 2508 | 2486 |
| 2509 private: | 2487 private: |
| 2510 int added_count_; | 2488 int added_count_; |
| 2511 int removed_count_; | 2489 int removed_count_; |
| 2512 | 2490 |
| 2513 DISALLOW_COPY_AND_ASSIGN(AddChildNotificationsObserver); | 2491 DISALLOW_COPY_AND_ASSIGN(AddChildNotificationsObserver); |
| 2514 }; | 2492 }; |
| 2515 | 2493 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2540 0, | 2518 0, |
| 2541 gfx::Rect(10, 20, 30, 40), | 2519 gfx::Rect(10, 20, 30, 40), |
| 2542 root_window())); | 2520 root_window())); |
| 2543 } | 2521 } |
| 2544 | 2522 |
| 2545 class HierarchyObserver : public WindowObserver { | 2523 class HierarchyObserver : public WindowObserver { |
| 2546 public: | 2524 public: |
| 2547 HierarchyObserver(Window* target) : target_(target) { | 2525 HierarchyObserver(Window* target) : target_(target) { |
| 2548 target_->AddObserver(this); | 2526 target_->AddObserver(this); |
| 2549 } | 2527 } |
| 2550 virtual ~HierarchyObserver() { | 2528 ~HierarchyObserver() override { target_->RemoveObserver(this); } |
| 2551 target_->RemoveObserver(this); | |
| 2552 } | |
| 2553 | 2529 |
| 2554 void ValidateState( | 2530 void ValidateState( |
| 2555 int index, | 2531 int index, |
| 2556 const WindowObserver::HierarchyChangeParams& params) const { | 2532 const WindowObserver::HierarchyChangeParams& params) const { |
| 2557 ParamsMatch(params_[index], params); | 2533 ParamsMatch(params_[index], params); |
| 2558 } | 2534 } |
| 2559 | 2535 |
| 2560 void Reset() { | 2536 void Reset() { |
| 2561 params_.clear(); | 2537 params_.clear(); |
| 2562 } | 2538 } |
| 2563 | 2539 |
| 2564 private: | 2540 private: |
| 2565 // Overridden from WindowObserver: | 2541 // Overridden from WindowObserver: |
| 2566 virtual void OnWindowHierarchyChanging( | 2542 void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override { |
| 2567 const HierarchyChangeParams& params) override { | |
| 2568 params_.push_back(params); | 2543 params_.push_back(params); |
| 2569 } | 2544 } |
| 2570 virtual void OnWindowHierarchyChanged( | 2545 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override { |
| 2571 const HierarchyChangeParams& params) override { | |
| 2572 params_.push_back(params); | 2546 params_.push_back(params); |
| 2573 } | 2547 } |
| 2574 | 2548 |
| 2575 void ParamsMatch(const WindowObserver::HierarchyChangeParams& p1, | 2549 void ParamsMatch(const WindowObserver::HierarchyChangeParams& p1, |
| 2576 const WindowObserver::HierarchyChangeParams& p2) const { | 2550 const WindowObserver::HierarchyChangeParams& p2) const { |
| 2577 EXPECT_EQ(p1.phase, p2.phase); | 2551 EXPECT_EQ(p1.phase, p2.phase); |
| 2578 EXPECT_EQ(p1.target, p2.target); | 2552 EXPECT_EQ(p1.target, p2.target); |
| 2579 EXPECT_EQ(p1.new_parent, p2.new_parent); | 2553 EXPECT_EQ(p1.new_parent, p2.new_parent); |
| 2580 EXPECT_EQ(p1.old_parent, p2.old_parent); | 2554 EXPECT_EQ(p1.old_parent, p2.old_parent); |
| 2581 EXPECT_EQ(p1.receiver, p2.receiver); | 2555 EXPECT_EQ(p1.receiver, p2.receiver); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2928 delete w1ll; | 2902 delete w1ll; |
| 2929 } | 2903 } |
| 2930 | 2904 |
| 2931 namespace { | 2905 namespace { |
| 2932 | 2906 |
| 2933 // Tracks the number of times paint is invoked along with what the clip and | 2907 // Tracks the number of times paint is invoked along with what the clip and |
| 2934 // translate was. | 2908 // translate was. |
| 2935 class PaintWindowDelegate : public TestWindowDelegate { | 2909 class PaintWindowDelegate : public TestWindowDelegate { |
| 2936 public: | 2910 public: |
| 2937 PaintWindowDelegate() : paint_count_(0) {} | 2911 PaintWindowDelegate() : paint_count_(0) {} |
| 2938 virtual ~PaintWindowDelegate() {} | 2912 ~PaintWindowDelegate() override {} |
| 2939 | 2913 |
| 2940 const gfx::Rect& most_recent_paint_clip_bounds() const { | 2914 const gfx::Rect& most_recent_paint_clip_bounds() const { |
| 2941 return most_recent_paint_clip_bounds_; | 2915 return most_recent_paint_clip_bounds_; |
| 2942 } | 2916 } |
| 2943 | 2917 |
| 2944 const gfx::Vector2d& most_recent_paint_matrix_offset() const { | 2918 const gfx::Vector2d& most_recent_paint_matrix_offset() const { |
| 2945 return most_recent_paint_matrix_offset_; | 2919 return most_recent_paint_matrix_offset_; |
| 2946 } | 2920 } |
| 2947 | 2921 |
| 2948 void clear_paint_count() { paint_count_ = 0; } | 2922 void clear_paint_count() { paint_count_ = 0; } |
| 2949 int paint_count() const { return paint_count_; } | 2923 int paint_count() const { return paint_count_; } |
| 2950 | 2924 |
| 2951 // TestWindowDelegate:: | 2925 // TestWindowDelegate:: |
| 2952 virtual void OnPaint(gfx::Canvas* canvas) override { | 2926 void OnPaint(gfx::Canvas* canvas) override { |
| 2953 paint_count_++; | 2927 paint_count_++; |
| 2954 canvas->GetClipBounds(&most_recent_paint_clip_bounds_); | 2928 canvas->GetClipBounds(&most_recent_paint_clip_bounds_); |
| 2955 const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); | 2929 const SkMatrix& matrix = canvas->sk_canvas()->getTotalMatrix(); |
| 2956 most_recent_paint_matrix_offset_ = gfx::Vector2d( | 2930 most_recent_paint_matrix_offset_ = gfx::Vector2d( |
| 2957 SkScalarFloorToInt(matrix.getTranslateX()), | 2931 SkScalarFloorToInt(matrix.getTranslateX()), |
| 2958 SkScalarFloorToInt(matrix.getTranslateY())); | 2932 SkScalarFloorToInt(matrix.getTranslateY())); |
| 2959 } | 2933 } |
| 2960 | 2934 |
| 2961 private: | 2935 private: |
| 2962 int paint_count_; | 2936 int paint_count_; |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3405 } | 3379 } |
| 3406 } | 3380 } |
| 3407 | 3381 |
| 3408 namespace { | 3382 namespace { |
| 3409 | 3383 |
| 3410 class TestLayerAnimationObserver : public ui::LayerAnimationObserver { | 3384 class TestLayerAnimationObserver : public ui::LayerAnimationObserver { |
| 3411 public: | 3385 public: |
| 3412 TestLayerAnimationObserver() | 3386 TestLayerAnimationObserver() |
| 3413 : animation_completed_(false), | 3387 : animation_completed_(false), |
| 3414 animation_aborted_(false) {} | 3388 animation_aborted_(false) {} |
| 3415 virtual ~TestLayerAnimationObserver() {} | 3389 ~TestLayerAnimationObserver() override {} |
| 3416 | 3390 |
| 3417 bool animation_completed() const { return animation_completed_; } | 3391 bool animation_completed() const { return animation_completed_; } |
| 3418 bool animation_aborted() const { return animation_aborted_; } | 3392 bool animation_aborted() const { return animation_aborted_; } |
| 3419 | 3393 |
| 3420 void Reset() { | 3394 void Reset() { |
| 3421 animation_completed_ = false; | 3395 animation_completed_ = false; |
| 3422 animation_aborted_ = false; | 3396 animation_aborted_ = false; |
| 3423 } | 3397 } |
| 3424 | 3398 |
| 3425 private: | 3399 private: |
| 3426 // ui::LayerAnimationObserver: | 3400 // ui::LayerAnimationObserver: |
| 3427 virtual void OnLayerAnimationEnded( | 3401 void OnLayerAnimationEnded(ui::LayerAnimationSequence* sequence) override { |
| 3428 ui::LayerAnimationSequence* sequence) override { | |
| 3429 animation_completed_ = true; | 3402 animation_completed_ = true; |
| 3430 } | 3403 } |
| 3431 | 3404 |
| 3432 virtual void OnLayerAnimationAborted( | 3405 void OnLayerAnimationAborted(ui::LayerAnimationSequence* sequence) override { |
| 3433 ui::LayerAnimationSequence* sequence) override { | |
| 3434 animation_aborted_ = true; | 3406 animation_aborted_ = true; |
| 3435 } | 3407 } |
| 3436 | 3408 |
| 3437 virtual void OnLayerAnimationScheduled( | 3409 void OnLayerAnimationScheduled( |
| 3438 ui::LayerAnimationSequence* sequence) override { | 3410 ui::LayerAnimationSequence* sequence) override {} |
| 3439 } | |
| 3440 | 3411 |
| 3441 bool animation_completed_; | 3412 bool animation_completed_; |
| 3442 bool animation_aborted_; | 3413 bool animation_aborted_; |
| 3443 | 3414 |
| 3444 DISALLOW_COPY_AND_ASSIGN(TestLayerAnimationObserver); | 3415 DISALLOW_COPY_AND_ASSIGN(TestLayerAnimationObserver); |
| 3445 }; | 3416 }; |
| 3446 | 3417 |
| 3447 } | 3418 } |
| 3448 | 3419 |
| 3449 TEST_F(WindowTest, WindowDestroyCompletesAnimations) { | 3420 TEST_F(WindowTest, WindowDestroyCompletesAnimations) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3490 | 3461 |
| 3491 EXPECT_TRUE(animator.get()); | 3462 EXPECT_TRUE(animator.get()); |
| 3492 EXPECT_FALSE(animator->is_animating()); | 3463 EXPECT_FALSE(animator->is_animating()); |
| 3493 EXPECT_TRUE(observer.animation_completed()); | 3464 EXPECT_TRUE(observer.animation_completed()); |
| 3494 EXPECT_FALSE(observer.animation_aborted()); | 3465 EXPECT_FALSE(observer.animation_aborted()); |
| 3495 animator->RemoveObserver(&observer); | 3466 animator->RemoveObserver(&observer); |
| 3496 } | 3467 } |
| 3497 | 3468 |
| 3498 } // namespace test | 3469 } // namespace test |
| 3499 } // namespace aura | 3470 } // namespace aura |
| OLD | NEW |