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

Side by Side Diff: Source/core/animation/AnimationTranslationUtilTest.cpp

Issue 453393002: Cleanup duplicated namespace in AnimationTranslationUtil (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 25 matching lines...) Expand all
36 #include "platform/transforms/TransformOperations.h" 36 #include "platform/transforms/TransformOperations.h"
37 #include "platform/transforms/TranslateTransformOperation.h" 37 #include "platform/transforms/TranslateTransformOperation.h"
38 #include "public/platform/WebAnimation.h" 38 #include "public/platform/WebAnimation.h"
39 #include "public/platform/WebFilterOperations.h" 39 #include "public/platform/WebFilterOperations.h"
40 #include "public/platform/WebTransformOperations.h" 40 #include "public/platform/WebTransformOperations.h"
41 #include "wtf/RefPtr.h" 41 #include "wtf/RefPtr.h"
42 #include <gmock/gmock.h> 42 #include <gmock/gmock.h>
43 #include <gtest/gtest.h> 43 #include <gtest/gtest.h>
44 44
45 using namespace blink; 45 using namespace blink;
46 using namespace blink;
47 46
48 namespace { 47 namespace {
49 48
50 class WebTransformOperationsMock : public blink::WebTransformOperations { 49 class WebTransformOperationsMock : public WebTransformOperations {
51 public: 50 public:
52 MOCK_CONST_METHOD1(canBlendWith, bool(const WebTransformOperations&)); 51 MOCK_CONST_METHOD1(canBlendWith, bool(const WebTransformOperations&));
53 MOCK_METHOD3(appendTranslate, void(double, double, double)); 52 MOCK_METHOD3(appendTranslate, void(double, double, double));
54 MOCK_METHOD4(appendRotate, void(double, double, double, double)); 53 MOCK_METHOD4(appendRotate, void(double, double, double, double));
55 MOCK_METHOD3(appendScale, void(double, double, double)); 54 MOCK_METHOD3(appendScale, void(double, double, double));
56 MOCK_METHOD2(appendSkew, void(double, double)); 55 MOCK_METHOD2(appendSkew, void(double, double));
57 MOCK_METHOD1(appendPerspective, void(double)); 56 MOCK_METHOD1(appendPerspective, void(double));
58 MOCK_METHOD1(appendMatrix, void(const SkMatrix44&)); 57 MOCK_METHOD1(appendMatrix, void(const SkMatrix44&));
59 MOCK_METHOD0(appendIdentity, void()); 58 MOCK_METHOD0(appendIdentity, void());
60 MOCK_CONST_METHOD0(isIdentity, bool()); 59 MOCK_CONST_METHOD0(isIdentity, bool());
61 }; 60 };
62 61
63 class WebFilterOperationsMock : public blink::WebFilterOperations { 62 class WebFilterOperationsMock : public WebFilterOperations {
64 public: 63 public:
65 MOCK_METHOD1(appendGrayscaleFilter, void(float)); 64 MOCK_METHOD1(appendGrayscaleFilter, void(float));
66 MOCK_METHOD1(appendSepiaFilter, void(float)); 65 MOCK_METHOD1(appendSepiaFilter, void(float));
67 MOCK_METHOD1(appendSaturateFilter, void(float)); 66 MOCK_METHOD1(appendSaturateFilter, void(float));
68 MOCK_METHOD1(appendHueRotateFilter, void(float)); 67 MOCK_METHOD1(appendHueRotateFilter, void(float));
69 MOCK_METHOD1(appendInvertFilter, void(float)); 68 MOCK_METHOD1(appendInvertFilter, void(float));
70 MOCK_METHOD1(appendBrightnessFilter, void(float)); 69 MOCK_METHOD1(appendBrightnessFilter, void(float));
71 MOCK_METHOD1(appendContrastFilter, void(float)); 70 MOCK_METHOD1(appendContrastFilter, void(float));
72 MOCK_METHOD1(appendOpacityFilter, void(float)); 71 MOCK_METHOD1(appendOpacityFilter, void(float));
73 MOCK_METHOD1(appendBlurFilter, void(float)); 72 MOCK_METHOD1(appendBlurFilter, void(float));
74 MOCK_METHOD3(appendDropShadowFilter, void(WebPoint, float, WebColor)); 73 MOCK_METHOD3(appendDropShadowFilter, void(WebPoint, float, WebColor));
75 MOCK_METHOD1(appendColorMatrixFilter, void(SkScalar[20])); 74 MOCK_METHOD1(appendColorMatrixFilter, void(SkScalar[20]));
76 MOCK_METHOD2(appendZoomFilter, void(float, int)); 75 MOCK_METHOD2(appendZoomFilter, void(float, int));
77 MOCK_METHOD1(appendSaturatingBrightnessFilter, void(float)); 76 MOCK_METHOD1(appendSaturatingBrightnessFilter, void(float));
78 MOCK_METHOD1(appendReferenceFilter, void(SkImageFilter*)); 77 MOCK_METHOD1(appendReferenceFilter, void(SkImageFilter*));
79 MOCK_METHOD0(clear, void()); 78 MOCK_METHOD0(clear, void());
80 }; 79 };
81 80
82 TEST(AnimationTranslationUtilTest, transformsWork) 81 TEST(AnimationTranslationUtilTest, transformsWork)
83 { 82 {
84 TransformOperations ops; 83 TransformOperations ops;
85 WebTransformOperationsMock outOps; 84 WebTransformOperationsMock outOps;
86 85
87 EXPECT_CALL(outOps, appendTranslate(2, 0, 0)); 86 EXPECT_CALL(outOps, appendTranslate(2, 0, 0));
88 EXPECT_CALL(outOps, appendRotate(0.1, 0.2, 0.3, 200000.4)); 87 EXPECT_CALL(outOps, appendRotate(0.1, 0.2, 0.3, 200000.4));
89 EXPECT_CALL(outOps, appendScale(50.2, 100, -4)); 88 EXPECT_CALL(outOps, appendScale(50.2, 100, -4));
90 89
91 ops.operations().append(TranslateTransformOperation::create(Length(2, blink: :Fixed), Length(0, blink::Fixed), TransformOperation::TranslateX)); 90 ops.operations().append(TranslateTransformOperation::create(Length(2, blink: :Fixed), Length(0, blink::Fixed), TransformOperation::TranslateX));
kangil_ 2014/08/11 10:39:22 s/blink::Fixed/Fixed
92 ops.operations().append(RotateTransformOperation::create(0.1, 0.2, 0.3, 2000 00.4, TransformOperation::Rotate3D)); 91 ops.operations().append(RotateTransformOperation::create(0.1, 0.2, 0.3, 2000 00.4, TransformOperation::Rotate3D));
93 ops.operations().append(ScaleTransformOperation::create(50.2, 100, -4, Trans formOperation::Scale3D)); 92 ops.operations().append(ScaleTransformOperation::create(50.2, 100, -4, Trans formOperation::Scale3D));
94 toWebTransformOperations(ops, &outOps); 93 toWebTransformOperations(ops, &outOps);
95 } 94 }
96 95
97 TEST(AnimationTranslationUtilTest, filtersWork) 96 TEST(AnimationTranslationUtilTest, filtersWork)
98 { 97 {
99 FilterOperations ops; 98 FilterOperations ops;
100 WebFilterOperationsMock outOps; 99 WebFilterOperationsMock outOps;
101 100
102 EXPECT_CALL(outOps, appendSaturateFilter(0.5)); 101 EXPECT_CALL(outOps, appendSaturateFilter(0.5));
103 EXPECT_CALL(outOps, appendGrayscaleFilter(0.2f)); 102 EXPECT_CALL(outOps, appendGrayscaleFilter(0.2f));
104 EXPECT_CALL(outOps, appendSepiaFilter(0.8f)); 103 EXPECT_CALL(outOps, appendSepiaFilter(0.8f));
105 EXPECT_CALL(outOps, appendOpacityFilter(0.1f)); 104 EXPECT_CALL(outOps, appendOpacityFilter(0.1f));
106 105
107 ops.operations().append(BasicColorMatrixFilterOperation::create(0.5, FilterO peration::SATURATE)); 106 ops.operations().append(BasicColorMatrixFilterOperation::create(0.5, FilterO peration::SATURATE));
108 ops.operations().append(BasicColorMatrixFilterOperation::create(0.2, FilterO peration::GRAYSCALE)); 107 ops.operations().append(BasicColorMatrixFilterOperation::create(0.2, FilterO peration::GRAYSCALE));
109 ops.operations().append(BasicColorMatrixFilterOperation::create(0.8, FilterO peration::SEPIA)); 108 ops.operations().append(BasicColorMatrixFilterOperation::create(0.8, FilterO peration::SEPIA));
110 ops.operations().append(BasicColorMatrixFilterOperation::create(0.1, FilterO peration::OPACITY)); 109 ops.operations().append(BasicColorMatrixFilterOperation::create(0.1, FilterO peration::OPACITY));
111 toWebFilterOperations(ops, &outOps); 110 toWebFilterOperations(ops, &outOps);
112 } 111 }
113 112
114 } 113 }
115 114
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698