OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/platform/egltest/ozone_platform_egltest.h" | 5 #include "ui/ozone/platform/egltest/ozone_platform_egltest.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "library_loaders/libeglplatform_shim.h" | 12 #include "library_loaders/libeglplatform_shim.h" |
13 #include "third_party/khronos/EGL/egl.h" | 13 #include "third_party/khronos/EGL/egl.h" |
14 #include "ui/events/devices/device_data_manager.h" | 14 #include "ui/events/devices/device_data_manager.h" |
15 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
16 #include "ui/events/ozone/device/device_manager.h" | 16 #include "ui/events/ozone/device/device_manager.h" |
17 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 17 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
18 #include "ui/events/ozone/events_ozone.h" | 18 #include "ui/events/ozone/events_ozone.h" |
| 19 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
| 20 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" |
19 #include "ui/events/platform/platform_event_dispatcher.h" | 21 #include "ui/events/platform/platform_event_dispatcher.h" |
20 #include "ui/gfx/vsync_provider.h" | 22 #include "ui/gfx/vsync_provider.h" |
21 #include "ui/ozone/common/egl_util.h" | 23 #include "ui/ozone/common/egl_util.h" |
22 #include "ui/ozone/common/native_display_delegate_ozone.h" | 24 #include "ui/ozone/common/native_display_delegate_ozone.h" |
23 #include "ui/ozone/public/cursor_factory_ozone.h" | 25 #include "ui/ozone/public/cursor_factory_ozone.h" |
24 #include "ui/ozone/public/gpu_platform_support.h" | 26 #include "ui/ozone/public/gpu_platform_support.h" |
25 #include "ui/ozone/public/gpu_platform_support_host.h" | 27 #include "ui/ozone/public/gpu_platform_support_host.h" |
26 #include "ui/ozone/public/ozone_platform.h" | 28 #include "ui/ozone/public/ozone_platform.h" |
27 #include "ui/ozone/public/ozone_switches.h" | 29 #include "ui/ozone/public/ozone_switches.h" |
28 #include "ui/ozone/public/surface_factory_ozone.h" | 30 #include "ui/ozone/public/surface_factory_ozone.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 if (!gles_soname) | 267 if (!gles_soname) |
266 gles_soname = kDefaultGlesSoname; | 268 gles_soname = kDefaultGlesSoname; |
267 | 269 |
268 return ::ui::LoadEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address, | 270 return ::ui::LoadEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address, |
269 egl_soname, gles_soname); | 271 egl_soname, gles_soname); |
270 } | 272 } |
271 | 273 |
272 const int32* SurfaceFactoryEgltest::GetEGLSurfaceProperties( | 274 const int32* SurfaceFactoryEgltest::GetEGLSurfaceProperties( |
273 const int32* desired_list) { | 275 const int32* desired_list) { |
274 static const int32 broken_props[] = { | 276 static const int32 broken_props[] = { |
275 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, | 277 EGL_RENDERABLE_TYPE, |
276 EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT, | 278 EGL_OPENGL_ES2_BIT, |
| 279 EGL_SURFACE_TYPE, |
| 280 EGL_WINDOW_BIT | EGL_PBUFFER_BIT, |
277 EGL_NONE, | 281 EGL_NONE, |
278 }; | 282 }; |
279 return broken_props; | 283 return broken_props; |
280 } | 284 } |
281 | 285 |
282 // Test platform for EGL. | 286 // Test platform for EGL. |
283 // | 287 // |
284 // This is a tiny EGL-based platform. Creation of the native window is | 288 // This is a tiny EGL-based platform. Creation of the native window is |
285 // handled by a separate library called eglplatform_shim.so.1 because | 289 // handled by a separate library called eglplatform_shim.so.1 because |
286 // this itself is platform specific and we want to test out multiple | 290 // this itself is platform specific and we want to test out multiple |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 } | 334 } |
331 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | 335 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
332 return gpu_platform_support_host_.get(); | 336 return gpu_platform_support_host_.get(); |
333 } | 337 } |
334 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { | 338 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { |
335 return nullptr; // no input injection support. | 339 return nullptr; // no input injection support. |
336 } | 340 } |
337 scoped_ptr<PlatformWindow> CreatePlatformWindow( | 341 scoped_ptr<PlatformWindow> CreatePlatformWindow( |
338 PlatformWindowDelegate* delegate, | 342 PlatformWindowDelegate* delegate, |
339 const gfx::Rect& bounds) override { | 343 const gfx::Rect& bounds) override { |
340 return make_scoped_ptr<PlatformWindow>( | 344 return make_scoped_ptr<PlatformWindow>(new EgltestWindow( |
341 new EgltestWindow(delegate, | 345 delegate, &eglplatform_shim_, event_factory_ozone_.get(), bounds)); |
342 &eglplatform_shim_, | |
343 event_factory_ozone_.get(), | |
344 bounds)); | |
345 } | 346 } |
346 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 347 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
347 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 348 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); |
348 } | 349 } |
349 | 350 |
350 void InitializeUI() override { | 351 void InitializeUI() override { |
351 device_manager_ = CreateDeviceManager(); | 352 device_manager_ = CreateDeviceManager(); |
352 if (!surface_factory_ozone_) | 353 if (!surface_factory_ozone_) |
353 surface_factory_ozone_.reset( | 354 surface_factory_ozone_.reset( |
354 new SurfaceFactoryEgltest(&eglplatform_shim_)); | 355 new SurfaceFactoryEgltest(&eglplatform_shim_)); |
355 event_factory_ozone_.reset( | 356 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
356 new EventFactoryEvdev(NULL, device_manager_.get())); | 357 make_scoped_ptr(new StubKeyboardLayoutEngine())); |
| 358 event_factory_ozone_.reset(new EventFactoryEvdev( |
| 359 NULL, device_manager_.get(), |
| 360 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); |
357 cursor_factory_ozone_.reset(new CursorFactoryOzone()); | 361 cursor_factory_ozone_.reset(new CursorFactoryOzone()); |
358 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 362 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
359 } | 363 } |
360 | 364 |
361 void InitializeGPU() override { | 365 void InitializeGPU() override { |
362 if (!surface_factory_ozone_) | 366 if (!surface_factory_ozone_) |
363 surface_factory_ozone_.reset( | 367 surface_factory_ozone_.reset( |
364 new SurfaceFactoryEgltest(&eglplatform_shim_)); | 368 new SurfaceFactoryEgltest(&eglplatform_shim_)); |
365 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | 369 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
366 } | 370 } |
(...skipping 14 matching lines...) Expand all Loading... |
381 | 385 |
382 } // namespace | 386 } // namespace |
383 | 387 |
384 OzonePlatform* CreateOzonePlatformEgltest() { | 388 OzonePlatform* CreateOzonePlatformEgltest() { |
385 OzonePlatformEgltest* platform = new OzonePlatformEgltest; | 389 OzonePlatformEgltest* platform = new OzonePlatformEgltest; |
386 platform->Initialize(); | 390 platform->Initialize(); |
387 return platform; | 391 return platform; |
388 } | 392 } |
389 | 393 |
390 } // namespace ui | 394 } // namespace ui |
OLD | NEW |