diff options
Diffstat (limited to 'o3d/tests')
-rw-r--r-- | o3d/tests/build.scons | 15 | ||||
-rw-r--r-- | o3d/tests/common/cross/main.cc | 2 | ||||
-rw-r--r-- | o3d/tests/common/win/testing_common.cc | 52 | ||||
-rw-r--r-- | o3d/tests/tests.gyp | 19 |
4 files changed, 58 insertions, 30 deletions
diff --git a/o3d/tests/build.scons b/o3d/tests/build.scons index d26e4bf..7d20e6c 100644 --- a/o3d/tests/build.scons +++ b/o3d/tests/build.scons @@ -279,21 +279,6 @@ if env['TARGET_PLATFORM']=='WINDOWS': ] ) -# add command buffer renderer unit tests only on that renderer platform. -if 'RENDERER_CB' in env['CPPDEFINES']: - tests += [ - 'command_buffer/client/cross/id_allocator_test.cc', - 'command_buffer/common/cross/bitfield_helpers_test.cc', - 'command_buffer/service/cross/effect_utils_test.cc', - 'command_buffer/service/cross/resource_test.cc', - 'command_buffer/client/cross/cmd_buffer_helper_test.cc', - 'command_buffer/client/cross/fenced_allocator_test.cc', - 'command_buffer/client/cross/buffer_sync_proxy_test.cc', - 'command_buffer/service/cross/buffer_rpc_test.cc', - 'command_buffer/service/cross/cmd_buffer_engine_test.cc', - 'command_buffer/service/cross/cmd_parser_test.cc', - ] - unit_tests = env.Program('unit_tests', tests) # After building the test executable, force the windows executable to output diff --git a/o3d/tests/common/cross/main.cc b/o3d/tests/common/cross/main.cc index b8c3fc3..540107d 100644 --- a/o3d/tests/common/cross/main.cc +++ b/o3d/tests/common/cross/main.cc @@ -33,6 +33,7 @@ // defines the common main() for all unit tests #include <build/build_config.h> #include "base/at_exit.h" +#include "base/message_loop.h" #include "gtest/gtest.h" #ifdef OS_WIN @@ -41,6 +42,7 @@ int test_main(int argc, wchar_t **argv) { int test_main(int argc, char **argv) { #endif ::base::AtExitManager at_exit_manager; + MessageLoop message_loop; testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/o3d/tests/common/win/testing_common.cc b/o3d/tests/common/win/testing_common.cc index e498331..0a31823 100644 --- a/o3d/tests/common/win/testing_common.cc +++ b/o3d/tests/common/win/testing_common.cc @@ -29,7 +29,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - // Contains windows-specific code for setting up the Client object // used in the unit tests. Defines WinMain and a WindowProc for running // the GUnit tests @@ -49,6 +48,27 @@ #include "core/cross/renderer.h" #include "core/cross/renderer_platform.h" #include "core/cross/types.h" +#include "core/win/display_window_win.h" + +#if defined(RENDERER_CB) +#include "core/cross/command_buffer/renderer_cb.h" +#include "core/cross/command_buffer/display_window_cb.h" +#include "gpu_plugin/command_buffer.h" +#include "gpu_plugin/np_utils/np_browser_stub.h" +#endif + +using o3d::DisplayWindowWindows; + +#if defined(RENDERER_CB) +using o3d::DisplayWindowCB; +using o3d::gpu_plugin::CommandBuffer; +using o3d::gpu_plugin::NPObjectPointer; +using o3d::gpu_plugin::StubNPBrowser; +using o3d::RendererCBLocal; +#endif + +const int kWindowWidth = 512; +const int kWindowHeight = 512; o3d::ServiceLocator* g_service_locator = NULL; o3d::DisplayWindow* g_display_window = NULL; @@ -112,8 +132,8 @@ int WINAPI WinMain(HINSTANCE instance, WS_OVERLAPPEDWINDOW, -1000, 0, - 512, - 512, + kWindowWidth, + kWindowHeight, 0, 0, instance, @@ -153,16 +173,36 @@ int WINAPI WinMain(HINSTANCE instance, o3d::Profiler profiler(g_service_locator); o3d::Features features(g_service_locator); + // TODO(apatrick): We can have an NPBrowser in the other configurations when + // we move over to gyp. This is just to avoid having to write scons files + // for np_utils. +#if defined(RENDERER_CB) + StubNPBrowser browser; +#endif + // create a renderer device based on the current platform g_renderer = o3d::Renderer::CreateDefaultRenderer(g_service_locator); // Initialize the renderer for off-screen rendering if kOffScreenRenderer // is in the environment. bool success; - o3d::DisplayWindowWindows* display_window = - new o3d::DisplayWindowWindows(); - display_window = display_window; + +#if defined(RENDERER_CB) + const unsigned int kDefaultCommandBufferSize = 256 << 10; + + DisplayWindowCB* display_window = new o3d::DisplayWindowCB; + display_window->set_npp(NULL); + display_window->set_command_buffer(RendererCBLocal::CreateCommandBuffer( + NULL, + g_window_handle, + kDefaultCommandBufferSize)); + display_window->set_width(kWindowWidth); + display_window->set_height(kWindowHeight); +#else + DisplayWindowWindows* display_window = new o3d::DisplayWindowWindows; display_window->set_hwnd(g_window_handle); +#endif + g_display_window = display_window; bool offscreen = (::GetEnvironmentVariableW(kOffScreenRenderer, NULL, 0) != 0); diff --git a/o3d/tests/tests.gyp b/o3d/tests/tests.gyp index 92d4fbf..1aef0cc 100644 --- a/o3d/tests/tests.gyp +++ b/o3d/tests/tests.gyp @@ -102,6 +102,16 @@ ], }, ], + ['renderer == "cb"', + { + 'dependencies': [ + '../command_buffer/command_buffer.gyp:command_buffer_client_test', + '../command_buffer/command_buffer.gyp:command_buffer_common_test', + '../command_buffer/command_buffer.gyp:command_buffer_service_test', + '../gpu_plugin/gpu_plugin.gyp:np_utils', + ] + }, + ], ['OS == "mac"', { 'dependencies': [ @@ -226,15 +236,6 @@ ], }, ], - ['cb_service != "none"', - { - 'dependencies' : [ - '../command_buffer/command_buffer.gyp:command_buffer_client_test', - '../command_buffer/command_buffer.gyp:command_buffer_common_test', - '../command_buffer/command_buffer.gyp:command_buffer_service_test', - ], - }, - ], ], }, ], |