• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
12 namespace glbench {
13 
14 class SwapTest : public GLInterfaceTest {
15  public:
SwapTest()16   SwapTest() {}
~SwapTest()17   virtual ~SwapTest() {}
18   virtual bool TestFunc(uint64_t iterations);
Name() const19   virtual const char* Name() const { return "swap"; }
20 
21  private:
22   DISALLOW_COPY_AND_ASSIGN(SwapTest);
23 };
24 
TestFunc(uint64_t iterations)25 bool 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 
GetSwapTest()34 TestBase* GetSwapTest() {
35   return new SwapTest;
36 }
37 
38 } // namespace glbench
39