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