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

Side by Side Diff: cc/resources/tile_task_worker_pool_unittest.cc

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 years, 9 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
« no previous file with comments | « cc/resources/tile.cc ('k') | cc/resources/tiling_set_raster_queue_all.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/resources/tile_task_worker_pool.h" 5 #include "cc/resources/tile_task_worker_pool.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
(...skipping 10 matching lines...) Expand all
21 #include "cc/resources/resource_provider.h" 21 #include "cc/resources/resource_provider.h"
22 #include "cc/resources/scoped_resource.h" 22 #include "cc/resources/scoped_resource.h"
23 #include "cc/resources/tile_task_runner.h" 23 #include "cc/resources/tile_task_runner.h"
24 #include "cc/resources/zero_copy_tile_task_worker_pool.h" 24 #include "cc/resources/zero_copy_tile_task_worker_pool.h"
25 #include "cc/test/fake_output_surface.h" 25 #include "cc/test/fake_output_surface.h"
26 #include "cc/test/fake_output_surface_client.h" 26 #include "cc/test/fake_output_surface_client.h"
27 #include "cc/test/fake_picture_pile_impl.h" 27 #include "cc/test/fake_picture_pile_impl.h"
28 #include "cc/test/test_gpu_memory_buffer_manager.h" 28 #include "cc/test/test_gpu_memory_buffer_manager.h"
29 #include "cc/test/test_shared_bitmap_manager.h" 29 #include "cc/test/test_shared_bitmap_manager.h"
30 #include "cc/test/test_web_graphics_context_3d.h" 30 #include "cc/test/test_web_graphics_context_3d.h"
31 #include "gpu/GLES2/gl2extchromium.h"
31 #include "testing/gtest/include/gtest/gtest.h" 32 #include "testing/gtest/include/gtest/gtest.h"
32 33
33 namespace cc { 34 namespace cc {
34 namespace { 35 namespace {
35 36
36 const size_t kMaxTransferBufferUsageBytes = 10000U; 37 const size_t kMaxTransferBufferUsageBytes = 10000U;
37 // A resource of this dimension^2 * 4 must be greater than the above transfer 38 // A resource of this dimension^2 * 4 must be greater than the above transfer
38 // buffer constant. 39 // buffer constant.
39 const size_t kLargeResourceDimension = 1000U; 40 const size_t kLargeResourceDimension = 1000U;
40 41
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 const_resource, 269 const_resource,
269 base::Bind(&TileTaskWorkerPoolTest::OnTaskCompleted, 270 base::Bind(&TileTaskWorkerPoolTest::OnTaskCompleted,
270 base::Unretained(this), base::Passed(&resource), id), 271 base::Unretained(this), base::Passed(&resource), id),
271 lock, &empty)); 272 lock, &empty));
272 } 273 }
273 274
274 const std::vector<RasterTaskResult>& completed_tasks() const { 275 const std::vector<RasterTaskResult>& completed_tasks() const {
275 return completed_tasks_; 276 return completed_tasks_;
276 } 277 }
277 278
279 void LoseContext(ContextProvider* context_provider) {
280 if (!context_provider)
281 return;
282 context_provider->ContextGL()->LoseContextCHROMIUM(
283 GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
284 context_provider->ContextGL()->Flush();
285 }
286
278 private: 287 private:
279 void Create3dOutputSurfaceAndResourceProvider() { 288 void Create3dOutputSurfaceAndResourceProvider() {
280 output_surface_ = FakeOutputSurface::Create3d( 289 output_surface_ = FakeOutputSurface::Create3d(
281 context_provider_, worker_context_provider_).Pass(); 290 context_provider_, worker_context_provider_).Pass();
282 CHECK(output_surface_->BindToClient(&output_surface_client_)); 291 CHECK(output_surface_->BindToClient(&output_surface_client_));
283 TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d(); 292 TestWebGraphicsContext3D* context3d = context_provider_->TestContext3d();
284 context3d->set_support_sync_query(true); 293 context3d->set_support_sync_query(true);
285 resource_provider_ = ResourceProvider::Create(output_surface_.get(), NULL, 294 resource_provider_ = ResourceProvider::Create(output_surface_.get(), NULL,
286 &gpu_memory_buffer_manager_, 295 &gpu_memory_buffer_manager_,
287 NULL, 0, false, 1).Pass(); 296 NULL, 0, false, 1).Pass();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 AppendTask(0u, size); 406 AppendTask(0u, size);
398 AppendTask(1u, size); 407 AppendTask(1u, size);
399 AppendTask(2u, size); 408 AppendTask(2u, size);
400 ScheduleTasks(); 409 ScheduleTasks();
401 410
402 // This will time out if a resource that is larger than the throttle limit 411 // This will time out if a resource that is larger than the throttle limit
403 // never gets scheduled. 412 // never gets scheduled.
404 RunMessageLoopUntilAllTasksHaveCompleted(); 413 RunMessageLoopUntilAllTasksHaveCompleted();
405 } 414 }
406 415
416 TEST_P(TileTaskWorkerPoolTest, LostContext) {
417 LoseContext(output_surface_->context_provider());
418 LoseContext(output_surface_->worker_context_provider());
419
420 AppendTask(0u);
421 AppendTask(1u);
422 ScheduleTasks();
423
424 RunMessageLoopUntilAllTasksHaveCompleted();
425
426 ASSERT_EQ(2u, completed_tasks().size());
427 EXPECT_FALSE(completed_tasks()[0].canceled);
428 EXPECT_FALSE(completed_tasks()[1].canceled);
429 }
430
407 INSTANTIATE_TEST_CASE_P( 431 INSTANTIATE_TEST_CASE_P(
408 TileTaskWorkerPoolTests, 432 TileTaskWorkerPoolTests,
409 TileTaskWorkerPoolTest, 433 TileTaskWorkerPoolTest,
410 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER, 434 ::testing::Values(TILE_TASK_WORKER_POOL_TYPE_PIXEL_BUFFER,
411 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY, 435 TILE_TASK_WORKER_POOL_TYPE_ZERO_COPY,
412 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY, 436 TILE_TASK_WORKER_POOL_TYPE_ONE_COPY,
413 TILE_TASK_WORKER_POOL_TYPE_GPU, 437 TILE_TASK_WORKER_POOL_TYPE_GPU,
414 TILE_TASK_WORKER_POOL_TYPE_BITMAP)); 438 TILE_TASK_WORKER_POOL_TYPE_BITMAP));
415 439
416 } // namespace 440 } // namespace
417 } // namespace cc 441 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/tile.cc ('k') | cc/resources/tiling_set_raster_queue_all.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698