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 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 EXPECT_EQ(NULL, w->GetProperty("foo")); | 925 EXPECT_EQ(NULL, w->GetProperty("foo")); |
926 EXPECT_EQ(0, w->GetIntProperty("foo")); | 926 EXPECT_EQ(0, w->GetIntProperty("foo")); |
927 | 927 |
928 // Set NULL and make sure the property is gone. | 928 // Set NULL and make sure the property is gone. |
929 w->SetProperty(key, NULL); | 929 w->SetProperty(key, NULL); |
930 EXPECT_EQ(NULL, w->GetProperty(key)); | 930 EXPECT_EQ(NULL, w->GetProperty(key)); |
931 EXPECT_EQ(0, w->GetIntProperty(key)); | 931 EXPECT_EQ(0, w->GetIntProperty(key)); |
932 } | 932 } |
933 | 933 |
934 TEST_F(WindowTest, SetBoundsInternalShouldCheckTargetBounds) { | 934 TEST_F(WindowTest, SetBoundsInternalShouldCheckTargetBounds) { |
| 935 // We cannot short-circuit animations in this test. |
| 936 ui::LayerAnimator::set_disable_animations_for_test(false); |
| 937 |
935 scoped_ptr<Window> w1( | 938 scoped_ptr<Window> w1( |
936 CreateTestWindowWithBounds(gfx::Rect(0, 0, 100, 100), NULL)); | 939 CreateTestWindowWithBounds(gfx::Rect(0, 0, 100, 100), NULL)); |
937 | 940 |
938 EXPECT_FALSE(!w1->layer()); | 941 EXPECT_FALSE(!w1->layer()); |
939 w1->layer()->GetAnimator()->set_disable_timer_for_test(true); | 942 w1->layer()->GetAnimator()->set_disable_timer_for_test(true); |
940 ui::AnimationContainerElement* element = w1->layer()->GetAnimator(); | 943 ui::AnimationContainerElement* element = w1->layer()->GetAnimator(); |
941 | 944 |
942 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); | 945 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); |
943 EXPECT_EQ("0,0 100x100", w1->layer()->GetTargetBounds().ToString()); | 946 EXPECT_EQ("0,0 100x100", w1->layer()->GetTargetBounds().ToString()); |
944 | 947 |
(...skipping 13 matching lines...) Expand all Loading... |
958 { | 961 { |
959 ui::ScopedLayerAnimationSettings settings(w1->layer()->GetAnimator()); | 962 ui::ScopedLayerAnimationSettings settings(w1->layer()->GetAnimator()); |
960 w1->SetBounds(gfx::Rect(0, 0, 100, 100)); | 963 w1->SetBounds(gfx::Rect(0, 0, 100, 100)); |
961 } | 964 } |
962 | 965 |
963 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); | 966 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); |
964 EXPECT_EQ("0,0 100x100", w1->layer()->GetTargetBounds().ToString()); | 967 EXPECT_EQ("0,0 100x100", w1->layer()->GetTargetBounds().ToString()); |
965 | 968 |
966 // Confirm that the target bounds are reached. | 969 // Confirm that the target bounds are reached. |
967 base::TimeTicks start_time = | 970 base::TimeTicks start_time = |
968 w1->layer()->GetAnimator()->get_last_step_time_for_test(); | 971 w1->layer()->GetAnimator()->last_step_time(); |
969 | 972 |
970 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); | 973 element->Step(start_time + base::TimeDelta::FromMilliseconds(1000)); |
971 | 974 |
972 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); | 975 EXPECT_EQ("0,0 100x100", w1->bounds().ToString()); |
973 } | 976 } |
974 | 977 |
975 | 978 |
976 class WindowObserverTest : public WindowTest, | 979 class WindowObserverTest : public WindowTest, |
977 public WindowObserver { | 980 public WindowObserver { |
978 public: | 981 public: |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 EXPECT_EQ("1 1 0", d11.GetMouseCountsAndReset()); | 1339 EXPECT_EQ("1 1 0", d11.GetMouseCountsAndReset()); |
1337 | 1340 |
1338 // Closing a window. | 1341 // Closing a window. |
1339 w11.reset(); | 1342 w11.reset(); |
1340 RunAllPendingInMessageLoop(); | 1343 RunAllPendingInMessageLoop(); |
1341 EXPECT_EQ("1 1 0", d1.GetMouseCountsAndReset()); | 1344 EXPECT_EQ("1 1 0", d1.GetMouseCountsAndReset()); |
1342 } | 1345 } |
1343 | 1346 |
1344 } // namespace test | 1347 } // namespace test |
1345 } // namespace aura | 1348 } // namespace aura |
OLD | NEW |