| 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 27 matching lines...) Expand all Loading... |
| 38 namespace cc { | 38 namespace cc { |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 // These tests deal with losing the 3d graphics context. | 41 // These tests deal with losing the 3d graphics context. |
| 42 class LayerTreeHostContextTest : public ThreadedTest { | 42 class LayerTreeHostContextTest : public ThreadedTest { |
| 43 public: | 43 public: |
| 44 LayerTreeHostContextTest() | 44 LayerTreeHostContextTest() |
| 45 : ThreadedTest(), | 45 : ThreadedTest(), |
| 46 context3d_(NULL), | 46 context3d_(NULL), |
| 47 times_to_fail_create_(0), | 47 times_to_fail_create_(0), |
| 48 times_to_create_and_lose_(0), | 48 times_to_fail_initialize_(0), |
| 49 times_to_lose_on_create_(0), |
| 49 times_to_lose_during_commit_(0), | 50 times_to_lose_during_commit_(0), |
| 50 times_to_repeat_loss_(0), | 51 times_to_lose_during_draw_(0), |
| 51 times_to_fail_recreate_(0) { | 52 times_to_fail_recreate_(0), |
| 53 times_to_fail_reinitialize_(0), |
| 54 times_to_lose_on_recreate_(0) { |
| 52 media::InitializeMediaLibraryForTesting(); | 55 media::InitializeMediaLibraryForTesting(); |
| 53 } | 56 } |
| 54 | 57 |
| 55 void LoseContext() { | 58 void LoseContext() { |
| 56 context3d_->loseContextCHROMIUM(); | 59 context3d_->loseContextCHROMIUM(); |
| 57 context3d_ = NULL; | 60 context3d_ = NULL; |
| 58 } | 61 } |
| 59 | 62 |
| 60 virtual scoped_ptr<FakeWebGraphicsContext3D> CreateContext3d() { | 63 virtual scoped_ptr<FakeWebGraphicsContext3D> CreateContext3d() { |
| 61 return FakeWebGraphicsContext3D::Create(); | 64 return FakeWebGraphicsContext3D::Create(); |
| 62 } | 65 } |
| 63 | 66 |
| 64 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE { | 67 virtual scoped_ptr<OutputSurface> createOutputSurface() OVERRIDE { |
| 65 if (times_to_fail_create_) { | 68 if (times_to_fail_create_) { |
| 66 --times_to_fail_create_; | 69 --times_to_fail_create_; |
| 67 return scoped_ptr<OutputSurface>(); | 70 return scoped_ptr<OutputSurface>(); |
| 68 } | 71 } |
| 69 | 72 |
| 70 scoped_ptr<FakeWebGraphicsContext3D> context3d = CreateContext3d(); | 73 scoped_ptr<FakeWebGraphicsContext3D> context3d = CreateContext3d(); |
| 71 context3d_ = context3d.get(); | 74 context3d_ = context3d.get(); |
| 72 | 75 |
| 73 if (times_to_create_and_lose_) { | 76 if (times_to_fail_initialize_) { |
| 74 --times_to_create_and_lose_; | 77 --times_to_fail_initialize_; |
| 75 // Make the context get lost during reinitialization. | 78 // Make the context get lost during reinitialization. |
| 76 // The number of times MakeCurrent succeeds is not important, and | 79 // The number of times MakeCurrent succeeds is not important, and |
| 77 // can be changed if needed to make this pass with future changes. | 80 // can be changed if needed to make this pass with future changes. |
| 78 context3d_->set_times_make_current_succeeds(2); | 81 context3d_->set_times_make_current_succeeds(2); |
| 82 } else if (times_to_lose_on_create_) { |
| 83 --times_to_lose_on_create_; |
| 84 LoseContext(); |
| 79 } | 85 } |
| 80 | 86 |
| 81 return FakeOutputSurface::Create3d( | 87 return FakeOutputSurface::Create3d( |
| 82 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); | 88 context3d.PassAs<WebGraphicsContext3D>()).PassAs<OutputSurface>(); |
| 83 } | 89 } |
| 84 | 90 |
| 91 virtual bool prepareToDrawOnThread( |
| 92 LayerTreeHostImpl*, LayerTreeHostImpl::FrameData&, bool result) |
| 93 OVERRIDE { |
| 94 EXPECT_TRUE(result); |
| 95 if (!times_to_lose_during_draw_) |
| 96 return result; |
| 97 |
| 98 --times_to_lose_during_draw_; |
| 99 if (context3d_) |
| 100 context3d_->set_times_make_current_succeeds(0); |
| 101 return result; |
| 102 } |
| 103 |
| 85 virtual void commitCompleteOnThread(LayerTreeHostImpl *host_impl) OVERRIDE { | 104 virtual void commitCompleteOnThread(LayerTreeHostImpl *host_impl) OVERRIDE { |
| 86 if (!times_to_lose_during_commit_) | 105 if (!times_to_lose_during_commit_) |
| 87 return; | 106 return; |
| 88 --times_to_lose_during_commit_; | 107 --times_to_lose_during_commit_; |
| 89 LoseContext(); | 108 LoseContext(); |
| 90 | 109 |
| 91 times_to_create_and_lose_ = times_to_repeat_loss_; | |
| 92 times_to_repeat_loss_ = 0; | |
| 93 times_to_fail_create_ = times_to_fail_recreate_; | 110 times_to_fail_create_ = times_to_fail_recreate_; |
| 94 times_to_fail_recreate_ = 0; | 111 times_to_fail_recreate_ = 0; |
| 112 times_to_fail_initialize_ = times_to_fail_reinitialize_; |
| 113 times_to_fail_reinitialize_ = 0; |
| 114 times_to_lose_on_create_ = times_to_lose_on_recreate_; |
| 115 times_to_lose_on_recreate_ = 0; |
| 95 } | 116 } |
| 96 | 117 |
| 97 protected: | 118 protected: |
| 98 FakeWebGraphicsContext3D* context3d_; | 119 FakeWebGraphicsContext3D* context3d_; |
| 99 int times_to_fail_create_; | 120 int times_to_fail_create_; |
| 100 int times_to_create_and_lose_; | 121 int times_to_fail_initialize_; |
| 122 int times_to_lose_on_create_; |
| 101 int times_to_lose_during_commit_; | 123 int times_to_lose_during_commit_; |
| 102 int times_to_repeat_loss_; | 124 int times_to_lose_during_draw_; |
| 125 int times_to_fail_reinitialize_; |
| 103 int times_to_fail_recreate_; | 126 int times_to_fail_recreate_; |
| 127 int times_to_lose_on_recreate_; |
| 104 }; | 128 }; |
| 105 | 129 |
| 106 class LayerTreeHostContextTestLostContextSucceeds : | 130 class LayerTreeHostContextTestLostContextSucceeds : |
| 107 public LayerTreeHostContextTest { | 131 public LayerTreeHostContextTest { |
| 108 public: | 132 public: |
| 109 LayerTreeHostContextTestLostContextSucceeds() | 133 LayerTreeHostContextTestLostContextSucceeds() |
| 110 : LayerTreeHostContextTest(), | 134 : LayerTreeHostContextTest(), |
| 111 test_case_(0), | 135 test_case_(0), |
| 112 num_losses_(0) { | 136 num_losses_(0), |
| 137 recovered_context_(true) { |
| 113 } | 138 } |
| 114 | 139 |
| 115 virtual void beginTest() OVERRIDE { | 140 virtual void beginTest() OVERRIDE { |
| 116 postSetNeedsCommitToMainThread(); | 141 postSetNeedsCommitToMainThread(); |
| 117 } | 142 } |
| 118 | 143 |
| 119 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { | 144 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { |
| 120 EXPECT_TRUE(succeeded); | 145 EXPECT_TRUE(succeeded); |
| 121 ++num_losses_; | 146 ++num_losses_; |
| 147 recovered_context_ = true; |
| 122 } | 148 } |
| 123 | 149 |
| 124 virtual void afterTest() OVERRIDE { | 150 virtual void afterTest() OVERRIDE { |
| 125 EXPECT_EQ(3, test_case_); | 151 EXPECT_EQ(8, test_case_); |
| 126 EXPECT_EQ(3, num_losses_); | 152 EXPECT_EQ(6 + 10 + 10, num_losses_); |
| 127 } | |
| 128 | |
| 129 bool SourceFrameHasContextLoss(int source_frame) const { | |
| 130 return source_frame % 2 == 1; | |
| 131 } | 153 } |
| 132 | 154 |
| 133 virtual void didCommitAndDrawFrame() OVERRIDE { | 155 virtual void didCommitAndDrawFrame() OVERRIDE { |
| 134 // If the last frame had a context loss, then we'll commit again to | 156 // If the last frame had a context loss, then we'll commit again to |
| 135 // recover. | 157 // recover. |
| 136 if (SourceFrameHasContextLoss(m_layerTreeHost->commitNumber()) - 1) | 158 if (!recovered_context_) |
| 159 return; |
| 160 if (times_to_lose_during_commit_) |
| 161 return; |
| 162 if (times_to_lose_during_draw_) |
| 137 return; | 163 return; |
| 138 | 164 |
| 165 recovered_context_ = false; |
| 139 if (NextTestCase()) | 166 if (NextTestCase()) |
| 140 m_layerTreeHost->setNeedsCommit(); | 167 InvalidateAndSetNeedsCommit(); |
| 141 else | 168 else |
| 142 endTest(); | 169 endTest(); |
| 143 } | 170 } |
| 144 | 171 |
| 172 virtual void InvalidateAndSetNeedsCommit() { |
| 173 m_layerTreeHost->setNeedsCommit(); |
| 174 } |
| 175 |
| 145 bool NextTestCase() { | 176 bool NextTestCase() { |
| 146 static const TestCase kTests[] = { | 177 static const TestCase kTests[] = { |
| 147 // Losing the context and failing to recreate it (or losing it again | 178 // Losing the context and failing to recreate it (or losing it again |
| 148 // immediately) a small number of times should succeed. | 179 // immediately) a small number of times should succeed. |
| 149 { 1, // times_to_lose_during_commit | 180 { 1, // times_to_lose_during_commit |
| 150 0, // times_to_repeat_loss | 181 0, // times_to_lose_during_draw |
| 182 3, // times_to_fail_reinitialize |
| 151 0, // times_to_fail_recreate | 183 0, // times_to_fail_recreate |
| 184 0, // times_to_lose_on_recreate |
| 152 }, | 185 }, |
| 153 { 1, | 186 { 0, // times_to_lose_during_commit |
| 154 3, // times_to_repeat_loss | 187 1, // times_to_lose_during_draw |
| 188 3, // times_to_fail_reinitialize |
| 155 0, // times_to_fail_recreate | 189 0, // times_to_fail_recreate |
| 190 0, // times_to_lose_on_recreate |
| 156 }, | 191 }, |
| 157 { 1, | 192 { 1, // times_to_lose_during_commit |
| 158 0, // times_to_repeat_loss | 193 0, // times_to_lose_during_draw |
| 194 0, // times_to_fail_reinitialize |
| 159 3, // times_to_fail_recreate | 195 3, // times_to_fail_recreate |
| 196 0, // times_to_lose_on_recreate |
| 197 }, |
| 198 { 0, // times_to_lose_during_commit |
| 199 1, // times_to_lose_during_draw |
| 200 0, // times_to_fail_reinitialize |
| 201 3, // times_to_fail_recreate |
| 202 0, // times_to_lose_on_recreate |
| 203 }, |
| 204 { 1, // times_to_lose_during_commit |
| 205 0, // times_to_lose_during_draw |
| 206 0, // times_to_fail_reinitialize |
| 207 0, // times_to_fail_recreate |
| 208 3, // times_to_lose_on_recreate |
| 209 }, |
| 210 { 0, // times_to_lose_during_commit |
| 211 1, // times_to_lose_during_draw |
| 212 0, // times_to_fail_reinitialize |
| 213 0, // times_to_fail_recreate |
| 214 3, // times_to_lose_on_recreate |
| 215 }, |
| 216 // Losing the context and recreating it any number of times should |
| 217 // succeed. |
| 218 { 10, // times_to_lose_during_commit |
| 219 0, // times_to_lose_during_draw |
| 220 0, // times_to_fail_reinitialize |
| 221 0, // times_to_fail_recreate |
| 222 0, // times_to_lose_on_recreate |
| 223 }, |
| 224 { 0, // times_to_lose_during_commit |
| 225 10, // times_to_lose_during_draw |
| 226 0, // times_to_fail_reinitialize |
| 227 0, // times_to_fail_recreate |
| 228 0, // times_to_lose_on_recreate |
| 160 }, | 229 }, |
| 161 }; | 230 }; |
| 162 | 231 |
| 163 if (test_case_ >= arraysize(kTests)) | 232 if (test_case_ >= arraysize(kTests)) |
| 164 return false; | 233 return false; |
| 165 | 234 |
| 166 times_to_lose_during_commit_ = | 235 times_to_lose_during_commit_ = |
| 167 kTests[test_case_].times_to_lose_during_commit; | 236 kTests[test_case_].times_to_lose_during_commit; |
| 168 times_to_repeat_loss_ = kTests[test_case_].times_to_repeat_loss; | 237 times_to_lose_during_draw_ = |
| 238 kTests[test_case_].times_to_lose_during_draw; |
| 239 times_to_fail_reinitialize_ = kTests[test_case_].times_to_fail_reinitialize; |
| 169 times_to_fail_recreate_ = kTests[test_case_].times_to_fail_recreate; | 240 times_to_fail_recreate_ = kTests[test_case_].times_to_fail_recreate; |
| 241 times_to_lose_on_recreate_ = kTests[test_case_].times_to_lose_on_recreate; |
| 170 ++test_case_; | 242 ++test_case_; |
| 171 return true; | 243 return true; |
| 172 } | 244 } |
| 173 | 245 |
| 174 struct TestCase { | 246 struct TestCase { |
| 175 int times_to_lose_during_commit; | 247 int times_to_lose_during_commit; |
| 176 int times_to_repeat_loss; | 248 int times_to_lose_during_draw; |
| 249 int times_to_fail_reinitialize; |
| 177 int times_to_fail_recreate; | 250 int times_to_fail_recreate; |
| 251 int times_to_lose_on_recreate; |
| 178 }; | 252 }; |
| 179 | 253 |
| 180 private: | 254 private: |
| 181 size_t test_case_; | 255 size_t test_case_; |
| 182 int num_losses_; | 256 int num_losses_; |
| 257 bool recovered_context_; |
| 183 }; | 258 }; |
| 184 | 259 |
| 185 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLostContextSucceeds) | 260 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostContextTestLostContextSucceeds) |
| 186 | 261 |
| 187 class LayerTreeHostContextTestLostContextSucceedsWithContent : | 262 class LayerTreeHostContextTestLostContextSucceedsWithContent : |
| 188 public LayerTreeHostContextTestLostContextSucceeds { | 263 public LayerTreeHostContextTestLostContextSucceeds { |
| 189 public: | 264 public: |
| 190 | 265 |
| 191 LayerTreeHostContextTestLostContextSucceedsWithContent() | 266 LayerTreeHostContextTestLostContextSucceedsWithContent() |
| 192 : LayerTreeHostContextTestLostContextSucceeds() { | 267 : LayerTreeHostContextTestLostContextSucceeds() { |
| 193 } | 268 } |
| 194 | 269 |
| 195 virtual void setupTree() OVERRIDE { | 270 virtual void setupTree() OVERRIDE { |
| 196 scoped_refptr<Layer> root_ = Layer::create(); | 271 root_ = Layer::create(); |
| 197 root_->setBounds(gfx::Size(10, 10)); | 272 root_->setBounds(gfx::Size(10, 10)); |
| 198 root_->setAnchorPoint(gfx::PointF()); | 273 root_->setAnchorPoint(gfx::PointF()); |
| 199 root_->setIsDrawable(true); | 274 root_->setIsDrawable(true); |
| 200 | 275 |
| 201 scoped_refptr<FakeContentLayer> content_ = | 276 content_ = FakeContentLayer::Create(&client_); |
| 202 FakeContentLayer::Create(&client_); | |
| 203 content_->setBounds(gfx::Size(10, 10)); | 277 content_->setBounds(gfx::Size(10, 10)); |
| 204 content_->setAnchorPoint(gfx::PointF()); | 278 content_->setAnchorPoint(gfx::PointF()); |
| 205 content_->setIsDrawable(true); | 279 content_->setIsDrawable(true); |
| 206 if (use_surface_) | 280 if (use_surface_) { |
| 281 // TODO(danakj): Give the surface a filter to test more code when we can |
| 282 // do so without crashing in the shared context creation. |
| 207 content_->setForceRenderSurface(true); | 283 content_->setForceRenderSurface(true); |
| 284 } |
| 285 |
| 208 root_->addChild(content_); | 286 root_->addChild(content_); |
| 209 | 287 |
| 210 m_layerTreeHost->setRootLayer(root_); | 288 m_layerTreeHost->setRootLayer(root_); |
| 211 LayerTreeHostContextTest::setupTree(); | 289 LayerTreeHostContextTest::setupTree(); |
| 212 } | 290 } |
| 213 | 291 |
| 292 virtual void InvalidateAndSetNeedsCommit() OVERRIDE { |
| 293 // Invalidate the render surface so we don't try to use a cached copy of the |
| 294 // surface. We want to make sure to test the drawing paths for drawing to |
| 295 // a child surface. |
| 296 content_->setNeedsDisplay(); |
| 297 LayerTreeHostContextTestLostContextSucceeds::InvalidateAndSetNeedsCommit(); |
| 298 } |
| 299 |
| 214 virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) { | 300 virtual void drawLayersOnThread(LayerTreeHostImpl* host_impl) { |
| 215 FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( | 301 FakeContentLayerImpl* content_impl = static_cast<FakeContentLayerImpl*>( |
| 216 host_impl->rootLayer()->children()[0]); | 302 host_impl->rootLayer()->children()[0]); |
| 217 // Even though the context was lost, we should have a resource. The | 303 // Even though the context was lost, we should have a resource. The |
| 218 // FakeWebGraphicsContext3D ensures that this resource is created with | 304 // FakeWebGraphicsContext3D ensures that this resource is created with |
| 219 // the active context. | 305 // the active context. |
| 220 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); | 306 EXPECT_TRUE(content_impl->HaveResourceForTileAt(0, 0)); |
| 221 } | 307 } |
| 222 | 308 |
| 223 protected: | 309 protected: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 EXPECT_FALSE(host_impl->renderer()); | 372 EXPECT_FALSE(host_impl->renderer()); |
| 287 EXPECT_FALSE(host_impl->resourceProvider()); | 373 EXPECT_FALSE(host_impl->resourceProvider()); |
| 288 } | 374 } |
| 289 | 375 |
| 290 virtual void afterTest() OVERRIDE {} | 376 virtual void afterTest() OVERRIDE {} |
| 291 | 377 |
| 292 private: | 378 private: |
| 293 int num_commits_; | 379 int num_commits_; |
| 294 }; | 380 }; |
| 295 | 381 |
| 296 TEST_F(LayerTreeHostContextTestLostContextFails, RepeatLoss100_SingleThread) { | 382 TEST_F(LayerTreeHostContextTestLostContextFails, FailReinitialize100_SingleThrea
d) { |
| 297 times_to_repeat_loss_ = 100; | 383 times_to_fail_reinitialize_ = 100; |
| 298 times_to_fail_recreate_ = 0; | 384 times_to_fail_recreate_ = 0; |
| 385 times_to_lose_on_recreate_ = 0; |
| 299 runTest(false); | 386 runTest(false); |
| 300 } | 387 } |
| 301 | 388 |
| 302 TEST_F(LayerTreeHostContextTestLostContextFails, RepeatLoss100_MultiThread) { | 389 TEST_F(LayerTreeHostContextTestLostContextFails, FailReinitialize100_MultiThread
) { |
| 303 times_to_repeat_loss_ = 100; | 390 times_to_fail_reinitialize_ = 100; |
| 304 times_to_fail_recreate_ = 0; | 391 times_to_fail_recreate_ = 0; |
| 392 times_to_lose_on_recreate_ = 0; |
| 305 runTest(true); | 393 runTest(true); |
| 306 } | 394 } |
| 307 | 395 |
| 308 TEST_F(LayerTreeHostContextTestLostContextFails, FailRecreate100_SingleThread) { | 396 TEST_F(LayerTreeHostContextTestLostContextFails, FailRecreate100_SingleThread) { |
| 309 times_to_repeat_loss_ = 0; | 397 times_to_fail_reinitialize_ = 0; |
| 310 times_to_fail_recreate_ = 100; | 398 times_to_fail_recreate_ = 100; |
| 399 times_to_lose_on_recreate_ = 0; |
| 311 runTest(false); | 400 runTest(false); |
| 312 } | 401 } |
| 313 | 402 |
| 314 TEST_F(LayerTreeHostContextTestLostContextFails, FailRecreate100_MultiThread) { | 403 TEST_F(LayerTreeHostContextTestLostContextFails, FailRecreate100_MultiThread) { |
| 315 times_to_repeat_loss_ = 0; | 404 times_to_fail_reinitialize_ = 0; |
| 316 times_to_fail_recreate_ = 100; | 405 times_to_fail_recreate_ = 100; |
| 406 times_to_lose_on_recreate_ = 0; |
| 317 runTest(true); | 407 runTest(true); |
| 318 } | 408 } |
| 319 | 409 |
| 410 TEST_F(LayerTreeHostContextTestLostContextFails, LoseOnRecreate100_SingleThread)
{ |
| 411 times_to_fail_reinitialize_ = 0; |
| 412 times_to_fail_recreate_ = 0; |
| 413 times_to_lose_on_recreate_ = 100; |
| 414 runTest(false); |
| 415 } |
| 416 |
| 417 TEST_F(LayerTreeHostContextTestLostContextFails, LoseOnRecreate100_MultiThread)
{ |
| 418 times_to_fail_reinitialize_ = 0; |
| 419 times_to_fail_recreate_ = 0; |
| 420 times_to_lose_on_recreate_ = 100; |
| 421 runTest(true); |
| 422 } |
| 423 |
| 320 class LayerTreeHostContextTestFinishAllRenderingAfterLoss : | 424 class LayerTreeHostContextTestFinishAllRenderingAfterLoss : |
| 321 public LayerTreeHostContextTest { | 425 public LayerTreeHostContextTest { |
| 322 public: | 426 public: |
| 323 virtual void beginTest() OVERRIDE { | 427 virtual void beginTest() OVERRIDE { |
| 324 // Lose the context until the compositor gives up on it. | 428 // Lose the context until the compositor gives up on it. |
| 325 times_to_lose_during_commit_ = 1; | 429 times_to_lose_during_commit_ = 1; |
| 326 times_to_repeat_loss_ = 10; | 430 times_to_fail_reinitialize_ = 10; |
| 327 postSetNeedsCommitToMainThread(); | 431 postSetNeedsCommitToMainThread(); |
| 328 } | 432 } |
| 329 | 433 |
| 330 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { | 434 virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { |
| 331 EXPECT_FALSE(succeeded); | 435 EXPECT_FALSE(succeeded); |
| 332 m_layerTreeHost->finishAllRendering(); | 436 m_layerTreeHost->finishAllRendering(); |
| 333 endTest(); | 437 endTest(); |
| 334 } | 438 } |
| 335 | 439 |
| 336 virtual void afterTest() OVERRIDE {} | 440 virtual void afterTest() OVERRIDE {} |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 // Lose the context and struggle to recreate it. | 638 // Lose the context and struggle to recreate it. |
| 535 LoseContext(); | 639 LoseContext(); |
| 536 times_to_fail_create_ = 1; | 640 times_to_fail_create_ = 1; |
| 537 break; | 641 break; |
| 538 case 2: | 642 case 2: |
| 539 EXPECT_EQ(1u, root->lost_output_surface_count()); | 643 EXPECT_EQ(1u, root->lost_output_surface_count()); |
| 540 EXPECT_EQ(1u, child->lost_output_surface_count()); | 644 EXPECT_EQ(1u, child->lost_output_surface_count()); |
| 541 EXPECT_EQ(1u, grandchild->lost_output_surface_count()); | 645 EXPECT_EQ(1u, grandchild->lost_output_surface_count()); |
| 542 // Lose the context and again during recreate. | 646 // Lose the context and again during recreate. |
| 543 LoseContext(); | 647 LoseContext(); |
| 544 times_to_create_and_lose_ = 1; | 648 times_to_lose_on_create_ = 1; |
| 545 break; | 649 break; |
| 546 case 3: | 650 case 3: |
| 547 EXPECT_EQ(3u, root->lost_output_surface_count()); | 651 EXPECT_EQ(3u, root->lost_output_surface_count()); |
| 548 EXPECT_EQ(3u, child->lost_output_surface_count()); | 652 EXPECT_EQ(3u, child->lost_output_surface_count()); |
| 549 EXPECT_EQ(3u, grandchild->lost_output_surface_count()); | 653 EXPECT_EQ(3u, grandchild->lost_output_surface_count()); |
| 654 // Lose the context and again during reinitialization. |
| 655 LoseContext(); |
| 656 times_to_fail_initialize_ = 1; |
| 657 break; |
| 658 case 4: |
| 659 EXPECT_EQ(5u, root->lost_output_surface_count()); |
| 660 EXPECT_EQ(5u, child->lost_output_surface_count()); |
| 661 EXPECT_EQ(5u, grandchild->lost_output_surface_count()); |
| 550 endTest(); | 662 endTest(); |
| 551 break; | 663 break; |
| 552 default: | 664 default: |
| 553 NOTREACHED(); | 665 NOTREACHED(); |
| 554 } | 666 } |
| 555 } | 667 } |
| 556 | 668 |
| 557 virtual void afterTest() OVERRIDE {} | 669 virtual void afterTest() OVERRIDE {} |
| 558 | 670 |
| 559 private: | 671 private: |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 } | 968 } |
| 857 | 969 |
| 858 private: | 970 private: |
| 859 FakeContentLayerClient client_; | 971 FakeContentLayerClient client_; |
| 860 }; | 972 }; |
| 861 | 973 |
| 862 MULTI_THREAD_TEST_F(LayerTreeHostContextTestImplSidePainting) | 974 MULTI_THREAD_TEST_F(LayerTreeHostContextTestImplSidePainting) |
| 863 | 975 |
| 864 } // namespace | 976 } // namespace |
| 865 } // namespace cc | 977 } // namespace cc |
| OLD | NEW |