| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/layer_tree_host.h" | 5 #include "cc/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "cc/content_layer.h" | 8 #include "cc/content_layer.h" |
| 9 #include "cc/delegated_renderer_layer.h" | 9 #include "cc/delegated_renderer_layer.h" |
| 10 #include "cc/delegated_renderer_layer_impl.h" | 10 #include "cc/delegated_renderer_layer_impl.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "cc/test/fake_web_graphics_context_3d.h" | 26 #include "cc/test/fake_web_graphics_context_3d.h" |
| 27 #include "cc/test/fake_web_scrollbar.h" | 27 #include "cc/test/fake_web_scrollbar.h" |
| 28 #include "cc/test/fake_web_scrollbar_theme_geometry.h" | 28 #include "cc/test/fake_web_scrollbar_theme_geometry.h" |
| 29 #include "cc/test/layer_tree_test_common.h" | 29 #include "cc/test/layer_tree_test_common.h" |
| 30 #include "cc/test/render_pass_test_common.h" | 30 #include "cc/test/render_pass_test_common.h" |
| 31 #include "cc/texture_layer.h" | 31 #include "cc/texture_layer.h" |
| 32 #include "cc/video_layer.h" | 32 #include "cc/video_layer.h" |
| 33 #include "cc/video_layer_impl.h" | 33 #include "cc/video_layer_impl.h" |
| 34 #include "gpu/GLES2/gl2extchromium.h" | 34 #include "gpu/GLES2/gl2extchromium.h" |
| 35 #include "media/base/media.h" | 35 #include "media/base/media.h" |
| 36 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
| 36 | 37 |
| 37 using media::VideoFrame; | 38 using media::VideoFrame; |
| 38 using WebKit::WebGraphicsContext3D; | 39 using WebKit::WebGraphicsContext3D; |
| 39 | 40 |
| 40 namespace cc { | 41 namespace cc { |
| 41 namespace { | 42 namespace { |
| 42 | 43 |
| 43 // These tests deal with losing the 3d graphics context. | 44 // These tests deal with losing the 3d graphics context. |
| 44 class LayerTreeHostContextTest : public ThreadedTest { | 45 class LayerTreeHostContextTest : public ThreadedTest { |
| 45 public: | 46 public: |
| 46 LayerTreeHostContextTest() | 47 LayerTreeHostContextTest() |
| 47 : ThreadedTest(), | 48 : ThreadedTest(), |
| 48 context3d_(NULL), | 49 context3d_(NULL), |
| 49 times_to_fail_create_(0), | 50 times_to_fail_create_(0), |
| 50 times_to_fail_initialize_(0), | 51 times_to_fail_initialize_(0), |
| 51 times_to_lose_on_create_(0), | 52 times_to_lose_on_create_(0), |
| 52 times_to_lose_during_commit_(0), | 53 times_to_lose_during_commit_(0), |
| 53 times_to_lose_during_draw_(0), | 54 times_to_lose_during_draw_(0), |
| 54 times_to_fail_recreate_(0), | 55 times_to_fail_recreate_(0), |
| 55 times_to_fail_reinitialize_(0), | 56 times_to_fail_reinitialize_(0), |
| 56 times_to_lose_on_recreate_(0) { | 57 times_to_lose_on_recreate_(0), |
| 58 times_to_fail_create_offscreen_(0), |
| 59 times_to_lose_on_create_offscreen_(0), |
| 60 times_to_fail_recreate_offscreen_(0), |
| 61 times_to_lose_on_recreate_offscreen_(0), |
| 62 times_to_expect_recreate_retried_(0), |
| 63 times_recreate_retried_(0) { |
| 57 media::InitializeMediaLibraryForTesting(); | 64 media::InitializeMediaLibraryForTesting(); |
| 58 } | 65 } |
| 59 | 66 |
| 60 void LoseContext() { | 67 void LoseContext() { |
| 61 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 68 context3d_->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 62 GL_INNOCENT_CONTEXT_RESET_ARB); | 69 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 63 context3d_ = NULL; | 70 context3d_ = NULL; |
| 64 } | 71 } |
| 65 | 72 |
| 66 virtual scoped_ptr<FakeWebGraphicsContext3D> CreateContext3d() { | 73 virtual scoped_ptr<FakeWebGraphicsContext3D> CreateContext3d() { |
| 67 return FakeWebGraphicsContext3D::Create(); | 74 return FakeWebGraphicsContext3D::Create(); |
| 68 } | 75 } |
| 69 | 76 |
| 70 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE { | 77 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE { |
| 71 if (times_to_fail_create_) { | 78 if (times_to_fail_create_) { |
| 72 --times_to_fail_create_; | 79 --times_to_fail_create_; |
| 80 ExpectRecreateToRetry(); |
| 73 return scoped_ptr<OutputSurface>(); | 81 return scoped_ptr<OutputSurface>(); |
| 74 } | 82 } |
| 75 | 83 |
| 76 scoped_ptr<FakeWebGraphicsContext3D> context3d = CreateContext3d(); | 84 scoped_ptr<FakeWebGraphicsContext3D> context3d = CreateContext3d(); |
| 77 context3d_ = context3d.get(); | 85 context3d_ = context3d.get(); |
| 78 | 86 |
| 79 if (times_to_fail_initialize_) { | 87 if (times_to_fail_initialize_) { |
| 80 --times_to_fail_initialize_; | 88 --times_to_fail_initialize_; |
| 81 // Make the context get lost during reinitialization. | 89 // Make the context get lost during reinitialization. |
| 82 // The number of times MakeCurrent succeeds is not important, and | 90 // The number of times MakeCurrent succeeds is not important, and |
| 83 // can be changed if needed to make this pass with future changes. | 91 // can be changed if needed to make this pass with future changes. |
| 84 context3d_->set_times_make_current_succeeds(2); | 92 context3d_->set_times_make_current_succeeds(2); |
| 93 ExpectRecreateToRetry(); |
| 85 } else if (times_to_lose_on_create_) { | 94 } else if (times_to_lose_on_create_) { |
| 86 --times_to_lose_on_create_; | 95 --times_to_lose_on_create_; |
| 87 LoseContext(); | 96 LoseContext(); |
| 97 ExpectRecreateToRetry(); |
| 88 } | 98 } |
| 89 | 99 |
| 90 return FakeOutputSurface::Create3d( | 100 return FakeOutputSurface::Create3d( |
| 91 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 101 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
| 92 } | 102 } |
| 93 | 103 |
| 94 virtual bool prepareToDrawOnThread( | 104 WebKit::WebGraphicsContext3D* CreateOffscreenContext3d() { |
| 95 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result) | 105 DCHECK(!offscreen_context3d_); |
| 96 OVERRIDE { | 106 DCHECK(!offscreen_gr_context_); |
| 97 EXPECT_TRUE(result); | |
| 98 if (!times_to_lose_during_draw_) | |
| 99 return result; | |
| 100 | 107 |
| 101 --times_to_lose_during_draw_; | 108 if (times_to_fail_create_offscreen_) { |
| 102 if (context3d_) | 109 --times_to_fail_create_offscreen_; |
| 103 context3d_->set_times_make_current_succeeds(0); | 110 ExpectRecreateToRetry(); |
| 104 return result; | 111 return NULL; |
| 105 } | 112 } |
| 106 | 113 |
| 114 WebKit::WebGraphicsContext3D::Attributes attrs; |
| 115 offscreen_context3d_ = |
| 116 FakeWebGraphicsContext3D::Create(attrs) |
| 117 .PassAs<WebKit::WebGraphicsContext3D>(); |
| 118 DCHECK(offscreen_context3d_); |
| 119 |
| 120 if (times_to_lose_on_create_offscreen_) { |
| 121 --times_to_lose_on_create_offscreen_; |
| 122 offscreen_context3d_->loseContextCHROMIUM( |
| 123 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); |
| 124 offscreen_context3d_.reset(); |
| 125 ExpectRecreateToRetry(); |
| 126 } |
| 127 |
| 128 return offscreen_context3d_.get(); |
| 129 } |
| 130 |
| 131 virtual WebKit::WebGraphicsContext3D* |
| 132 createOrGetOffscreenContext3dForMainThread() OVERRIDE { |
| 133 DCHECK(!implThread()); |
| 134 |
| 135 if (!offscreen_context3d_) |
| 136 CreateOffscreenContext3d(); |
| 137 return offscreen_context3d_.get(); |
| 138 } |
| 139 |
| 140 virtual WebKit::WebGraphicsContext3D* |
| 141 createOrGetOffscreenContext3dForCompositorThread() OVERRIDE { |
| 142 DCHECK(implThread()); |
| 143 |
| 144 if (!offscreen_context3d_) |
| 145 CreateOffscreenContext3d(); |
| 146 return offscreen_context3d_.get(); |
| 147 } |
| 148 |
| 149 virtual GrContext* |
| 150 createOrGetOffscreenGrContextForMainThread() OVERRIDE { |
| 151 DCHECK(!implThread()); |
| 152 // TODO(danakj): Make a FakeGrContext. |
| 153 return NULL; |
| 154 } |
| 155 |
| 156 virtual GrContext* |
| 157 createOrGetOffscreenGrContextForCompositorThread() OVERRIDE { |
| 158 DCHECK(implThread()); |
| 159 // TODO(danakj): Make a FakeGrContext. |
| 160 return NULL; |
| 161 } |
| 162 |
| 163 virtual bool prepareToDrawOnThread( |
| 164 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result) |
| 165 OVERRIDE { |
| 166 EXPECT_TRUE(result); |
| 167 if (!times_to_lose_during_draw_) |
| 168 return result; |
| 169 |
| 170 --times_to_lose_during_draw_; |
| 171 if (context3d_) |
| 172 context3d_->set_times_make_current_succeeds(0); |
| 173 return result; |
| 174 } |
| 175 |
| 107 virtual void commitCompleteOnThread(LayerTreeHostImpl *host_impl) OVERRIDE { | 176 virtual void commitCompleteOnThread(LayerTreeHostImpl *host_impl) OVERRIDE { |
| 108 if (!times_to_lose_during_commit_) | 177 if (times_to_lose_during_commit_) { |
| 109 return; | 178 --times_to_lose_during_commit_; |
| 110 --times_to_lose_during_commit_; | 179 LoseContext(); |
| 111 LoseContext(); | 180 } |
| 112 | 181 |
| 113 times_to_fail_create_ = times_to_fail_recreate_; | 182 times_to_fail_create_ = times_to_fail_recreate_; |
| 114 times_to_fail_recreate_ = 0; | 183 times_to_fail_recreate_ = 0; |
| 115 times_to_fail_initialize_ = times_to_fail_reinitialize_; | 184 times_to_fail_initialize_ = times_to_fail_reinitialize_; |
| 116 times_to_fail_reinitialize_ = 0; | 185 times_to_fail_reinitialize_ = 0; |
| 117 times_to_lose_on_create_ = times_to_lose_on_recreate_; | 186 times_to_lose_on_create_ = times_to_lose_on_recreate_; |
| 118 times_to_lose_on_recreate_ = 0; | 187 times_to_lose_on_recreate_ = 0; |
| 188 times_to_fail_create_offscreen_ = times_to_fail_recreate_offscreen_; |
| 189 times_to_fail_recreate_offscreen_ = 0; |
| 190 times_to_lose_on_create_offscreen_ = times_to_lose_on_recreate_offscreen_; |
| 191 times_to_lose_on_recreate_offscreen_ = 0; |
| 192 } |
| 193 |
| 194 virtual void willRetryRecreateOutputSurface() OVERRIDE { |
| 195 ++times_recreate_retried_; |
| 196 } |
| 197 |
| 198 virtual void afterTest() OVERRIDE { |
| 199 EXPECT_EQ(times_to_expect_recreate_retried_, times_recreate_retried_); |
| 200 } |
| 201 |
| 202 void ExpectRecreateToRetry() { |
| 203 ++times_to_expect_recreate_retried_; |
| 119 } | 204 } |
| 120 | 205 |
| 121 protected: | 206 protected: |
| 122 FakeWebGraphicsContext3D* context3d_; | 207 FakeWebGraphicsContext3D* context3d_; |
| 123 int times_to_fail_create_; | 208 int times_to_fail_create_; |
| 124 int times_to_fail_initialize_; | 209 int times_to_fail_initialize_; |
| 125 int times_to_lose_on_create_; | 210 int times_to_lose_on_create_; |
| 126 int times_to_lose_during_commit_; | 211 int times_to_lose_during_commit_; |
| 127 int times_to_lose_during_draw_; | 212 int times_to_lose_during_draw_; |
| 128 int times_to_fail_reinitialize_; | 213 int times_to_fail_reinitialize_; |
| 129 int times_to_fail_recreate_; | 214 int times_to_fail_recreate_; |
| 130 int times_to_lose_on_recreate_; | 215 int times_to_lose_on_recreate_; |
| 216 int times_to_fail_create_offscreen_; |
| 217 int times_to_lose_on_create_offscreen_; |
| 218 int times_to_fail_recreate_offscreen_; |
| 219 int times_to_lose_on_recreate_offscreen_; |
| 220 int times_to_expect_recreate_retried_; |
| 221 int times_recreate_retried_; |
| 222 |
| 223 scoped_ptr<WebKit::WebGraphicsContext3D> offscreen_context3d_; |
| 224 skia::RefPtr<GrContext> offscreen_gr_context_; |
| 131 }; | 225 }; |
| 132 | 226 |
| 133 class LayerTreeHostContextTestLostContextSucceeds : | 227 class LayerTreeHostContextTestLostContextSucceeds : |
| 134 public LayerTreeHostContextTest { | 228 public LayerTreeHostContextTest { |
| 135 public: | 229 public: |
| 136 LayerTreeHostContextTestLostContextSucceeds() | 230 LayerTreeHostContextTestLostContextSucceeds() |
| 137 : LayerTreeHostContextTest(), | 231 : LayerTreeHostContextTest(), |
| 138 test_case_(0), | 232 test_case_(0), |
| 139 num_losses_(0), | 233 num_losses_(0), |
| 140 recovered_context_(true) { | 234 recovered_context_(true) { |
| 141 } | 235 } |
| 142 | 236 |
| 143 virtual void beginTest() OVERRIDE { | 237 virtual void beginTest() OVERRIDE { |
| 144 postSetNeedsCommitToMainThread(); | 238 postSetNeedsCommitToMainThread(); |
| 145 } | 239 } |
| 146 | 240 |
| 147 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { | 241 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { |
| 148 EXPECT_TRUE(succeeded); | 242 EXPECT_TRUE(succeeded); |
| 149 ++num_losses_; | 243 ++num_losses_; |
| 150 recovered_context_ = true; | 244 recovered_context_ = true; |
| 151 } | 245 } |
| 152 | 246 |
| 153 virtual void afterTest() OVERRIDE { | 247 virtual void afterTest() OVERRIDE { |
| 154 EXPECT_EQ(8, test_case_); | 248 LayerTreeHostContextTest::afterTest(); |
| 155 EXPECT_EQ(6 + 10 + 10, num_losses_); | 249 EXPECT_EQ(12, test_case_); |
| 250 EXPECT_EQ(10 + 10 + 10, num_losses_); |
| 156 } | 251 } |
| 157 | 252 |
| 158 virtual void didCommitAndDrawFrame() OVERRIDE { | 253 virtual void didCommitAndDrawFrame() OVERRIDE { |
| 159 // If the last frame had a context loss, then we'll commit again to | 254 // If the last frame had a context loss, then we'll commit again to |
| 160 // recover. | 255 // recover. |
| 161 if (!recovered_context_) | 256 if (!recovered_context_) |
| 162 return; | 257 return; |
| 163 if (times_to_lose_during_commit_) | 258 if (times_to_lose_during_commit_) |
| 164 return; | 259 return; |
| 165 if (times_to_lose_during_draw_) | 260 if (times_to_lose_during_draw_) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 178 | 273 |
| 179 bool NextTestCase() { | 274 bool NextTestCase() { |
| 180 static const TestCase kTests[] = { | 275 static const TestCase kTests[] = { |
| 181 // Losing the context and failing to recreate it (or losing it again | 276 // Losing the context and failing to recreate it (or losing it again |
| 182 // immediately) a small number of times should succeed. | 277 // immediately) a small number of times should succeed. |
| 183 { 1, // times_to_lose_during_commit | 278 { 1, // times_to_lose_during_commit |
| 184 0, // times_to_lose_during_draw | 279 0, // times_to_lose_during_draw |
| 185 3, // times_to_fail_reinitialize | 280 3, // times_to_fail_reinitialize |
| 186 0, // times_to_fail_recreate | 281 0, // times_to_fail_recreate |
| 187 0, // times_to_lose_on_recreate | 282 0, // times_to_lose_on_recreate |
| 283 0, // times_to_fail_recreate_offscreen; |
| 284 0, // times_to_lose_on_recreate_offscreen; |
| 188 }, | 285 }, |
| 189 { 0, // times_to_lose_during_commit | 286 { 0, // times_to_lose_during_commit |
| 190 1, // times_to_lose_during_draw | 287 1, // times_to_lose_during_draw |
| 191 3, // times_to_fail_reinitialize | 288 3, // times_to_fail_reinitialize |
| 192 0, // times_to_fail_recreate | 289 0, // times_to_fail_recreate |
| 193 0, // times_to_lose_on_recreate | 290 0, // times_to_lose_on_recreate |
| 291 0, // times_to_fail_recreate_offscreen; |
| 292 0, // times_to_lose_on_recreate_offscreen; |
| 194 }, | 293 }, |
| 195 { 1, // times_to_lose_during_commit | 294 { 1, // times_to_lose_during_commit |
| 196 0, // times_to_lose_during_draw | 295 0, // times_to_lose_during_draw |
| 197 0, // times_to_fail_reinitialize | 296 0, // times_to_fail_reinitialize |
| 198 3, // times_to_fail_recreate | 297 3, // times_to_fail_recreate |
| 199 0, // times_to_lose_on_recreate | 298 0, // times_to_lose_on_recreate |
| 299 0, // times_to_fail_recreate_offscreen; |
| 300 0, // times_to_lose_on_recreate_offscreen; |
| 200 }, | 301 }, |
| 201 { 0, // times_to_lose_during_commit | 302 { 0, // times_to_lose_during_commit |
| 202 1, // times_to_lose_during_draw | 303 1, // times_to_lose_during_draw |
| 203 0, // times_to_fail_reinitialize | 304 0, // times_to_fail_reinitialize |
| 204 3, // times_to_fail_recreate | 305 3, // times_to_fail_recreate |
| 205 0, // times_to_lose_on_recreate | 306 0, // times_to_lose_on_recreate |
| 307 0, // times_to_fail_recreate_offscreen; |
| 308 0, // times_to_lose_on_recreate_offscreen; |
| 206 }, | 309 }, |
| 207 { 1, // times_to_lose_during_commit | 310 { 1, // times_to_lose_during_commit |
| 208 0, // times_to_lose_during_draw | 311 0, // times_to_lose_during_draw |
| 209 0, // times_to_fail_reinitialize | 312 0, // times_to_fail_reinitialize |
| 210 0, // times_to_fail_recreate | 313 0, // times_to_fail_recreate |
| 211 3, // times_to_lose_on_recreate | 314 3, // times_to_lose_on_recreate |
| 315 0, // times_to_fail_recreate_offscreen; |
| 316 0, // times_to_lose_on_recreate_offscreen; |
| 212 }, | 317 }, |
| 213 { 0, // times_to_lose_during_commit | 318 { 0, // times_to_lose_during_commit |
| 214 1, // times_to_lose_during_draw | 319 1, // times_to_lose_during_draw |
| 215 0, // times_to_fail_reinitialize | 320 0, // times_to_fail_reinitialize |
| 216 0, // times_to_fail_recreate | 321 0, // times_to_fail_recreate |
| 217 3, // times_to_lose_on_recreate | 322 3, // times_to_lose_on_recreate |
| 323 0, // times_to_fail_recreate_offscreen; |
| 324 0, // times_to_lose_on_recreate_offscreen; |
| 325 }, |
| 326 { 1, // times_to_lose_during_commit |
| 327 0, // times_to_lose_during_draw |
| 328 0, // times_to_fail_reinitialize |
| 329 0, // times_to_fail_recreate |
| 330 0, // times_to_lose_on_recreate |
| 331 3, // times_to_fail_recreate_offscreen; |
| 332 0, // times_to_lose_on_recreate_offscreen; |
| 333 }, |
| 334 { 0, // times_to_lose_during_commit |
| 335 1, // times_to_lose_during_draw |
| 336 0, // times_to_fail_reinitialize |
| 337 0, // times_to_fail_recreate |
| 338 0, // times_to_lose_on_recreate |
| 339 3, // times_to_fail_recreate_offscreen; |
| 340 0, // times_to_lose_on_recreate_offscreen; |
| 341 }, |
| 342 { 1, // times_to_lose_during_commit |
| 343 0, // times_to_lose_during_draw |
| 344 0, // times_to_fail_reinitialize |
| 345 0, // times_to_fail_recreate |
| 346 0, // times_to_lose_on_recreate |
| 347 3, // times_to_fail_recreate_offscreen; |
| 348 0, // times_to_lose_on_recreate_offscreen; |
| 349 }, |
| 350 { 0, // times_to_lose_during_commit |
| 351 1, // times_to_lose_during_draw |
| 352 0, // times_to_fail_reinitialize |
| 353 0, // times_to_fail_recreate |
| 354 0, // times_to_lose_on_recreate |
| 355 0, // times_to_fail_recreate_offscreen; |
| 356 3, // times_to_lose_on_recreate_offscreen; |
| 218 }, | 357 }, |
| 219 // Losing the context and recreating it any number of times should | 358 // Losing the context and recreating it any number of times should |
| 220 // succeed. | 359 // succeed. |
| 221 { 10, // times_to_lose_during_commit | 360 { 10, // times_to_lose_during_commit |
| 222 0, // times_to_lose_during_draw | 361 0, // times_to_lose_during_draw |
| 223 0, // times_to_fail_reinitialize | 362 0, // times_to_fail_reinitialize |
| 224 0, // times_to_fail_recreate | 363 0, // times_to_fail_recreate |
| 225 0, // times_to_lose_on_recreate | 364 0, // times_to_lose_on_recreate |
| 365 0, // times_to_fail_recreate_offscreen; |
| 366 0, // times_to_lose_on_recreate_offscreen; |
| 226 }, | 367 }, |
| 227 { 0, // times_to_lose_during_commit | 368 { 0, // times_to_lose_during_commit |
| 228 10, // times_to_lose_during_draw | 369 10, // times_to_lose_during_draw |
| 229 0, // times_to_fail_reinitialize | 370 0, // times_to_fail_reinitialize |
| 230 0, // times_to_fail_recreate | 371 0, // times_to_fail_recreate |
| 231 0, // times_to_lose_on_recreate | 372 0, // times_to_lose_on_recreate |
| 373 0, // times_to_fail_recreate_offscreen; |
| 374 0, // times_to_lose_on_recreate_offscreen; |
| 232 }, | 375 }, |
| 233 }; | 376 }; |
| 234 | 377 |
| 235 if (test_case_ >= arraysize(kTests)) | 378 if (test_case_ >= arraysize(kTests)) |
| 236 return false; | 379 return false; |
| 237 | 380 |
| 238 times_to_lose_during_commit_ = | 381 times_to_lose_during_commit_ = |
| 239 kTests[test_case_].times_to_lose_during_commit; | 382 kTests[test_case_].times_to_lose_during_commit; |
| 240 times_to_lose_during_draw_ = | 383 times_to_lose_during_draw_ = |
| 241 kTests[test_case_].times_to_lose_during_draw; | 384 kTests[test_case_].times_to_lose_during_draw; |
| 242 times_to_fail_reinitialize_ = kTests[test_case_].times_to_fail_reinitialize; | 385 times_to_fail_reinitialize_ = kTests[test_case_].times_to_fail_reinitialize; |
| 243 times_to_fail_recreate_ = kTests[test_case_].times_to_fail_recreate; | 386 times_to_fail_recreate_ = kTests[test_case_].times_to_fail_recreate; |
| 244 times_to_lose_on_recreate_ = kTests[test_case_].times_to_lose_on_recreate; | 387 times_to_lose_on_recreate_ = kTests[test_case_].times_to_lose_on_recreate; |
| 388 times_to_fail_recreate_offscreen_ = kTests[test_case_].times_to_fail_recreat
e_offscreen; |
| 389 times_to_lose_on_recreate_offscreen_ = kTests[test_case_].times_to_lose_on_r
ecreate_offscreen; |
| 245 ++test_case_; | 390 ++test_case_; |
| 246 return true; | 391 return true; |
| 247 } | 392 } |
| 248 | 393 |
| 249 struct TestCase { | 394 struct TestCase { |
| 250 int times_to_lose_during_commit; | 395 int times_to_lose_during_commit; |
| 251 int times_to_lose_during_draw; | 396 int times_to_lose_during_draw; |
| 252 int times_to_fail_reinitialize; | 397 int times_to_fail_reinitialize; |
| 253 int times_to_fail_recreate; | 398 int times_to_fail_recreate; |
| 254 int times_to_lose_on_recreate; | 399 int times_to_lose_on_recreate; |
| 400 int times_to_fail_recreate_offscreen; |
| 401 int times_to_lose_on_recreate_offscreen; |
| 255 }; | 402 }; |
| 256 | 403 |
| 257 private: | 404 private: |
| 258 size_t test_case_; | 405 size_t test_case_; |
| 259 int num_losses_; | 406 int num_losses_; |
| 260 bool recovered_context_; | 407 bool recovered_context_; |
| 261 }; | 408 }; |
| 262 | 409 |
| 263 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLostContextSucceeds) | 410 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLostContextSucceeds) |
| 264 | 411 |
| 265 class LayerTreeHostContextTestLostContextSucceedsWithContent : | 412 class LayerTreeHostContextTestLostContextSucceedsWithContent : |
| 266 public LayerTreeHostContextTestLostContextSucceeds { | 413 public LayerTreeHostContextTestLostContextSucceeds { |
| 267 public: | 414 public: |
| 268 | 415 |
| 269 LayerTreeHostContextTestLostContextSucceedsWithContent() | 416 LayerTreeHostContextTestLostContextSucceedsWithContent() |
| 270 : LayerTreeHostContextTestLostContextSucceeds() { | 417 : LayerTreeHostContextTestLostContextSucceeds() { |
| 271 } | 418 } |
| 272 | 419 |
| 273 virtual void setupTree() OVERRIDE { | 420 virtual void setupTree() OVERRIDE { |
| 274 root_ = Layer::create(); | 421 root_ = Layer::create(); |
| 275 root_->setBounds(gfx::Size(10, 10)); | 422 root_->setBounds(gfx::Size(10, 10)); |
| 276 root_->setAnchorPoint(gfx::PointF()); | 423 root_->setAnchorPoint(gfx::PointF()); |
| 277 root_->setIsDrawable(true); | 424 root_->setIsDrawable(true); |
| 278 | 425 |
| 279 content_ = FakeContentLayer::Create(&client_); | 426 content_ = FakeContentLayer::Create(&client_); |
| 280 content_->setBounds(gfx::Size(10, 10)); | 427 content_->setBounds(gfx::Size(10, 10)); |
| 281 content_->setAnchorPoint(gfx::PointF()); | 428 content_->setAnchorPoint(gfx::PointF()); |
| 282 content_->setIsDrawable(true); | 429 content_->setIsDrawable(true); |
| 283 if (use_surface_) { | 430 if (use_surface_) { |
| 284 // TODO(danakj): Give the surface a filter to test more code when we can | |
| 285 // do so without crashing in the shared context creation. | |
| 286 content_->setForceRenderSurface(true); | 431 content_->setForceRenderSurface(true); |
| 432 // Filters require us to create an offscreen context. |
| 433 WebKit::WebFilterOperations filters; |
| 434 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5f)); |
| 435 content_->setFilters(filters); |
| 436 content_->setBackgroundFilters(filters); |
| 287 } | 437 } |
| 288 | 438 |
| 289 root_->addChild(content_); | 439 root_->addChild(content_); |
| 290 | 440 |
| 291 m_layerTreeHost->setRootLayer(root_); | 441 m_layerTreeHost->setRootLayer(root_); |
| 292 LayerTreeHostContextTest::setupTree(); | 442 LayerTreeHostContextTest::setupTree(); |
| 293 } | 443 } |
| 294 | 444 |
| 295 virtual void InvalidateAndSetNeedsCommit() OVERRIDE { | 445 virtual void InvalidateAndSetNeedsCommit() OVERRIDE { |
| 296 // Invalidate the render surface so we don't try to use a cached copy of the | 446 // Invalidate the render surface so we don't try to use a cached copy of the |
| 297 // surface. We want to make sure to test the drawing paths for drawing to | 447 // surface. We want to make sure to test the drawing paths for drawing to |
| 298 // a child surface. | 448 // a child surface. |
| 299 content_->setNeedsDisplay(); | 449 content_->setNeedsDisplay(); |
| 300 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); | 450 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); |
| 301 } | 451 } |
| 302 | 452 |
| 303 virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) { | 453 virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) { |
| 304 FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( | 454 FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( |
| 305 host_impl->rootLayer()->children()[0]); | 455 host_impl->rootLayer()->children()[0]); |
| 306 // Even though the context was lost, we should have a resource. The | 456 // Even though the context was lost, we should have a resource. The |
| 307 // FakeWebGraphicsContext3D ensures that this resource is created with | 457 // FakeWebGraphicsContext3D ensures that this resource is created with |
| 308 // the active context. | 458 // the active context. |
| 309 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); | 459 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); |
| 460 |
| 461 if (use_surface_) |
| 462 EXPECT_TRUE(host_impl->resourceProvider()->offscreenGraphicsContext3d()); |
| 463 else |
| 464 EXPECT_FALSE(host_impl->resourceProvider()->offscreenGraphicsContext3d()); |
| 310 } | 465 } |
| 311 | 466 |
| 312 protected: | 467 protected: |
| 313 bool use_surface_; | 468 bool use_surface_; |
| 314 FakeContentLayerClient client_; | 469 FakeContentLayerClient client_; |
| 315 scoped_refptr<Layer> root_; | 470 scoped_refptr<Layer> root_; |
| 316 scoped_refptr<ContentLayer> content_; | 471 scoped_refptr<ContentLayer> content_; |
| 317 }; | 472 }; |
| 318 | 473 |
| 319 TEST_F(LayerTreeHostContextTestLostContextSucceedsWithContent, | 474 TEST_F(LayerTreeHostContextTestLostContextSucceedsWithContent, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 EXPECT_TRUE(host_impl->resourceProvider()); | 524 EXPECT_TRUE(host_impl->resourceProvider()); |
| 370 return; | 525 return; |
| 371 } | 526 } |
| 372 | 527 |
| 373 // When context recreation fails we shouldn't be left with any of them. | 528 // When context recreation fails we shouldn't be left with any of them. |
| 374 EXPECT_FALSE(host_impl->outputSurface()); | 529 EXPECT_FALSE(host_impl->outputSurface()); |
| 375 EXPECT_FALSE(host_impl->renderer()); | 530 EXPECT_FALSE(host_impl->renderer()); |
| 376 EXPECT_FALSE(host_impl->resourceProvider()); | 531 EXPECT_FALSE(host_impl->resourceProvider()); |
| 377 } | 532 } |
| 378 | 533 |
| 379 virtual void afterTest() OVERRIDE {} | |
| 380 | |
| 381 private: | 534 private: |
| 382 int num_commits_; | 535 int num_commits_; |
| 383 }; | 536 }; |
| 384 | 537 |
| 385 TEST_F(LayerTreeHostContextTestLostContextFails, FailReinitialize100_SingleThrea
d) { | 538 TEST_F(LayerTreeHostContextTestLostContextFails, FailReinitialize100_SingleThrea
d) { |
| 386 times_to_fail_reinitialize_ = 100; | 539 times_to_fail_reinitialize_ = 100; |
| 387 times_to_fail_recreate_ = 0; | 540 times_to_fail_recreate_ = 0; |
| 388 times_to_lose_on_recreate_ = 0; | 541 times_to_lose_on_recreate_ = 0; |
| 389 runTest(false); | 542 runTest(false); |
| 390 } | 543 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 times_to_lose_during_commit_ = 1; | 585 times_to_lose_during_commit_ = 1; |
| 433 times_to_fail_reinitialize_ = 10; | 586 times_to_fail_reinitialize_ = 10; |
| 434 postSetNeedsCommitToMainThread(); | 587 postSetNeedsCommitToMainThread(); |
| 435 } | 588 } |
| 436 | 589 |
| 437 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { | 590 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { |
| 438 EXPECT_FALSE(succeeded); | 591 EXPECT_FALSE(succeeded); |
| 439 m_layerTreeHost->finishAllRendering(); | 592 m_layerTreeHost->finishAllRendering(); |
| 440 endTest(); | 593 endTest(); |
| 441 } | 594 } |
| 442 | |
| 443 virtual void afterTest() OVERRIDE {} | |
| 444 }; | 595 }; |
| 445 | 596 |
| 446 SINGLE_AND_MULTI_THREAD_TEST_F( | 597 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 447 LayerTreeHostContextTestFinishAllRenderingAfterLoss) | 598 LayerTreeHostContextTestFinishAllRenderingAfterLoss) |
| 448 | 599 |
| 449 class LayerTreeHostContextTestLostContextAndEvictTextures : | 600 class LayerTreeHostContextTestLostContextAndEvictTextures : |
| 450 public LayerTreeHostContextTest { | 601 public LayerTreeHostContextTest { |
| 451 public: | 602 public: |
| 452 LayerTreeHostContextTestLostContextAndEvictTextures() | 603 LayerTreeHostContextTestLostContextAndEvictTextures() |
| 453 : LayerTreeHostContextTest(), | 604 : LayerTreeHostContextTest(), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 if (!lose_after_evict_) | 650 if (!lose_after_evict_) |
| 500 LoseContext(); | 651 LoseContext(); |
| 501 impl_host_ = impl; | 652 impl_host_ = impl; |
| 502 } | 653 } |
| 503 | 654 |
| 504 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { | 655 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { |
| 505 EXPECT_TRUE(succeeded); | 656 EXPECT_TRUE(succeeded); |
| 506 endTest(); | 657 endTest(); |
| 507 } | 658 } |
| 508 | 659 |
| 509 virtual void afterTest() OVERRIDE {} | |
| 510 | |
| 511 protected: | 660 protected: |
| 512 bool lose_after_evict_; | 661 bool lose_after_evict_; |
| 513 FakeContentLayerClient client_; | 662 FakeContentLayerClient client_; |
| 514 scoped_refptr<FakeContentLayer> layer_; | 663 scoped_refptr<FakeContentLayer> layer_; |
| 515 LayerTreeHostImpl* impl_host_; | 664 LayerTreeHostImpl* impl_host_; |
| 516 int num_commits_; | 665 int num_commits_; |
| 517 }; | 666 }; |
| 518 | 667 |
| 519 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures, | 668 TEST_F(LayerTreeHostContextTestLostContextAndEvictTextures, |
| 520 LoseAfterEvict_SingleThread) { | 669 LoseAfterEvict_SingleThread) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 729 |
| 581 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) { | 730 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) { |
| 582 endTest(); | 731 endTest(); |
| 583 } | 732 } |
| 584 | 733 |
| 585 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { | 734 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { |
| 586 EXPECT_TRUE(succeeded); | 735 EXPECT_TRUE(succeeded); |
| 587 } | 736 } |
| 588 | 737 |
| 589 virtual void afterTest() { | 738 virtual void afterTest() { |
| 739 LayerTreeHostContextTest::afterTest(); |
| 590 EXPECT_EQ(0, times_to_lose_on_end_query_); | 740 EXPECT_EQ(0, times_to_lose_on_end_query_); |
| 591 } | 741 } |
| 592 | 742 |
| 593 private: | 743 private: |
| 594 FakeContentLayerClient client_; | 744 FakeContentLayerClient client_; |
| 595 scoped_refptr<FakeContentLayer> parent_; | 745 scoped_refptr<FakeContentLayer> parent_; |
| 596 int num_children_; | 746 int num_children_; |
| 597 int times_to_lose_on_end_query_; | 747 int times_to_lose_on_end_query_; |
| 598 }; | 748 }; |
| 599 | 749 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 EXPECT_EQ(5u, root->lost_output_surface_count()); | 812 EXPECT_EQ(5u, root->lost_output_surface_count()); |
| 663 EXPECT_EQ(5u, child->lost_output_surface_count()); | 813 EXPECT_EQ(5u, child->lost_output_surface_count()); |
| 664 EXPECT_EQ(5u, grandchild->lost_output_surface_count()); | 814 EXPECT_EQ(5u, grandchild->lost_output_surface_count()); |
| 665 endTest(); | 815 endTest(); |
| 666 break; | 816 break; |
| 667 default: | 817 default: |
| 668 NOTREACHED(); | 818 NOTREACHED(); |
| 669 } | 819 } |
| 670 } | 820 } |
| 671 | 821 |
| 672 virtual void afterTest() OVERRIDE {} | |
| 673 | |
| 674 private: | 822 private: |
| 675 int num_commits_; | 823 int num_commits_; |
| 676 | 824 |
| 677 FakeContentLayerClient client_; | 825 FakeContentLayerClient client_; |
| 678 scoped_refptr<FakeContentLayer> root_; | 826 scoped_refptr<FakeContentLayer> root_; |
| 679 scoped_refptr<FakeContentLayer> child_; | 827 scoped_refptr<FakeContentLayer> child_; |
| 680 scoped_refptr<FakeContentLayer> grandchild_; | 828 scoped_refptr<FakeContentLayer> grandchild_; |
| 681 }; | 829 }; |
| 682 | 830 |
| 683 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLayersNotified) | 831 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLayersNotified) |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 } | 1011 } |
| 864 return true; | 1012 return true; |
| 865 } | 1013 } |
| 866 | 1014 |
| 867 virtual void didCommitAndDrawFrame() OVERRIDE { | 1015 virtual void didCommitAndDrawFrame() OVERRIDE { |
| 868 // End the test once we know the 3nd frame drew. | 1016 // End the test once we know the 3nd frame drew. |
| 869 if (m_layerTreeHost->commitNumber() == 4) | 1017 if (m_layerTreeHost->commitNumber() == 4) |
| 870 endTest(); | 1018 endTest(); |
| 871 } | 1019 } |
| 872 | 1020 |
| 873 virtual void afterTest() OVERRIDE {} | |
| 874 | |
| 875 private: | 1021 private: |
| 876 FakeContentLayerClient client_; | 1022 FakeContentLayerClient client_; |
| 877 | 1023 |
| 878 scoped_refptr<Layer> root_; | 1024 scoped_refptr<Layer> root_; |
| 879 scoped_refptr<DelegatedRendererLayer> delegated_; | 1025 scoped_refptr<DelegatedRendererLayer> delegated_; |
| 880 scoped_refptr<ContentLayer> content_; | 1026 scoped_refptr<ContentLayer> content_; |
| 881 scoped_refptr<TextureLayer> texture_; | 1027 scoped_refptr<TextureLayer> texture_; |
| 882 scoped_refptr<ContentLayer> mask_; | 1028 scoped_refptr<ContentLayer> mask_; |
| 883 scoped_refptr<ContentLayer> content_with_mask_; | 1029 scoped_refptr<ContentLayer> content_with_mask_; |
| 884 scoped_refptr<VideoLayer> video_color_; | 1030 scoped_refptr<VideoLayer> video_color_; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 905 LayerTreeHostContextTestFailsImmediately() | 1051 LayerTreeHostContextTestFailsImmediately() |
| 906 : LayerTreeHostContextTest() { | 1052 : LayerTreeHostContextTest() { |
| 907 } | 1053 } |
| 908 | 1054 |
| 909 virtual ~LayerTreeHostContextTestFailsImmediately() {} | 1055 virtual ~LayerTreeHostContextTestFailsImmediately() {} |
| 910 | 1056 |
| 911 virtual void beginTest() OVERRIDE { | 1057 virtual void beginTest() OVERRIDE { |
| 912 postSetNeedsCommitToMainThread(); | 1058 postSetNeedsCommitToMainThread(); |
| 913 } | 1059 } |
| 914 | 1060 |
| 915 virtual void afterTest() OVERRIDE { | |
| 916 } | |
| 917 | |
| 918 virtual scoped_ptr<FakeWebGraphicsContext3D> CreateContext3d() OVERRIDE { | 1061 virtual scoped_ptr<FakeWebGraphicsContext3D> CreateContext3d() OVERRIDE { |
| 919 scoped_ptr<FakeWebGraphicsContext3D> context = | 1062 scoped_ptr<FakeWebGraphicsContext3D> context = |
| 920 LayerTreeHostContextTest::CreateContext3d(); | 1063 LayerTreeHostContextTest::CreateContext3d(); |
| 921 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 1064 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
| 922 GL_INNOCENT_CONTEXT_RESET_ARB); | 1065 GL_INNOCENT_CONTEXT_RESET_ARB); |
| 923 return context.Pass(); | 1066 return context.Pass(); |
| 924 } | 1067 } |
| 925 | 1068 |
| 926 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { | 1069 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { |
| 927 EXPECT_FALSE(succeeded); | 1070 EXPECT_FALSE(succeeded); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 957 | 1100 |
| 958 m_layerTreeHost->setRootLayer(root); | 1101 m_layerTreeHost->setRootLayer(root); |
| 959 LayerTreeHostContextTest::setupTree(); | 1102 LayerTreeHostContextTest::setupTree(); |
| 960 } | 1103 } |
| 961 | 1104 |
| 962 virtual void beginTest() OVERRIDE { | 1105 virtual void beginTest() OVERRIDE { |
| 963 times_to_lose_during_commit_ = 1; | 1106 times_to_lose_during_commit_ = 1; |
| 964 postSetNeedsCommitToMainThread(); | 1107 postSetNeedsCommitToMainThread(); |
| 965 } | 1108 } |
| 966 | 1109 |
| 967 virtual void afterTest() OVERRIDE {} | |
| 968 | |
| 969 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { | 1110 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { |
| 970 EXPECT_TRUE(succeeded); | 1111 EXPECT_TRUE(succeeded); |
| 971 endTest(); | 1112 endTest(); |
| 972 } | 1113 } |
| 973 | 1114 |
| 974 private: | 1115 private: |
| 975 FakeContentLayerClient client_; | 1116 FakeContentLayerClient client_; |
| 976 }; | 1117 }; |
| 977 | 1118 |
| 978 MULTI_THREAD_TEST_F(LayerTreeHostContextTestImplSidePainting) | 1119 MULTI_THREAD_TEST_F(LayerTreeHostContextTestImplSidePainting) |
| 979 | 1120 |
| 980 class ScrollbarLayerLostContext : public LayerTreeHostContextTest { | 1121 class ScrollbarLayerLostContext : public LayerTreeHostContextTest { |
| 981 public: | 1122 public: |
| 982 ScrollbarLayerLostContext() : commits_(0) {} | 1123 ScrollbarLayerLostContext() : commits_(0) {} |
| 983 | 1124 |
| 984 virtual void beginTest() OVERRIDE { | 1125 virtual void beginTest() OVERRIDE { |
| 985 scoped_refptr<Layer> scroll_layer = Layer::create(); | 1126 scoped_refptr<Layer> scroll_layer = Layer::create(); |
| 986 scrollbar_layer_ = FakeScrollbarLayer::Create( | 1127 scrollbar_layer_ = FakeScrollbarLayer::Create( |
| 987 false, true, scroll_layer->id()); | 1128 false, true, scroll_layer->id()); |
| 988 scrollbar_layer_->setBounds(gfx::Size(10, 100)); | 1129 scrollbar_layer_->setBounds(gfx::Size(10, 100)); |
| 989 m_layerTreeHost->rootLayer()->addChild(scrollbar_layer_); | 1130 m_layerTreeHost->rootLayer()->addChild(scrollbar_layer_); |
| 990 m_layerTreeHost->rootLayer()->addChild(scroll_layer); | 1131 m_layerTreeHost->rootLayer()->addChild(scroll_layer); |
| 991 postSetNeedsCommitToMainThread(); | 1132 postSetNeedsCommitToMainThread(); |
| 992 } | 1133 } |
| 993 | 1134 |
| 994 virtual void afterTest() OVERRIDE { | |
| 995 } | |
| 996 | |
| 997 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { | 1135 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { |
| 998 ++commits_; | 1136 ++commits_; |
| 999 size_t upload_count = scrollbar_layer_->last_update_full_upload_size() + | 1137 size_t upload_count = scrollbar_layer_->last_update_full_upload_size() + |
| 1000 scrollbar_layer_->last_update_partial_upload_size(); | 1138 scrollbar_layer_->last_update_partial_upload_size(); |
| 1001 switch(commits_) { | 1139 switch(commits_) { |
| 1002 case 1: | 1140 case 1: |
| 1003 // First (regular) update, we should upload 2 resources (thumb, and | 1141 // First (regular) update, we should upload 2 resources (thumb, and |
| 1004 // backtrack). | 1142 // backtrack). |
| 1005 EXPECT_EQ(1, scrollbar_layer_->update_count()); | 1143 EXPECT_EQ(1, scrollbar_layer_->update_count()); |
| 1006 EXPECT_EQ(2, upload_count); | 1144 EXPECT_EQ(2, upload_count); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1020 | 1158 |
| 1021 private: | 1159 private: |
| 1022 int commits_; | 1160 int commits_; |
| 1023 scoped_refptr<FakeScrollbarLayer> scrollbar_layer_; | 1161 scoped_refptr<FakeScrollbarLayer> scrollbar_layer_; |
| 1024 }; | 1162 }; |
| 1025 | 1163 |
| 1026 SINGLE_AND_MULTI_THREAD_TEST_F(ScrollbarLayerLostContext) | 1164 SINGLE_AND_MULTI_THREAD_TEST_F(ScrollbarLayerLostContext) |
| 1027 | 1165 |
| 1028 } // namespace | 1166 } // namespace |
| 1029 } // namespace cc | 1167 } // namespace cc |
| OLD | NEW |