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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } | 331 } |
328 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | 332 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
329 return gpu_platform_support_host_.get(); | 333 return gpu_platform_support_host_.get(); |
330 } | 334 } |
331 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { | 335 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { |
332 return nullptr; // no input injection support. | 336 return nullptr; // no input injection support. |
333 } | 337 } |
334 scoped_ptr<PlatformWindow> CreatePlatformWindow( | 338 scoped_ptr<PlatformWindow> CreatePlatformWindow( |
335 PlatformWindowDelegate* delegate, | 339 PlatformWindowDelegate* delegate, |
336 const gfx::Rect& bounds) override { | 340 const gfx::Rect& bounds) override { |
337 return make_scoped_ptr<PlatformWindow>( | 341 return make_scoped_ptr<PlatformWindow>(new EgltestWindow( |
338 new EgltestWindow(delegate, | 342 delegate, &eglplatform_shim_, event_factory_ozone_.get(), bounds)); |
339 &eglplatform_shim_, | |
340 event_factory_ozone_.get(), | |
341 bounds)); | |
342 } | 343 } |
343 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 344 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
344 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 345 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); |
345 } | 346 } |
346 | 347 |
347 void InitializeUI() override { | 348 void InitializeUI() override { |
348 device_manager_ = CreateDeviceManager(); | 349 device_manager_ = CreateDeviceManager(); |
349 if (!surface_factory_ozone_) | 350 if (!surface_factory_ozone_) |
350 surface_factory_ozone_.reset( | 351 surface_factory_ozone_.reset( |
351 new SurfaceFactoryEgltest(&eglplatform_shim_)); | 352 new SurfaceFactoryEgltest(&eglplatform_shim_)); |
352 event_factory_ozone_.reset( | 353 event_factory_ozone_.reset( |
353 new EventFactoryEvdev(NULL, device_manager_.get())); | 354 new EventFactoryEvdev(NULL, device_manager_.get())); |
| 355 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
| 356 make_scoped_ptr(new StubKeyboardLayoutEngine())); |
354 cursor_factory_ozone_.reset(new CursorFactoryOzone()); | 357 cursor_factory_ozone_.reset(new CursorFactoryOzone()); |
355 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 358 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
356 } | 359 } |
357 | 360 |
358 void InitializeGPU() override { | 361 void InitializeGPU() override { |
359 if (!surface_factory_ozone_) | 362 if (!surface_factory_ozone_) |
360 surface_factory_ozone_.reset( | 363 surface_factory_ozone_.reset( |
361 new SurfaceFactoryEgltest(&eglplatform_shim_)); | 364 new SurfaceFactoryEgltest(&eglplatform_shim_)); |
362 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | 365 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
363 } | 366 } |
(...skipping 14 matching lines...) Expand all Loading... |
378 | 381 |
379 } // namespace | 382 } // namespace |
380 | 383 |
381 OzonePlatform* CreateOzonePlatformEgltest() { | 384 OzonePlatform* CreateOzonePlatformEgltest() { |
382 OzonePlatformEgltest* platform = new OzonePlatformEgltest; | 385 OzonePlatformEgltest* platform = new OzonePlatformEgltest; |
383 platform->Initialize(); | 386 platform->Initialize(); |
384 return platform; | 387 return platform; |
385 } | 388 } |
386 | 389 |
387 } // namespace ui | 390 } // namespace ui |
OLD | NEW |