summaryrefslogtreecommitdiffstats
path: root/ui/gfx/test/gfx_test_utils.cc
blob: 1d66ed77cd2ee520ebd64735d0eae5e793bfa7db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/gfx/test/gfx_test_utils.h"

#if defined(VIEWS_COMPOSITOR)
#include "base/command_line.h"
#include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/compositor/test/test_compositor.h"
#endif

#if defined(VIEWS_COMPOSITOR)
namespace switches {

const char kDisableTestCompositor[] = "disable-test-compositor";

}
#endif

namespace ui {
namespace gfx_test_utils {

void SetupTestCompositor() {
#if defined(VIEWS_COMPOSITOR)
  if (!CommandLine::ForCurrentProcess()->HasSwitch(
      switches::kDisableTestCompositor)) {
    // Use a mock compositor that noops draws.
    ui::Compositor::set_compositor_factory_for_testing(
        ui::TestCompositor::Create);
  }
#endif
}

}  // namespace gfx_test_utils
}  // namespace ui