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