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

Unified Diff: Source/platform/animation/TimingFunctionTestHelper.cpp

Issue 152853003: Web Animations API: Bindings for TimedItem.specified with readonly attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix timed-item-specified-getters.html (mashed in rebase) Created 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/platform/animation/TimingFunctionTestHelper.cpp
diff --git a/Source/platform/animation/TimingFunctionTestHelper.cpp b/Source/platform/animation/TimingFunctionTestHelper.cpp
index 74e74aea8cdba7660160d90d7cc77a3a7f6abeaa..860a96ce719fc1ad238d980c882b0a2a4fd9572a 100644
--- a/Source/platform/animation/TimingFunctionTestHelper.cpp
+++ b/Source/platform/animation/TimingFunctionTestHelper.cpp
@@ -36,23 +36,6 @@ namespace WebCore {
// This class exists so that ChainedTimingFunction only needs to friend one thing.
class ChainedTimingFunctionTestHelper {
- static void PrintTo(const ChainedTimingFunction& timingFunction, ::std::ostream* os)
- {
- // Forward declare the generic PrintTo function as ChainedTimingFunction needs to call it.
- void PrintTo(const TimingFunction&, ::std::ostream*);
-
- *os << "ChainedTimingFunction@" << &timingFunction << "(";
- for (size_t i = 0; i < timingFunction.m_segments.size(); i++) {
- ChainedTimingFunction::Segment segment = timingFunction.m_segments[i];
- PrintTo(*(segment.m_timingFunction.get()), os);
- *os << "[" << segment.m_min << " -> " << segment.m_max << "]";
- if (i+1 != timingFunction.m_segments.size()) {
- *os << ", ";
- }
- }
- *os << ")";
- }
-
static bool equals(const ChainedTimingFunction& lhs, const TimingFunction& rhs)
{
if (rhs.type() != TimingFunction::ChainedFunction)
@@ -89,98 +72,12 @@ class ChainedTimingFunctionTestHelper {
return (*(lhs.m_timingFunction.get())) == (*(rhs.m_timingFunction.get()));
}
- friend void PrintTo(const ChainedTimingFunction&, ::std::ostream*);
friend bool operator==(const ChainedTimingFunction& lhs, const TimingFunction& rhs);
};
-void PrintTo(const LinearTimingFunction& timingFunction, ::std::ostream* os)
-{
- *os << "LinearTimingFunction@" << &timingFunction;
-}
-
-void PrintTo(const CubicBezierTimingFunction& timingFunction, ::std::ostream* os)
-{
- *os << "CubicBezierTimingFunction@" << &timingFunction << "(";
- switch (timingFunction.subType()) {
- case CubicBezierTimingFunction::Ease:
- *os << "Ease";
- break;
- case CubicBezierTimingFunction::EaseIn:
- *os << "EaseIn";
- break;
- case CubicBezierTimingFunction::EaseOut:
- *os << "EaseOut";
- break;
- case CubicBezierTimingFunction::EaseInOut:
- *os << "EaseInOut";
- break;
- case CubicBezierTimingFunction::Custom:
- *os << "Custom";
- break;
- default:
- ASSERT_NOT_REACHED();
- }
- *os << ", " << timingFunction.x1();
- *os << ", " << timingFunction.y1();
- *os << ", " << timingFunction.x2();
- *os << ", " << timingFunction.y2();
- *os << ")";
-}
-
-void PrintTo(const StepsTimingFunction& timingFunction, ::std::ostream* os)
-{
- *os << "StepsTimingFunction@" << &timingFunction << "(";
- switch (timingFunction.subType()) {
- case StepsTimingFunction::Start:
- *os << "Start";
- break;
- case StepsTimingFunction::End:
- *os << "End";
- break;
- case StepsTimingFunction::Custom:
- *os << "Custom";
- break;
- default:
- ASSERT_NOT_REACHED();
- }
- *os << ", " << timingFunction.numberOfSteps();
- *os << ", " << (timingFunction.stepAtStart() ? "true" : "false");
- *os << ")";
-}
-
-void PrintTo(const ChainedTimingFunction& timingFunction, ::std::ostream* os)
-{
- ChainedTimingFunctionTestHelper::PrintTo(timingFunction, os);
-}
-
-// The generic PrintTo *must* come after the non-generic PrintTo otherwise it
-// will end up calling itself.
void PrintTo(const TimingFunction& timingFunction, ::std::ostream* os)
{
- switch (timingFunction.type()) {
- case TimingFunction::LinearFunction: {
- const LinearTimingFunction& linear = toLinearTimingFunction(timingFunction);
- PrintTo(linear, os);
- return;
- }
- case TimingFunction::CubicBezierFunction: {
- const CubicBezierTimingFunction& cubic = toCubicBezierTimingFunction(timingFunction);
- PrintTo(cubic, os);
- return;
- }
- case TimingFunction::StepsFunction: {
- const StepsTimingFunction& step = toStepsTimingFunction(timingFunction);
- PrintTo(step, os);
- return;
- }
- case TimingFunction::ChainedFunction: {
- const ChainedTimingFunction& chained = toChainedTimingFunction(timingFunction);
- PrintTo(chained, os);
- return;
- }
- default:
- ASSERT_NOT_REACHED();
- }
+ *os << timingFunction.toString().latin1().data();
}
bool operator==(const LinearTimingFunction& lhs, const TimingFunction& rhs)
« no previous file with comments | « Source/platform/animation/TimingFunctionTestHelper.h ('k') | Source/platform/animation/TimingFunctionTestHelperTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698