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

Side by Side Diff: components/display_compositor/yuv_readback_unittest.cc

Issue 2798963003: Use ScopedTaskEnvironment instead of MessageLoop in components unit tests. (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/json/json_reader.h" 5 #include "base/json/json_reader.h"
6 #include "base/memory/ref_counted_memory.h" 6 #include "base/memory/ref_counted_memory.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/test/launcher/unit_test_launcher.h" 9 #include "base/test/launcher/unit_test_launcher.h"
10 #include "base/test/scoped_task_environment.h"
10 #include "base/test/test_suite.h" 11 #include "base/test/test_suite.h"
11 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
12 #include "base/trace_event/trace_event.h" 13 #include "base/trace_event/trace_event.h"
13 #include "components/display_compositor/gl_helper.h" 14 #include "components/display_compositor/gl_helper.h"
14 #include "gpu/command_buffer/client/gles2_implementation.h" 15 #include "gpu/command_buffer/client/gles2_implementation.h"
15 #include "gpu/command_buffer/client/shared_memory_limits.h" 16 #include "gpu/command_buffer/client/shared_memory_limits.h"
16 #include "gpu/ipc/common/surface_handle.h" 17 #include "gpu/ipc/common/surface_handle.h"
17 #include "gpu/ipc/gl_in_process_context.h" 18 #include "gpu/ipc/gl_in_process_context.h"
18 #include "media/base/video_frame.h" 19 #include "media/base/video_frame.h"
19 #include "media/base/video_util.h" 20 #include "media/base/video_util.h"
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 output_frame->stride(media::VideoFrame::kVPlane), 2, output_xsize / 2, 470 output_frame->stride(media::VideoFrame::kVPlane), 2, output_xsize / 2,
470 output_ysize / 2, &input_pixels, message + " V plane"); 471 output_ysize / 2, &input_pixels, message + " V plane");
471 472
472 gl_->DeleteTextures(1, &src_texture); 473 gl_->DeleteTextures(1, &src_texture);
473 } 474 }
474 475
475 std::unique_ptr<gpu::GLInProcessContext> context_; 476 std::unique_ptr<gpu::GLInProcessContext> context_;
476 gpu::gles2::GLES2Interface* gl_; 477 gpu::gles2::GLES2Interface* gl_;
477 std::unique_ptr<display_compositor::GLHelper> helper_; 478 std::unique_ptr<display_compositor::GLHelper> helper_;
478 gl::DisableNullDrawGLBindings enable_pixel_output_; 479 gl::DisableNullDrawGLBindings enable_pixel_output_;
479 base::MessageLoop message_loop_; 480 base::test::ScopedTaskEnvironment scoped_task_environment_;
480 }; 481 };
481 482
482 TEST_F(YUVReadbackTest, YUVReadbackOptTest) { 483 TEST_F(YUVReadbackTest, YUVReadbackOptTest) {
483 // This test uses the gpu.service/gpu_decoder tracing events to detect how 484 // This test uses the gpu.service/gpu_decoder tracing events to detect how
484 // many scaling passes are actually performed by the YUV readback pipeline. 485 // many scaling passes are actually performed by the YUV readback pipeline.
485 StartTracing(TRACE_DISABLED_BY_DEFAULT( 486 StartTracing(TRACE_DISABLED_BY_DEFAULT(
486 "gpu.service") "," TRACE_DISABLED_BY_DEFAULT("gpu_decoder")); 487 "gpu.service") "," TRACE_DISABLED_BY_DEFAULT("gpu_decoder"));
487 488
488 TestYUVReadback(800, 400, 800, 400, 0, 0, 1, false, true, 489 TestYUVReadback(800, 400, 800, 400, 0, 0, 1, false, true,
489 display_compositor::GLHelper::SCALER_QUALITY_FAST); 490 display_compositor::GLHelper::SCALER_QUALITY_FAST);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 INSTANTIATE_TEST_CASE_P( 550 INSTANTIATE_TEST_CASE_P(
550 , 551 ,
551 YUVReadbackPixelTest, 552 YUVReadbackPixelTest,
552 ::testing::Combine( 553 ::testing::Combine(
553 ::testing::Bool(), 554 ::testing::Bool(),
554 ::testing::Bool(), 555 ::testing::Bool(),
555 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes)), 556 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes)),
556 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes)))); 557 ::testing::Range<unsigned int>(0, arraysize(kYUVReadbackSizes))));
557 558
558 } // namespace display_compositor 559 } // namespace display_compositor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698