| 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/compositor/layer_animation_element.h" | 5 #include "ui/compositor/layer_animation_element.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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 start_transform.Rotate(-30.0); | 27 start_transform.Rotate(-30.0); |
| 28 target_transform.Rotate(30.0); | 28 target_transform.Rotate(30.0); |
| 29 base::TimeTicks start_time; | 29 base::TimeTicks start_time; |
| 30 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 30 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
| 31 | 31 |
| 32 scoped_ptr<LayerAnimationElement> element( | 32 scoped_ptr<LayerAnimationElement> element( |
| 33 LayerAnimationElement::CreateTransformElement(target_transform, delta)); | 33 LayerAnimationElement::CreateTransformElement(target_transform, delta)); |
| 34 | 34 |
| 35 for (int i = 0; i < 2; ++i) { | 35 for (int i = 0; i < 2; ++i) { |
| 36 start_time += delta; | 36 start_time += delta; |
| 37 element->set_start_time(start_time); | 37 element->set_requested_start_time(start_time); |
| 38 delegate.SetTransformFromAnimation(start_transform); | 38 delegate.SetTransformFromAnimation(start_transform); |
| 39 element->Start(&delegate, 1); |
| 39 element->Progress(start_time, &delegate); | 40 element->Progress(start_time, &delegate); |
| 40 CheckApproximatelyEqual(start_transform, | 41 CheckApproximatelyEqual(start_transform, |
| 41 delegate.GetTransformForAnimation()); | 42 delegate.GetTransformForAnimation()); |
| 42 element->Progress(start_time + delta/2, &delegate); | 43 element->Progress(start_time + delta/2, &delegate); |
| 43 CheckApproximatelyEqual(middle_transform, | 44 CheckApproximatelyEqual(middle_transform, |
| 44 delegate.GetTransformForAnimation()); | 45 delegate.GetTransformForAnimation()); |
| 46 |
| 47 base::TimeDelta element_duration; |
| 48 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); |
| 49 EXPECT_EQ(delta, element_duration); |
| 50 |
| 45 element->Progress(start_time + delta, &delegate); | 51 element->Progress(start_time + delta, &delegate); |
| 46 CheckApproximatelyEqual(target_transform, | 52 CheckApproximatelyEqual(target_transform, |
| 47 delegate.GetTransformForAnimation()); | 53 delegate.GetTransformForAnimation()); |
| 48 } | 54 } |
| 49 | 55 |
| 50 LayerAnimationElement::TargetValue target_value(&delegate); | 56 LayerAnimationElement::TargetValue target_value(&delegate); |
| 51 element->GetTargetValue(&target_value); | 57 element->GetTargetValue(&target_value); |
| 52 CheckApproximatelyEqual(target_transform, target_value.transform); | 58 CheckApproximatelyEqual(target_transform, target_value.transform); |
| 53 | |
| 54 base::TimeDelta element_duration; | |
| 55 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); | |
| 56 EXPECT_EQ(delta, element_duration); | |
| 57 } | 59 } |
| 58 | 60 |
| 59 // Check that the bounds element progresses the delegate as expected and | 61 // Check that the bounds element progresses the delegate as expected and |
| 60 // that the element can be reused after it completes. | 62 // that the element can be reused after it completes. |
| 61 TEST(LayerAnimationElementTest, BoundsElement) { | 63 TEST(LayerAnimationElementTest, BoundsElement) { |
| 62 TestLayerAnimationDelegate delegate; | 64 TestLayerAnimationDelegate delegate; |
| 63 gfx::Rect start, target, middle; | 65 gfx::Rect start, target, middle; |
| 64 start = target = middle = gfx::Rect(0, 0, 50, 50); | 66 start = target = middle = gfx::Rect(0, 0, 50, 50); |
| 65 start.set_x(-90); | 67 start.set_x(-90); |
| 66 target.set_x(90); | 68 target.set_x(90); |
| 67 base::TimeTicks start_time; | 69 base::TimeTicks start_time; |
| 68 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 70 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
| 69 | 71 |
| 70 scoped_ptr<LayerAnimationElement> element( | 72 scoped_ptr<LayerAnimationElement> element( |
| 71 LayerAnimationElement::CreateBoundsElement(target, delta)); | 73 LayerAnimationElement::CreateBoundsElement(target, delta)); |
| 72 | 74 |
| 73 for (int i = 0; i < 2; ++i) { | 75 for (int i = 0; i < 2; ++i) { |
| 74 start_time += delta; | 76 start_time += delta; |
| 75 element->set_start_time(start_time); | 77 element->set_requested_start_time(start_time); |
| 76 delegate.SetBoundsFromAnimation(start); | 78 delegate.SetBoundsFromAnimation(start); |
| 79 element->Start(&delegate, 1); |
| 77 element->Progress(start_time, &delegate); | 80 element->Progress(start_time, &delegate); |
| 78 CheckApproximatelyEqual(start, delegate.GetBoundsForAnimation()); | 81 CheckApproximatelyEqual(start, delegate.GetBoundsForAnimation()); |
| 79 element->Progress(start_time + delta/2, &delegate); | 82 element->Progress(start_time + delta/2, &delegate); |
| 80 CheckApproximatelyEqual(middle, delegate.GetBoundsForAnimation()); | 83 CheckApproximatelyEqual(middle, delegate.GetBoundsForAnimation()); |
| 84 |
| 85 base::TimeDelta element_duration; |
| 86 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); |
| 87 EXPECT_EQ(delta, element_duration); |
| 88 |
| 81 element->Progress(start_time + delta, &delegate); | 89 element->Progress(start_time + delta, &delegate); |
| 82 CheckApproximatelyEqual(target, delegate.GetBoundsForAnimation()); | 90 CheckApproximatelyEqual(target, delegate.GetBoundsForAnimation()); |
| 83 } | 91 } |
| 84 | 92 |
| 85 LayerAnimationElement::TargetValue target_value(&delegate); | 93 LayerAnimationElement::TargetValue target_value(&delegate); |
| 86 element->GetTargetValue(&target_value); | 94 element->GetTargetValue(&target_value); |
| 87 CheckApproximatelyEqual(target, target_value.bounds); | 95 CheckApproximatelyEqual(target, target_value.bounds); |
| 88 | |
| 89 base::TimeDelta element_duration; | |
| 90 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); | |
| 91 EXPECT_EQ(delta, element_duration); | |
| 92 } | 96 } |
| 93 | 97 |
| 94 // Check that the opacity element progresses the delegate as expected and | 98 // Check that the opacity element progresses the delegate as expected and |
| 95 // that the element can be reused after it completes. | 99 // that the element can be reused after it completes. |
| 96 TEST(LayerAnimationElementTest, OpacityElement) { | 100 TEST(LayerAnimationElementTest, OpacityElement) { |
| 97 TestLayerAnimationDelegate delegate; | 101 TestLayerAnimationDelegate delegate; |
| 98 float start = 0.0; | 102 float start = 0.0; |
| 99 float middle = 0.5; | 103 float middle = 0.5; |
| 100 float target = 1.0; | 104 float target = 1.0; |
| 101 base::TimeTicks start_time; | 105 base::TimeTicks start_time; |
| 106 base::TimeTicks effective_start_time; |
| 102 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 107 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
| 103 scoped_ptr<LayerAnimationElement> element( | 108 scoped_ptr<LayerAnimationElement> element( |
| 104 LayerAnimationElement::CreateOpacityElement(target, delta)); | 109 LayerAnimationElement::CreateOpacityElement(target, delta)); |
| 105 | 110 |
| 106 for (int i = 0; i < 2; ++i) { | 111 for (int i = 0; i < 2; ++i) { |
| 107 start_time += delta; | 112 start_time = effective_start_time + delta; |
| 108 element->set_start_time(start_time); | 113 element->set_requested_start_time(start_time); |
| 109 delegate.SetOpacityFromAnimation(start); | 114 delegate.SetOpacityFromAnimation(start); |
| 115 element->Start(&delegate, 1); |
| 110 element->Progress(start_time, &delegate); | 116 element->Progress(start_time, &delegate); |
| 111 EXPECT_FLOAT_EQ(start, delegate.GetOpacityForAnimation()); | 117 EXPECT_FLOAT_EQ(start, element->last_progressed_fraction()); |
| 112 element->Progress(start_time + delta/2, &delegate); | 118 effective_start_time = start_time + delta; |
| 113 EXPECT_FLOAT_EQ(middle, delegate.GetOpacityForAnimation()); | 119 element->set_effective_start_time(effective_start_time); |
| 114 element->Progress(start_time + delta, &delegate); | 120 element->Progress(effective_start_time, &delegate); |
| 121 EXPECT_FLOAT_EQ(start, element->last_progressed_fraction()); |
| 122 element->Progress(effective_start_time + delta/2, &delegate); |
| 123 EXPECT_FLOAT_EQ(middle, element->last_progressed_fraction()); |
| 124 |
| 125 base::TimeDelta element_duration; |
| 126 EXPECT_TRUE(element->IsFinished(effective_start_time + delta, |
| 127 &element_duration)); |
| 128 EXPECT_EQ(2 * delta, element_duration); |
| 129 |
| 130 element->Progress(effective_start_time + delta, &delegate); |
| 131 EXPECT_FLOAT_EQ(target, element->last_progressed_fraction()); |
| 115 EXPECT_FLOAT_EQ(target, delegate.GetOpacityForAnimation()); | 132 EXPECT_FLOAT_EQ(target, delegate.GetOpacityForAnimation()); |
| 116 } | 133 } |
| 117 | 134 |
| 118 LayerAnimationElement::TargetValue target_value(&delegate); | 135 LayerAnimationElement::TargetValue target_value(&delegate); |
| 119 element->GetTargetValue(&target_value); | 136 element->GetTargetValue(&target_value); |
| 120 EXPECT_FLOAT_EQ(target, target_value.opacity); | 137 EXPECT_FLOAT_EQ(target, target_value.opacity); |
| 121 | |
| 122 base::TimeDelta element_duration; | |
| 123 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); | |
| 124 EXPECT_EQ(delta, element_duration); | |
| 125 } | 138 } |
| 126 | 139 |
| 127 // Check that the visibility element progresses the delegate as expected and | 140 // Check that the visibility element progresses the delegate as expected and |
| 128 // that the element can be reused after it completes. | 141 // that the element can be reused after it completes. |
| 129 TEST(LayerAnimationElementTest, VisibilityElement) { | 142 TEST(LayerAnimationElementTest, VisibilityElement) { |
| 130 TestLayerAnimationDelegate delegate; | 143 TestLayerAnimationDelegate delegate; |
| 131 bool start = true; | 144 bool start = true; |
| 132 bool target = false; | 145 bool target = false; |
| 133 base::TimeTicks start_time; | 146 base::TimeTicks start_time; |
| 134 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 147 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
| 135 scoped_ptr<LayerAnimationElement> element( | 148 scoped_ptr<LayerAnimationElement> element( |
| 136 LayerAnimationElement::CreateVisibilityElement(target, delta)); | 149 LayerAnimationElement::CreateVisibilityElement(target, delta)); |
| 137 | 150 |
| 138 for (int i = 0; i < 2; ++i) { | 151 for (int i = 0; i < 2; ++i) { |
| 139 start_time += delta; | 152 start_time += delta; |
| 140 element->set_start_time(start_time); | 153 element->set_requested_start_time(start_time); |
| 141 delegate.SetVisibilityFromAnimation(start); | 154 delegate.SetVisibilityFromAnimation(start); |
| 155 element->Start(&delegate, 1); |
| 142 element->Progress(start_time, &delegate); | 156 element->Progress(start_time, &delegate); |
| 143 EXPECT_TRUE(delegate.GetVisibilityForAnimation()); | 157 EXPECT_TRUE(delegate.GetVisibilityForAnimation()); |
| 144 element->Progress(start_time + delta/2, &delegate); | 158 element->Progress(start_time + delta/2, &delegate); |
| 145 EXPECT_TRUE(delegate.GetVisibilityForAnimation()); | 159 EXPECT_TRUE(delegate.GetVisibilityForAnimation()); |
| 160 |
| 161 base::TimeDelta element_duration; |
| 162 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); |
| 163 EXPECT_EQ(delta, element_duration); |
| 164 |
| 146 element->Progress(start_time + delta, &delegate); | 165 element->Progress(start_time + delta, &delegate); |
| 147 EXPECT_FALSE(delegate.GetVisibilityForAnimation()); | 166 EXPECT_FALSE(delegate.GetVisibilityForAnimation()); |
| 148 } | 167 } |
| 149 | 168 |
| 150 LayerAnimationElement::TargetValue target_value(&delegate); | 169 LayerAnimationElement::TargetValue target_value(&delegate); |
| 151 element->GetTargetValue(&target_value); | 170 element->GetTargetValue(&target_value); |
| 152 EXPECT_FALSE(target_value.visibility); | 171 EXPECT_FALSE(target_value.visibility); |
| 153 | |
| 154 base::TimeDelta element_duration; | |
| 155 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); | |
| 156 EXPECT_EQ(delta, element_duration); | |
| 157 } | 172 } |
| 158 | 173 |
| 159 // Check that the Brightness element progresses the delegate as expected and | 174 // Check that the Brightness element progresses the delegate as expected and |
| 160 // that the element can be reused after it completes. | 175 // that the element can be reused after it completes. |
| 161 TEST(LayerAnimationElementTest, BrightnessElement) { | 176 TEST(LayerAnimationElementTest, BrightnessElement) { |
| 162 TestLayerAnimationDelegate delegate; | 177 TestLayerAnimationDelegate delegate; |
| 163 float start = 0.0; | 178 float start = 0.0; |
| 164 float middle = 0.5; | 179 float middle = 0.5; |
| 165 float target = 1.0; | 180 float target = 1.0; |
| 166 base::TimeTicks start_time; | 181 base::TimeTicks start_time; |
| 167 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 182 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
| 168 scoped_ptr<LayerAnimationElement> element( | 183 scoped_ptr<LayerAnimationElement> element( |
| 169 LayerAnimationElement::CreateBrightnessElement(target, delta)); | 184 LayerAnimationElement::CreateBrightnessElement(target, delta)); |
| 170 | 185 |
| 171 for (int i = 0; i < 2; ++i) { | 186 for (int i = 0; i < 2; ++i) { |
| 172 start_time += delta; | 187 start_time += delta; |
| 173 element->set_start_time(start_time); | 188 element->set_requested_start_time(start_time); |
| 174 delegate.SetBrightnessFromAnimation(start); | 189 delegate.SetBrightnessFromAnimation(start); |
| 190 element->Start(&delegate, 1); |
| 175 element->Progress(start_time, &delegate); | 191 element->Progress(start_time, &delegate); |
| 176 EXPECT_FLOAT_EQ(start, delegate.GetBrightnessForAnimation()); | 192 EXPECT_FLOAT_EQ(start, delegate.GetBrightnessForAnimation()); |
| 177 element->Progress(start_time + delta/2, &delegate); | 193 element->Progress(start_time + delta/2, &delegate); |
| 178 EXPECT_FLOAT_EQ(middle, delegate.GetBrightnessForAnimation()); | 194 EXPECT_FLOAT_EQ(middle, delegate.GetBrightnessForAnimation()); |
| 195 |
| 196 base::TimeDelta element_duration; |
| 197 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); |
| 198 EXPECT_EQ(delta, element_duration); |
| 199 |
| 179 element->Progress(start_time + delta, &delegate); | 200 element->Progress(start_time + delta, &delegate); |
| 180 EXPECT_FLOAT_EQ(target, delegate.GetBrightnessForAnimation()); | 201 EXPECT_FLOAT_EQ(target, delegate.GetBrightnessForAnimation()); |
| 181 } | 202 } |
| 182 | 203 |
| 183 LayerAnimationElement::TargetValue target_value(&delegate); | 204 LayerAnimationElement::TargetValue target_value(&delegate); |
| 184 element->GetTargetValue(&target_value); | 205 element->GetTargetValue(&target_value); |
| 185 EXPECT_FLOAT_EQ(target, target_value.brightness); | 206 EXPECT_FLOAT_EQ(target, target_value.brightness); |
| 186 | |
| 187 base::TimeDelta element_duration; | |
| 188 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); | |
| 189 EXPECT_EQ(delta, element_duration); | |
| 190 } | 207 } |
| 191 | 208 |
| 192 // Check that the Grayscale element progresses the delegate as expected and | 209 // Check that the Grayscale element progresses the delegate as expected and |
| 193 // that the element can be reused after it completes. | 210 // that the element can be reused after it completes. |
| 194 TEST(LayerAnimationElementTest, GrayscaleElement) { | 211 TEST(LayerAnimationElementTest, GrayscaleElement) { |
| 195 TestLayerAnimationDelegate delegate; | 212 TestLayerAnimationDelegate delegate; |
| 196 float start = 0.0; | 213 float start = 0.0; |
| 197 float middle = 0.5; | 214 float middle = 0.5; |
| 198 float target = 1.0; | 215 float target = 1.0; |
| 199 base::TimeTicks start_time; | 216 base::TimeTicks start_time; |
| 200 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 217 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
| 201 scoped_ptr<LayerAnimationElement> element( | 218 scoped_ptr<LayerAnimationElement> element( |
| 202 LayerAnimationElement::CreateGrayscaleElement(target, delta)); | 219 LayerAnimationElement::CreateGrayscaleElement(target, delta)); |
| 203 | 220 |
| 204 for (int i = 0; i < 2; ++i) { | 221 for (int i = 0; i < 2; ++i) { |
| 205 start_time += delta; | 222 start_time += delta; |
| 206 element->set_start_time(start_time); | 223 element->set_requested_start_time(start_time); |
| 207 delegate.SetGrayscaleFromAnimation(start); | 224 delegate.SetGrayscaleFromAnimation(start); |
| 225 element->Start(&delegate, 1); |
| 208 element->Progress(start_time, &delegate); | 226 element->Progress(start_time, &delegate); |
| 209 EXPECT_FLOAT_EQ(start, delegate.GetGrayscaleForAnimation()); | 227 EXPECT_FLOAT_EQ(start, delegate.GetGrayscaleForAnimation()); |
| 210 element->Progress(start_time + delta/2, &delegate); | 228 element->Progress(start_time + delta/2, &delegate); |
| 211 EXPECT_FLOAT_EQ(middle, delegate.GetGrayscaleForAnimation()); | 229 EXPECT_FLOAT_EQ(middle, delegate.GetGrayscaleForAnimation()); |
| 230 |
| 231 base::TimeDelta element_duration; |
| 232 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); |
| 233 EXPECT_EQ(delta, element_duration); |
| 234 |
| 212 element->Progress(start_time + delta, &delegate); | 235 element->Progress(start_time + delta, &delegate); |
| 213 EXPECT_FLOAT_EQ(target, delegate.GetGrayscaleForAnimation()); | 236 EXPECT_FLOAT_EQ(target, delegate.GetGrayscaleForAnimation()); |
| 214 } | 237 } |
| 215 | 238 |
| 216 LayerAnimationElement::TargetValue target_value(&delegate); | 239 LayerAnimationElement::TargetValue target_value(&delegate); |
| 217 element->GetTargetValue(&target_value); | 240 element->GetTargetValue(&target_value); |
| 218 EXPECT_FLOAT_EQ(target, target_value.grayscale); | 241 EXPECT_FLOAT_EQ(target, target_value.grayscale); |
| 219 | |
| 220 base::TimeDelta element_duration; | |
| 221 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); | |
| 222 EXPECT_EQ(delta, element_duration); | |
| 223 } | 242 } |
| 224 | 243 |
| 225 // Check that the pause element progresses the delegate as expected and | 244 // Check that the pause element progresses the delegate as expected and |
| 226 // that the element can be reused after it completes. | 245 // that the element can be reused after it completes. |
| 227 TEST(LayerAnimationElementTest, PauseElement) { | 246 TEST(LayerAnimationElementTest, PauseElement) { |
| 228 LayerAnimationElement::AnimatableProperties properties; | 247 LayerAnimationElement::AnimatableProperties properties; |
| 229 properties.insert(LayerAnimationElement::TRANSFORM); | 248 properties.insert(LayerAnimationElement::TRANSFORM); |
| 230 properties.insert(LayerAnimationElement::BOUNDS); | 249 properties.insert(LayerAnimationElement::BOUNDS); |
| 231 properties.insert(LayerAnimationElement::OPACITY); | 250 properties.insert(LayerAnimationElement::OPACITY); |
| 232 properties.insert(LayerAnimationElement::BRIGHTNESS); | 251 properties.insert(LayerAnimationElement::BRIGHTNESS); |
| 233 properties.insert(LayerAnimationElement::GRAYSCALE); | 252 properties.insert(LayerAnimationElement::GRAYSCALE); |
| 234 base::TimeTicks start_time; | 253 base::TimeTicks start_time; |
| 235 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); | 254 base::TimeDelta delta = base::TimeDelta::FromSeconds(1); |
| 236 | 255 |
| 237 scoped_ptr<LayerAnimationElement> element( | 256 scoped_ptr<LayerAnimationElement> element( |
| 238 LayerAnimationElement::CreatePauseElement(properties, delta)); | 257 LayerAnimationElement::CreatePauseElement(properties, delta)); |
| 239 | 258 |
| 240 TestLayerAnimationDelegate delegate; | 259 TestLayerAnimationDelegate delegate; |
| 241 TestLayerAnimationDelegate copy = delegate; | 260 TestLayerAnimationDelegate copy = delegate; |
| 242 | 261 |
| 243 start_time += delta; | 262 start_time += delta; |
| 244 element->set_start_time(start_time); | 263 element->set_requested_start_time(start_time); |
| 264 element->Start(&delegate, 1); |
| 265 |
| 266 // Pause should last for |delta|. |
| 267 base::TimeDelta element_duration; |
| 268 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); |
| 269 EXPECT_EQ(delta, element_duration); |
| 270 |
| 245 element->Progress(start_time + delta, &delegate); | 271 element->Progress(start_time + delta, &delegate); |
| 246 | 272 |
| 247 // Nothing should have changed. | 273 // Nothing should have changed. |
| 248 CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), | 274 CheckApproximatelyEqual(delegate.GetBoundsForAnimation(), |
| 249 copy.GetBoundsForAnimation()); | 275 copy.GetBoundsForAnimation()); |
| 250 CheckApproximatelyEqual(delegate.GetTransformForAnimation(), | 276 CheckApproximatelyEqual(delegate.GetTransformForAnimation(), |
| 251 copy.GetTransformForAnimation()); | 277 copy.GetTransformForAnimation()); |
| 252 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), | 278 EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), |
| 253 copy.GetOpacityForAnimation()); | 279 copy.GetOpacityForAnimation()); |
| 254 EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), | 280 EXPECT_FLOAT_EQ(delegate.GetBrightnessForAnimation(), |
| 255 copy.GetBrightnessForAnimation()); | 281 copy.GetBrightnessForAnimation()); |
| 256 EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), | 282 EXPECT_FLOAT_EQ(delegate.GetGrayscaleForAnimation(), |
| 257 copy.GetGrayscaleForAnimation()); | 283 copy.GetGrayscaleForAnimation()); |
| 258 | |
| 259 // Pause should last for |delta|. | |
| 260 base::TimeDelta element_duration; | |
| 261 EXPECT_TRUE(element->IsFinished(start_time + delta, &element_duration)); | |
| 262 EXPECT_EQ(delta, element_duration); | |
| 263 } | 284 } |
| 264 | 285 |
| 265 } // namespace | 286 } // namespace |
| 266 | 287 |
| 267 } // namespace ui | 288 } // namespace ui |
| OLD | NEW |