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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 EXPECT_EQ(NULL, w->GetProperty("foo")); | 926 EXPECT_EQ(NULL, w->GetProperty("foo")); |
927 EXPECT_EQ(0, w->GetIntProperty("foo")); | 927 EXPECT_EQ(0, w->GetIntProperty("foo")); |
928 | 928 |
929 // Set NULL and make sure the property is gone. | 929 // Set NULL and make sure the property is gone. |
930 w->SetProperty(key, NULL); | 930 w->SetProperty(key, NULL); |
931 EXPECT_EQ(NULL, w->GetProperty(key)); | 931 EXPECT_EQ(NULL, w->GetProperty(key)); |
932 EXPECT_EQ(0, w->GetIntProperty(key)); | 932 EXPECT_EQ(0, w->GetIntProperty(key)); |
933 } | 933 } |
934 | 934 |
935 TEST_F(WindowTest, SetBoundsInternalShouldCheckTargetBounds) { | 935 TEST_F(WindowTest, SetBoundsInternalShouldCheckTargetBounds) { |
| 936 // We cannot short-circuit animations in this test. |
| 937 ui::LayerAnimator::set_disable_animations_for_test(false); |
| 938 |
936 scoped_ptr<Window> w1( | 939 scoped_ptr<Window> w1( |
937 CreateTestWindowWithBounds(gfx::Rect(0, 0, 100, 100), NULL)); | 940 CreateTestWindowWithBounds(gfx::Rect(0, 0, 100, 100), NULL)); |
938 | 941 |
939 EXPECT_FALSE(!w1->layer()); | 942 EXPECT_FALSE(!w1->layer()); |
940 w1->layer()->GetAnimator()->set_disable_timer_for_test(true); | 943 w1->layer()->GetAnimator()->set_disable_timer_for_test(true); |
941 ui::AnimationContainerElement* element = w1->layer()->GetAnimator(); | 944 ui::AnimationContainerElement* element = w1->layer()->GetAnimator(); |
942 | 945 |
943 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); | 946 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); |
944 EXPECT_EQ("0,0 100x100", w1->layer()->GetTargetBounds().ToString()); | 947 EXPECT_EQ("0,0 100x100", w1->layer()->GetTargetBounds().ToString()); |
945 | 948 |
(...skipping 13 matching lines...) Expand all Loading... |
959 { | 962 { |
960 ui::ScopedLayerAnimationSettings settings(w1->layer()->GetAnimator()); | 963 ui::ScopedLayerAnimationSettings settings(w1->layer()->GetAnimator()); |
961 w1->SetBounds(gfx::Rect(0, 0, 100, 100)); | 964 w1->SetBounds(gfx::Rect(0, 0, 100, 100)); |
962 } | 965 } |
963 | 966 |
964 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); | 967 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); |
965 EXPECT_EQ("0,0 100x100", w1->layer()->GetTargetBounds().ToString()); | 968 EXPECT_EQ("0,0 100x100", w1->layer()->GetTargetBounds().ToString()); |
966 | 969 |
967 // Confirm that the target bounds are reached. | 970 // Confirm that the target bounds are reached. |
968 base::TimeTicks start_time = | 971 base::TimeTicks start_time = |
969 w1->layer()->GetAnimator()->get_last_step_time_for_test(); | 972 w1->layer()->GetAnimator()->last_step_time(); |
970 | 973 |
971 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); | 974 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
972 | 975 |
973 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); | 976 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); |
974 } | 977 } |
975 | 978 |
976 | 979 |
977 class WindowObserverTest : public WindowTest, | 980 class WindowObserverTest : public WindowTest, |
978 public WindowObserver { | 981 public WindowObserver { |
979 public: | 982 public: |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1554 | 1557 |
1555 w1.reset(); // Deletes w11 and w111. | 1558 w1.reset(); // Deletes w11 and w111. |
1556 w11 = NULL; | 1559 w11 = NULL; |
1557 w111 = NULL; | 1560 w111 = NULL; |
1558 EXPECT_EQ(2, observer.added_count()); | 1561 EXPECT_EQ(2, observer.added_count()); |
1559 EXPECT_EQ(2, observer.removed_count()); | 1562 EXPECT_EQ(2, observer.removed_count()); |
1560 } | 1563 } |
1561 | 1564 |
1562 } // namespace test | 1565 } // namespace test |
1563 } // namespace aura | 1566 } // namespace aura |
OLD | NEW |