Disable flaky SelectFileDialogExtensionBrowserTest tests
[chromium-blink-merge.git] / cc / test / test_context_support.cc
blobb3c45563be4e3c1c3d64113a1948cb5c70dd1473
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
3 // found in the LICENSE file.
5 #include "cc/test/test_context_support.h"
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
12 namespace cc {
14 TestContextSupport::TestContextSupport()
15 : weak_ptr_factory_(this) {
18 TestContextSupport::~TestContextSupport() {}
20 void TestContextSupport::SignalSyncPoint(uint32 sync_point,
21 const base::Closure& callback) {
22 sync_point_callbacks_.push_back(callback);
23 base::ThreadTaskRunnerHandle::Get()->PostTask(
24 FROM_HERE, base::Bind(&TestContextSupport::CallAllSyncPointCallbacks,
25 weak_ptr_factory_.GetWeakPtr()));
28 void TestContextSupport::SignalQuery(uint32 query,
29 const base::Closure& callback) {
30 sync_point_callbacks_.push_back(callback);
31 base::ThreadTaskRunnerHandle::Get()->PostTask(
32 FROM_HERE, base::Bind(&TestContextSupport::CallAllSyncPointCallbacks,
33 weak_ptr_factory_.GetWeakPtr()));
36 void TestContextSupport::SetSurfaceVisible(bool visible) {
37 if (!set_visible_callback_.is_null()) {
38 set_visible_callback_.Run(visible);
42 void TestContextSupport::CallAllSyncPointCallbacks() {
43 for (size_t i = 0; i < sync_point_callbacks_.size(); ++i) {
44 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
45 sync_point_callbacks_[i]);
47 sync_point_callbacks_.clear();
50 void TestContextSupport::SetSurfaceVisibleCallback(
51 const SurfaceVisibleCallback& set_visible_callback) {
52 set_visible_callback_ = set_visible_callback;
55 void TestContextSupport::SetScheduleOverlayPlaneCallback(
56 const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback) {
57 schedule_overlay_plane_callback_ = schedule_overlay_plane_callback;
60 void TestContextSupport::Swap() {
63 uint32 TestContextSupport::InsertFutureSyncPointCHROMIUM() {
64 NOTIMPLEMENTED();
65 return 0;
68 void TestContextSupport::RetireSyncPointCHROMIUM(uint32 sync_point) {
69 NOTIMPLEMENTED();
72 void TestContextSupport::PartialSwapBuffers(const gfx::Rect& sub_buffer) {
75 void TestContextSupport::ScheduleOverlayPlane(
76 int plane_z_order,
77 gfx::OverlayTransform plane_transform,
78 unsigned overlay_texture_id,
79 const gfx::Rect& display_bounds,
80 const gfx::RectF& uv_rect) {
81 if (!schedule_overlay_plane_callback_.is_null()) {
82 schedule_overlay_plane_callback_.Run(plane_z_order,
83 plane_transform,
84 overlay_texture_id,
85 display_bounds,
86 uv_rect);
90 } // namespace cc