1// Copyright (c) 2010 The Chromium OS 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.
4
5#include "base/bind.h"
6#include "base/callback.h"
7
8#include "glinterface.h"
9#include "glinterfacetest.h"
10#include "main.h"
11
12namespace glbench {
13
14class SwapTest : public GLInterfaceTest {
15 public:
16  SwapTest() {}
17  virtual ~SwapTest() {}
18  virtual bool TestFunc(uint64_t iterations);
19  virtual const char* Name() const { return "swap"; }
20
21 private:
22  DISALLOW_COPY_AND_ASSIGN(SwapTest);
23};
24
25bool SwapTest::TestFunc(uint64_t iterations) {
26  for (uint64_t i = 0 ; i < iterations; ++i) {
27    if (!render_func_.is_null())
28      render_func_.Run();
29    g_main_gl_interface->SwapBuffers();
30  }
31  return true;
32}
33
34TestBase* GetSwapTest() {
35  return new SwapTest;
36}
37
38} // namespace glbench
39