Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: third_party/WebKit/Source/core/animation/TimingInputTest.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "core/animation/TimingInput.h" 5 #include "core/animation/TimingInput.h"
6 6
7 #include <v8.h> 7 #include <v8.h>
8 #include "bindings/core/v8/V8BindingForTesting.h" 8 #include "bindings/core/v8/V8BindingForTesting.h"
9 #include "bindings/core/v8/V8KeyframeEffectOptions.h" 9 #include "bindings/core/v8/V8KeyframeEffectOptions.h"
10 #include "core/animation/AnimationEffectTiming.h" 10 #include "core/animation/AnimationEffectTiming.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 Timing result; 46 Timing result;
47 timingConversionSuccess = TimingInput::convert(timingInputDictionary, result, 47 timingConversionSuccess = TimingInput::convert(timingInputDictionary, result,
48 nullptr, exceptionState) && 48 nullptr, exceptionState) &&
49 !exceptionState.hadException(); 49 !exceptionState.hadException();
50 return result; 50 return result;
51 } 51 }
52 52
53 TEST(AnimationTimingInputTest, TimingInputStartDelay) { 53 TEST(AnimationTimingInputTest, TimingInputStartDelay) {
54 V8TestingScope scope; 54 V8TestingScope scope;
55 bool ignoredSuccess; 55 bool ignoredSuccess;
56 EXPECT_EQ(1.1, applyTimingInputNumber(scope.isolate(), "delay", 1100,
57 ignoredSuccess)
58 .startDelay);
59 EXPECT_EQ(-1, applyTimingInputNumber(scope.isolate(), "delay", -1000,
60 ignoredSuccess)
61 .startDelay);
62 EXPECT_EQ(1, applyTimingInputString(scope.isolate(), "delay", "1000",
63 ignoredSuccess)
64 .startDelay);
65 EXPECT_EQ( 56 EXPECT_EQ(
66 0, applyTimingInputString(scope.isolate(), "delay", "1s", ignoredSuccess) 57 1.1,
67 .startDelay); 58 applyTimingInputNumber(scope.isolate(), "delay", 1100, ignoredSuccess)
68 EXPECT_EQ(0, applyTimingInputString(scope.isolate(), "delay", "Infinity", 59 .startDelay);
69 ignoredSuccess)
70 .startDelay);
71 EXPECT_EQ(0, applyTimingInputString(scope.isolate(), "delay", "-Infinity",
72 ignoredSuccess)
73 .startDelay);
74 EXPECT_EQ( 60 EXPECT_EQ(
75 0, applyTimingInputString(scope.isolate(), "delay", "NaN", ignoredSuccess) 61 -1,
76 .startDelay); 62 applyTimingInputNumber(scope.isolate(), "delay", -1000, ignoredSuccess)
77 EXPECT_EQ(0, applyTimingInputString(scope.isolate(), "delay", "rubbish", 63 .startDelay);
78 ignoredSuccess) 64 EXPECT_EQ(
79 .startDelay); 65 1,
66 applyTimingInputString(scope.isolate(), "delay", "1000", ignoredSuccess)
67 .startDelay);
68 EXPECT_EQ(
69 0,
70 applyTimingInputString(scope.isolate(), "delay", "1s", ignoredSuccess)
71 .startDelay);
72 EXPECT_EQ(0,
73 applyTimingInputString(scope.isolate(), "delay", "Infinity",
74 ignoredSuccess)
75 .startDelay);
76 EXPECT_EQ(0,
77 applyTimingInputString(scope.isolate(), "delay", "-Infinity",
78 ignoredSuccess)
79 .startDelay);
80 EXPECT_EQ(
81 0,
82 applyTimingInputString(scope.isolate(), "delay", "NaN", ignoredSuccess)
83 .startDelay);
84 EXPECT_EQ(0,
85 applyTimingInputString(scope.isolate(), "delay", "rubbish",
86 ignoredSuccess)
87 .startDelay);
80 } 88 }
81 89
82 TEST(AnimationTimingInputTest, TimingInputEndDelay) { 90 TEST(AnimationTimingInputTest, TimingInputEndDelay) {
83 V8TestingScope scope; 91 V8TestingScope scope;
84 bool ignoredSuccess; 92 bool ignoredSuccess;
85 EXPECT_EQ(10, applyTimingInputNumber(scope.isolate(), "endDelay", 10000, 93 EXPECT_EQ(
86 ignoredSuccess) 94 10,
87 .endDelay); 95 applyTimingInputNumber(scope.isolate(), "endDelay", 10000, ignoredSuccess)
88 EXPECT_EQ(-2.5, applyTimingInputNumber(scope.isolate(), "endDelay", -2500, 96 .endDelay);
89 ignoredSuccess) 97 EXPECT_EQ(
90 .endDelay); 98 -2.5,
99 applyTimingInputNumber(scope.isolate(), "endDelay", -2500, ignoredSuccess)
100 .endDelay);
91 } 101 }
92 102
93 TEST(AnimationTimingInputTest, TimingInputFillMode) { 103 TEST(AnimationTimingInputTest, TimingInputFillMode) {
94 V8TestingScope scope; 104 V8TestingScope scope;
95 Timing::FillMode defaultFillMode = Timing::FillMode::AUTO; 105 Timing::FillMode defaultFillMode = Timing::FillMode::AUTO;
96 bool ignoredSuccess; 106 bool ignoredSuccess;
97 107
98 EXPECT_EQ( 108 EXPECT_EQ(
99 Timing::FillMode::AUTO, 109 Timing::FillMode::AUTO,
100 applyTimingInputString(scope.isolate(), "fill", "auto", ignoredSuccess) 110 applyTimingInputString(scope.isolate(), "fill", "auto", ignoredSuccess)
(...skipping 23 matching lines...) Expand all
124 "backwardsandforwards", ignoredSuccess) 134 "backwardsandforwards", ignoredSuccess)
125 .fillMode); 135 .fillMode);
126 EXPECT_EQ(defaultFillMode, 136 EXPECT_EQ(defaultFillMode,
127 applyTimingInputNumber(scope.isolate(), "fill", 2, ignoredSuccess) 137 applyTimingInputNumber(scope.isolate(), "fill", 2, ignoredSuccess)
128 .fillMode); 138 .fillMode);
129 } 139 }
130 140
131 TEST(AnimationTimingInputTest, TimingInputIterationStart) { 141 TEST(AnimationTimingInputTest, TimingInputIterationStart) {
132 V8TestingScope scope; 142 V8TestingScope scope;
133 bool success; 143 bool success;
134 EXPECT_EQ(1.1, applyTimingInputNumber(scope.isolate(), "iterationStart", 1.1, 144 EXPECT_EQ(
135 success) 145 1.1,
136 .iterationStart); 146 applyTimingInputNumber(scope.isolate(), "iterationStart", 1.1, success)
147 .iterationStart);
137 EXPECT_TRUE(success); 148 EXPECT_TRUE(success);
138 149
139 applyTimingInputNumber(scope.isolate(), "iterationStart", -1, success); 150 applyTimingInputNumber(scope.isolate(), "iterationStart", -1, success);
140 EXPECT_FALSE(success); 151 EXPECT_FALSE(success);
141 152
142 applyTimingInputString(scope.isolate(), "iterationStart", "Infinity", 153 applyTimingInputString(scope.isolate(), "iterationStart", "Infinity",
143 success); 154 success);
144 EXPECT_FALSE(success); 155 EXPECT_FALSE(success);
145 156
146 applyTimingInputString(scope.isolate(), "iterationStart", "-Infinity", 157 applyTimingInputString(scope.isolate(), "iterationStart", "-Infinity",
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 EXPECT_EQ(controlTiming.fillMode, updatedTiming.fillMode); 361 EXPECT_EQ(controlTiming.fillMode, updatedTiming.fillMode);
351 EXPECT_EQ(controlTiming.iterationStart, updatedTiming.iterationStart); 362 EXPECT_EQ(controlTiming.iterationStart, updatedTiming.iterationStart);
352 EXPECT_EQ(controlTiming.iterationCount, updatedTiming.iterationCount); 363 EXPECT_EQ(controlTiming.iterationCount, updatedTiming.iterationCount);
353 EXPECT_TRUE(std::isnan(updatedTiming.iterationDuration)); 364 EXPECT_TRUE(std::isnan(updatedTiming.iterationDuration));
354 EXPECT_EQ(controlTiming.playbackRate, updatedTiming.playbackRate); 365 EXPECT_EQ(controlTiming.playbackRate, updatedTiming.playbackRate);
355 EXPECT_EQ(controlTiming.direction, updatedTiming.direction); 366 EXPECT_EQ(controlTiming.direction, updatedTiming.direction);
356 EXPECT_EQ(*controlTiming.timingFunction, *updatedTiming.timingFunction); 367 EXPECT_EQ(*controlTiming.timingFunction, *updatedTiming.timingFunction);
357 } 368 }
358 369
359 } // namespace blink 370 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698