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

Side by Side Diff: Source/core/animation/CompositorAnimationsTestHelper.h

Issue 1052103004: Make test proxy Platform objects provide currentThread(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Code formatting only Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/fetch/CachingCorrectnessTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 class WebCompositorSupportMock : public WebCompositorSupport { 136 class WebCompositorSupportMock : public WebCompositorSupport {
137 public: 137 public:
138 MOCK_METHOD4(createAnimation, WebCompositorAnimation*(const WebComposito rAnimationCurve& curve, WebCompositorAnimation::TargetProperty target, int group Id, int animationId)); 138 MOCK_METHOD4(createAnimation, WebCompositorAnimation*(const WebComposito rAnimationCurve& curve, WebCompositorAnimation::TargetProperty target, int group Id, int animationId));
139 MOCK_METHOD0(createFloatAnimationCurve, WebFloatAnimationCurve*()); 139 MOCK_METHOD0(createFloatAnimationCurve, WebFloatAnimationCurve*());
140 }; 140 };
141 141
142 private: 142 private:
143 class PlatformProxy : public Platform { 143 class PlatformProxy : public Platform {
144 public: 144 public:
145 PlatformProxy(WebCompositorSupportMock** compositor) : m_compositor(comp ositor) { } 145 PlatformProxy(WebCompositorSupportMock** compositor) : m_platform(Platfo rm::current()), m_compositor(compositor) { }
146
147 ~PlatformProxy()
148 {
149 blink::Platform::initialize(m_platform);
150 }
146 151
147 virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) { ASSERT_NOT_REACHED(); } 152 virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) { ASSERT_NOT_REACHED(); }
148 const unsigned char* getTraceCategoryEnabledFlag(const char* categoryNam e) override 153 const unsigned char* getTraceCategoryEnabledFlag(const char* categoryNam e) override
149 { 154 {
150 static const unsigned char tracingIsDisabled = 0; 155 static const unsigned char tracingIsDisabled = 0;
151 return &tracingIsDisabled; 156 return &tracingIsDisabled;
152 } 157 }
153 158
159 WebThread* currentThread() override
160 {
161 return m_platform->currentThread();
162 }
163
154 private: 164 private:
165 blink::Platform* m_platform; // Not owned.
155 WebCompositorSupportMock** m_compositor; 166 WebCompositorSupportMock** m_compositor;
156 virtual WebCompositorSupport* compositorSupport() override { return *m_c ompositor; } 167 virtual WebCompositorSupport* compositorSupport() override { return *m_c ompositor; }
157 }; 168 };
158 169
159 WebCompositorSupportMock* m_mockCompositor; 170 WebCompositorSupportMock* m_mockCompositor;
160 PlatformProxy m_proxyPlatform; 171 PlatformProxy m_proxyPlatform;
161 172
162 protected: 173 protected:
163 Platform* m_platform;
164
165 virtual void SetUp() 174 virtual void SetUp()
166 { 175 {
167 m_mockCompositor = 0; 176 m_mockCompositor = 0;
168 m_platform = Platform::current();
169 Platform::initialize(&m_proxyPlatform); 177 Platform::initialize(&m_proxyPlatform);
170 } 178 }
171 179
172 virtual void TearDown()
173 {
174 Platform::initialize(m_platform);
175 }
176
177 void setCompositorForTesting(WebCompositorSupportMock& mock) 180 void setCompositorForTesting(WebCompositorSupportMock& mock)
178 { 181 {
179 ASSERT(!m_mockCompositor); 182 ASSERT(!m_mockCompositor);
180 m_mockCompositor = &mock; 183 m_mockCompositor = &mock;
181 } 184 }
182 }; 185 };
183 186
184 } 187 }
185 188
186 #endif 189 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/fetch/CachingCorrectnessTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698