OLD | NEW |
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 Loading... |
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_oldPlatform(bli
nk::Platform::current()), m_compositor(compositor) { } |
146 | 146 |
147 virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t
length) { ASSERT_NOT_REACHED(); } | 147 virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t
length) { ASSERT_NOT_REACHED(); } |
148 const unsigned char* getTraceCategoryEnabledFlag(const char* categoryNam
e) override | 148 const unsigned char* getTraceCategoryEnabledFlag(const char* categoryNam
e) override |
149 { | 149 { |
150 static const unsigned char tracingIsDisabled = 0; | 150 static const unsigned char tracingIsDisabled = 0; |
151 return &tracingIsDisabled; | 151 return &tracingIsDisabled; |
152 } | 152 } |
153 | 153 |
| 154 WebThread* currentThread() override |
| 155 { |
| 156 return m_oldPlatform->currentThread(); |
| 157 } |
| 158 |
154 private: | 159 private: |
| 160 blink::Platform* m_oldPlatform; // NOT OWNED |
155 WebCompositorSupportMock** m_compositor; | 161 WebCompositorSupportMock** m_compositor; |
156 virtual WebCompositorSupport* compositorSupport() override { return *m_c
ompositor; } | 162 virtual WebCompositorSupport* compositorSupport() override { return *m_c
ompositor; } |
157 }; | 163 }; |
158 | 164 |
159 WebCompositorSupportMock* m_mockCompositor; | 165 WebCompositorSupportMock* m_mockCompositor; |
160 PlatformProxy m_proxyPlatform; | 166 PlatformProxy m_proxyPlatform; |
161 | 167 |
162 protected: | 168 protected: |
163 Platform* m_platform; | 169 Platform* m_platform; |
164 | 170 |
(...skipping 12 matching lines...) Expand all Loading... |
177 void setCompositorForTesting(WebCompositorSupportMock& mock) | 183 void setCompositorForTesting(WebCompositorSupportMock& mock) |
178 { | 184 { |
179 ASSERT(!m_mockCompositor); | 185 ASSERT(!m_mockCompositor); |
180 m_mockCompositor = &mock; | 186 m_mockCompositor = &mock; |
181 } | 187 } |
182 }; | 188 }; |
183 | 189 |
184 } | 190 } |
185 | 191 |
186 #endif | 192 #endif |
OLD | NEW |