diff options
author | altimin <altimin@chromium.org> | 2015-11-12 10:40:58 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-12 18:41:54 +0000 |
commit | 5abfd72765d29f36b577cdbb91ed7cfabc7560a7 (patch) | |
tree | 8dba17fb852599cf99a9cde079ac15c98a59b109 | |
parent | 2af4be3722e3dea304e3c5e18581521f9606248b (diff) | |
download | chromium_src-5abfd72765d29f36b577cdbb91ed7cfabc7560a7.zip chromium_src-5abfd72765d29f36b577cdbb91ed7cfabc7560a7.tar.gz chromium_src-5abfd72765d29f36b577cdbb91ed7cfabc7560a7.tar.bz2 |
Rename "test" ozone platform to "headless"
This platform normally has no graphical output or user input
support and has been used for running tests. Rename it to
"headless" to describe what it does rather than what we've
been using it for.
BUG=546953
Review URL: https://codereview.chromium.org/1410123003
Cr-Commit-Position: refs/heads/master@{#359336}
23 files changed, 242 insertions, 247 deletions
diff --git a/build/common.gypi b/build/common.gypi index b80d0f2..f44a972 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -1535,7 +1535,7 @@ 'ozone_platform_egltest%': 0, 'ozone_platform_gbm%': 0, 'ozone_platform_ozonex%': 0, - 'ozone_platform_test%': 0, + 'ozone_platform_headless%': 0, # Experiment: http://crbug.com/426914 'envoy%': 0, @@ -2363,13 +2363,13 @@ }], ['use_ozone==1 and ozone_auto_platforms==1', { - # Use test as the default platform. - 'ozone_platform%': 'test', + # Use headless as the default platform. + 'ozone_platform%': 'headless', # Build all platforms whose deps are in install-build-deps.sh. # Only these platforms will be compile tested by buildbots. 'ozone_platform_gbm%': 1, - 'ozone_platform_test%': 1, + 'ozone_platform_headless%': 1, 'ozone_platform_egltest%': 1, }], diff --git a/chromecast/BUILD.gn b/chromecast/BUILD.gn index 306af8a..6ac1963 100644 --- a/chromecast/BUILD.gn +++ b/chromecast/BUILD.gn @@ -137,7 +137,7 @@ cast_test_group_list("cast_test_lists") { run_list_path = "$root_out_dir/tests/run_test_list.txt" - additional_options = [ "--ozone-platform=test" ] + additional_options = [ "--ozone-platform=headless" ] build_tests = true diff --git a/chromecast/chromecast_tests.gypi b/chromecast/chromecast_tests.gypi index 53316ba..4eaea74 100644 --- a/chromecast/chromecast_tests.gypi +++ b/chromecast/chromecast_tests.gypi @@ -396,7 +396,7 @@ 'variables': { 'test_generator_py': '<(DEPTH)/chromecast/tools/build/generate_test_lists.py', 'test_inputs_dir': '<(SHARED_INTERMEDIATE_DIR)/chromecast/tests', - 'test_additional_options': '--ozone-platform=test' + 'test_additional_options': '--ozone-platform=headless' }, 'actions': [ { diff --git a/media/ozone/media_ozone_platform.cc b/media/ozone/media_ozone_platform.cc index cda1396..15d52c6 100644 --- a/media/ozone/media_ozone_platform.cc +++ b/media/ozone/media_ozone_platform.cc @@ -52,7 +52,7 @@ MediaOzonePlatform* CreateMediaOzonePlatformGbm() { return new MediaOzonePlatformStub; } -MediaOzonePlatform* CreateMediaOzonePlatformTest() { +MediaOzonePlatform* CreateMediaOzonePlatformHeadless() { return new MediaOzonePlatformStub; } diff --git a/ui/ozone/BUILD.gn b/ui/ozone/BUILD.gn index fb13cd3..f529692 100644 --- a/ui/ozone/BUILD.gn +++ b/ui/ozone/BUILD.gn @@ -19,9 +19,9 @@ if (ozone_platform_egltest) { ozone_platform_deps += [ "platform/egltest" ] } -if (ozone_platform_test) { - ozone_platforms += [ "test" ] - ozone_platform_deps += [ "platform/test" ] +if (ozone_platform_headless) { + ozone_platforms += [ "headless" ] + ozone_platform_deps += [ "platform/headless" ] } if (ozone_platform_caca) { @@ -131,6 +131,7 @@ component("ozone") { "//ui/display/types", "//ui/display/util", "//ui/events", + "//ui/events/devices", "//ui/events/ozone:events_ozone", "//ui/gfx", "//ui/gfx/geometry", diff --git a/ui/ozone/ozone.gni b/ui/ozone/ozone.gni index cb6f62e..15e909d 100644 --- a/ui/ozone/ozone.gni +++ b/ui/ozone/ozone.gni @@ -26,14 +26,14 @@ declare_args() { ozone_platform_egltest = false ozone_platform_gbm = false ozone_platform_ozonex = false - ozone_platform_test = false + ozone_platform_headless = false if (ozone_auto_platforms) { if (is_chromecast) { # The default platform used at runtime is "cast". ozone_platform = "cast" ozone_platform_cast = true - ozone_platform_test = true + ozone_platform_headless = true # For desktop Chromecast builds, override the default "cast" platform with # --ozone_platform=egltest @@ -42,13 +42,13 @@ declare_args() { ozone_platform_ozonex = true } } else { - # Use test as the default platform. - ozone_platform = "test" + # Use headless as the default platform. + ozone_platform = "headless" # Build all platforms whose deps are in install-build-deps.sh. # Only these platforms will be compile tested by buildbots. ozone_platform_gbm = true - ozone_platform_test = true + ozone_platform_headless = true ozone_platform_egltest = true } } diff --git a/ui/ozone/ozone.gyp b/ui/ozone/ozone.gyp index 1f4bfc4..d0b81a7 100644 --- a/ui/ozone/ozone.gyp +++ b/ui/ozone/ozone.gyp @@ -240,9 +240,9 @@ 'platform/drm/gbm.gypi', ], }], - ['<(ozone_platform_test) == 1', { + ['<(ozone_platform_headless) == 1', { 'includes': [ - 'platform/test/test.gypi', + 'platform/headless/headless.gypi', ], }], ], diff --git a/ui/ozone/platform/headless/BUILD.gn b/ui/ozone/platform/headless/BUILD.gn new file mode 100644 index 0000000..fb731a2 --- /dev/null +++ b/ui/ozone/platform/headless/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("headless") { + sources = [ + "client_native_pixmap_factory_headless.cc", + "client_native_pixmap_factory_headless.h", + "headless_surface_factory.cc", + "headless_surface_factory.h", + "headless_window.cc", + "headless_window.h", + "headless_window_manager.cc", + "headless_window_manager.h", + "ozone_platform_headless.cc", + "ozone_platform_headless.h", + ] + + deps = [ + "//base", + "//skia", + "//ui/base", + "//ui/gfx/geometry", + "//ui/events/ozone:events_ozone_layout", + "//ui/events/platform", + ] +} diff --git a/ui/ozone/platform/test/DEPS b/ui/ozone/platform/headless/DEPS index 41cd997..41cd997 100644 --- a/ui/ozone/platform/test/DEPS +++ b/ui/ozone/platform/headless/DEPS diff --git a/ui/ozone/platform/test/client_native_pixmap_factory_test.cc b/ui/ozone/platform/headless/client_native_pixmap_factory_headless.cc index 9a8e3e2..1f409eb 100644 --- a/ui/ozone/platform/test/client_native_pixmap_factory_test.cc +++ b/ui/ozone/platform/headless/client_native_pixmap_factory_headless.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/ozone/platform/test/client_native_pixmap_factory_test.h" +#include "ui/ozone/platform/headless/client_native_pixmap_factory_headless.h" #include "ui/ozone/common/stub_client_native_pixmap_factory.h" namespace ui { -ClientNativePixmapFactory* CreateClientNativePixmapFactoryTest() { +ClientNativePixmapFactory* CreateClientNativePixmapFactoryHeadless() { return CreateStubClientNativePixmapFactory(); } diff --git a/ui/ozone/platform/headless/client_native_pixmap_factory_headless.h b/ui/ozone/platform/headless/client_native_pixmap_factory_headless.h new file mode 100644 index 0000000..675eec1 --- /dev/null +++ b/ui/ozone/platform/headless/client_native_pixmap_factory_headless.h @@ -0,0 +1,17 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_OZONE_PLATFORM_HEADLESS_CLIENT_NATIVE_PIXMAP_FACTORY_HEADLESS_H_ +#define UI_OZONE_PLATFORM_HEADLESS_CLIENT_NATIVE_PIXMAP_FACTORY_HEADLESS_H_ + +namespace ui { + +class ClientNativePixmapFactory; + +// Constructor hook for use in constructor_list.cc +ClientNativePixmapFactory* CreateClientNativePixmapFactoryHeadless(); + +} // namespace ui + +#endif // UI_OZONE_PLATFORM_HEADLESS_CLIENT_NATIVE_PIXMAP_FACTORY_HEADLESS_H_ diff --git a/ui/ozone/platform/test/test.gypi b/ui/ozone/platform/headless/headless.gypi index 6b2794b..65de1fa 100644 --- a/ui/ozone/platform/test/test.gypi +++ b/ui/ozone/platform/headless/headless.gypi @@ -5,15 +5,15 @@ { 'variables': { 'internal_ozone_platform_deps': [ - 'ozone_platform_test', + 'ozone_platform_headless', ], 'internal_ozone_platforms': [ - 'test' + 'headless' ], }, 'targets': [ { - 'target_name': 'ozone_platform_test', + 'target_name': 'ozone_platform_headless', 'type': 'static_library', 'defines': [ 'OZONE_IMPLEMENTATION', @@ -27,16 +27,16 @@ '../gfx/gfx.gyp:gfx', ], 'sources': [ - 'client_native_pixmap_factory_test.cc', - 'client_native_pixmap_factory_test.h', - 'ozone_platform_test.cc', - 'ozone_platform_test.h', - 'test_surface_factory.cc', - 'test_surface_factory.h', - 'test_window.cc', - 'test_window.h', - 'test_window_manager.cc', - 'test_window_manager.h', + 'client_native_pixmap_factory_headless.cc', + 'client_native_pixmap_factory_headless.h', + 'ozone_platform_headless.cc', + 'ozone_platform_headless.h', + 'headless_surface_factory.cc', + 'headless_surface_factory.h', + 'headless_window.cc', + 'headless_window.h', + 'headless_window_manager.cc', + 'headless_window_manager.h', ], }, ], diff --git a/ui/ozone/platform/test/test_surface_factory.cc b/ui/ozone/platform/headless/headless_surface_factory.cc index b513441..3262e69 100644 --- a/ui/ozone/platform/test/test_surface_factory.cc +++ b/ui/ozone/platform/headless/headless_surface_factory.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/ozone/platform/test/test_surface_factory.h" +#include "ui/ozone/platform/headless/headless_surface_factory.h" #include "base/bind.h" #include "base/files/file_util.h" @@ -14,8 +14,8 @@ #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/skia_util.h" #include "ui/gfx/vsync_provider.h" -#include "ui/ozone/platform/test/test_window.h" -#include "ui/ozone/platform/test/test_window_manager.h" +#include "ui/ozone/platform/headless/headless_window.h" +#include "ui/ozone/platform/headless/headless_window_manager.h" #include "ui/ozone/public/surface_ozone_canvas.h" namespace ui { @@ -31,6 +31,7 @@ void WriteDataToFile(const base::FilePath& location, const SkBitmap& bitmap) { png_data.size()); } +// TODO(altimin): Find a proper way to capture rendering output. class FileSurface : public SurfaceOzoneCanvas { public: FileSurface(const base::FilePath& location) : location_(location) {} @@ -66,20 +67,22 @@ class FileSurface : public SurfaceOzoneCanvas { } // namespace -TestSurfaceFactory::TestSurfaceFactory() : TestSurfaceFactory(nullptr) {} +HeadlessSurfaceFactory::HeadlessSurfaceFactory() + : HeadlessSurfaceFactory(nullptr) {} -TestSurfaceFactory::TestSurfaceFactory(TestWindowManager* window_manager) +HeadlessSurfaceFactory::HeadlessSurfaceFactory( + HeadlessWindowManager* window_manager) : window_manager_(window_manager) {} -TestSurfaceFactory::~TestSurfaceFactory() {} +HeadlessSurfaceFactory::~HeadlessSurfaceFactory() {} -scoped_ptr<SurfaceOzoneCanvas> TestSurfaceFactory::CreateCanvasForWidget( +scoped_ptr<SurfaceOzoneCanvas> HeadlessSurfaceFactory::CreateCanvasForWidget( gfx::AcceleratedWidget widget) { - TestWindow* window = window_manager_->GetWindow(widget); + HeadlessWindow* window = window_manager_->GetWindow(widget); return make_scoped_ptr<SurfaceOzoneCanvas>(new FileSurface(window->path())); } -bool TestSurfaceFactory::LoadEGLGLES2Bindings( +bool HeadlessSurfaceFactory::LoadEGLGLES2Bindings( AddGLLibraryCallback add_gl_library, SetGLGetProcAddressProcCallback set_gl_get_proc_address) { return false; diff --git a/ui/ozone/platform/test/test_surface_factory.h b/ui/ozone/platform/headless/headless_surface_factory.h index 98002ec..b715cbc 100644 --- a/ui/ozone/platform/test/test_surface_factory.h +++ b/ui/ozone/platform/headless/headless_surface_factory.h @@ -2,20 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_OZONE_PLATFORM_TEST_TEST_SURFACE_FACTORY_H_ -#define UI_OZONE_PLATFORM_TEST_TEST_SURFACE_FACTORY_H_ +#ifndef UI_OZONE_PLATFORM_HEADLESS_HEADLESS_SURFACE_FACTORY_H_ +#define UI_OZONE_PLATFORM_HEADLESS_HEADLESS_SURFACE_FACTORY_H_ +#include "base/macros.h" #include "ui/ozone/public/surface_factory_ozone.h" namespace ui { -class TestWindowManager; +class HeadlessWindowManager; -class TestSurfaceFactory : public SurfaceFactoryOzone { +class HeadlessSurfaceFactory : public SurfaceFactoryOzone { public: - TestSurfaceFactory(); - explicit TestSurfaceFactory(TestWindowManager* window_manager); - ~TestSurfaceFactory() override; + HeadlessSurfaceFactory(); + explicit HeadlessSurfaceFactory(HeadlessWindowManager* window_manager); + ~HeadlessSurfaceFactory() override; // SurfaceFactoryOzone: scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget( @@ -25,11 +26,11 @@ class TestSurfaceFactory : public SurfaceFactoryOzone { SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; private: - TestWindowManager* window_manager_; + HeadlessWindowManager* window_manager_; - DISALLOW_COPY_AND_ASSIGN(TestSurfaceFactory); + DISALLOW_COPY_AND_ASSIGN(HeadlessSurfaceFactory); }; } // namespace ui -#endif // UI_OZONE_PLATFORM_TEST_TEST_SURFACE_FACTORY_H_ +#endif // UI_OZONE_PLATFORM_HEADLESS_HEADLESS_SURFACE_FACTORY_H_ diff --git a/ui/ozone/platform/headless/headless_window.cc b/ui/ozone/platform/headless/headless_window.cc new file mode 100644 index 0000000..75f86a1 --- /dev/null +++ b/ui/ozone/platform/headless/headless_window.cc @@ -0,0 +1,77 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/ozone/platform/headless/headless_window.h" + +#include <string> + +#include "base/files/file_path.h" +#include "base/strings/string_number_conversions.h" +#include "ui/events/platform/platform_event_source.h" +#include "ui/ozone/platform/headless/headless_window_manager.h" +#include "ui/platform_window/platform_window_delegate.h" + +namespace ui { + +HeadlessWindow::HeadlessWindow(PlatformWindowDelegate* delegate, + HeadlessWindowManager* manager, + const gfx::Rect& bounds) + : delegate_(delegate), manager_(manager), bounds_(bounds) { + widget_ = manager_->AddWindow(this); + delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f); +} + +HeadlessWindow::~HeadlessWindow() { + manager_->RemoveWindow(widget_, this); +} + +base::FilePath HeadlessWindow::path() { + base::FilePath base_path = manager_->base_path(); + if (base_path.empty() || base_path == base::FilePath("/dev/null")) + return base_path; + + // Disambiguate multiple window output files with the window id. + return base_path.Append(base::IntToString(widget_)); +} + +gfx::Rect HeadlessWindow::GetBounds() { + return bounds_; +} + +void HeadlessWindow::SetBounds(const gfx::Rect& bounds) { + bounds_ = bounds; + delegate_->OnBoundsChanged(bounds); +} + +void HeadlessWindow::SetTitle(const base::string16& title) {} + +void HeadlessWindow::Show() {} + +void HeadlessWindow::Hide() {} + +void HeadlessWindow::Close() {} + +void HeadlessWindow::SetCapture() {} + +void HeadlessWindow::ReleaseCapture() {} + +void HeadlessWindow::ToggleFullscreen() {} + +void HeadlessWindow::Maximize() {} + +void HeadlessWindow::Minimize() {} + +void HeadlessWindow::Restore() {} + +void HeadlessWindow::SetCursor(PlatformCursor cursor) {} + +void HeadlessWindow::MoveCursorTo(const gfx::Point& location) {} + +void HeadlessWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {} + +PlatformImeController* HeadlessWindow::GetPlatformImeController() { + return nullptr; +} + +} // namespace ui diff --git a/ui/ozone/platform/test/test_window.h b/ui/ozone/platform/headless/headless_window.h index 0dacf33..5587b65 100644 --- a/ui/ozone/platform/test/test_window.h +++ b/ui/ozone/platform/headless/headless_window.h @@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_OZONE_PLATFORM_TEST_TEST_WINDOW_H_ -#define UI_OZONE_PLATFORM_TEST_TEST_WINDOW_H_ +#ifndef UI_OZONE_PLATFORM_HEADLESS_HEADLESS_WINDOW_H_ +#define UI_OZONE_PLATFORM_HEADLESS_HEADLESS_WINDOW_H_ #include "base/files/file_path.h" +#include "base/macros.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/native_widget_types.h" #include "ui/platform_window/platform_window.h" @@ -13,14 +14,14 @@ namespace ui { class PlatformWindowDelegate; -class TestWindowManager; +class HeadlessWindowManager; -class TestWindow : public PlatformWindow { +class HeadlessWindow : public PlatformWindow { public: - TestWindow(PlatformWindowDelegate* delegate, - TestWindowManager* manager, - const gfx::Rect& bounds); - ~TestWindow() override; + HeadlessWindow(PlatformWindowDelegate* delegate, + HeadlessWindowManager* manager, + const gfx::Rect& bounds); + ~HeadlessWindow() override; // Path for image file for this window. base::FilePath path(); @@ -45,13 +46,13 @@ class TestWindow : public PlatformWindow { private: PlatformWindowDelegate* delegate_; - TestWindowManager* manager_; + HeadlessWindowManager* manager_; gfx::Rect bounds_; gfx::AcceleratedWidget widget_; - DISALLOW_COPY_AND_ASSIGN(TestWindow); + DISALLOW_COPY_AND_ASSIGN(HeadlessWindow); }; } // namespace ui -#endif // UI_OZONE_PLATFORM_TEST_TEST_WINDOW_H_ +#endif // UI_OZONE_PLATFORM_HEADLESS_HEADLESS_WINDOW_H_ diff --git a/ui/ozone/platform/test/test_window_manager.cc b/ui/ozone/platform/headless/headless_window_manager.cc index 1887c62..eb6b483 100644 --- a/ui/ozone/platform/test/test_window_manager.cc +++ b/ui/ozone/platform/headless/headless_window_manager.cc @@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/ozone/platform/test/test_window_manager.h" +#include "ui/ozone/platform/headless/headless_window_manager.h" #include "base/files/file_util.h" #include "base/location.h" namespace ui { -TestWindowManager::TestWindowManager(const base::FilePath& dump_location) - : location_(dump_location) { -} +HeadlessWindowManager::HeadlessWindowManager( + const base::FilePath& dump_location) + : location_(dump_location) {} -TestWindowManager::~TestWindowManager() { +HeadlessWindowManager::~HeadlessWindowManager() { DCHECK(thread_checker_.CalledOnValidThread()); } -void TestWindowManager::Initialize() { +void HeadlessWindowManager::Initialize() { if (location_.empty()) return; if (!DirectoryExists(location_) && !base::CreateDirectory(location_) && @@ -27,20 +27,21 @@ void TestWindowManager::Initialize() { PLOG(FATAL) << "unable to write to output location"; } -int32_t TestWindowManager::AddWindow(TestWindow* window) { +int32_t HeadlessWindowManager::AddWindow(HeadlessWindow* window) { return windows_.Add(window); } -void TestWindowManager::RemoveWindow(int32_t window_id, TestWindow* window) { +void HeadlessWindowManager::RemoveWindow(int32_t window_id, + HeadlessWindow* window) { DCHECK_EQ(window, windows_.Lookup(window_id)); windows_.Remove(window_id); } -TestWindow* TestWindowManager::GetWindow(int32_t window_id) { +HeadlessWindow* HeadlessWindowManager::GetWindow(int32_t window_id) { return windows_.Lookup(window_id); } -base::FilePath TestWindowManager::base_path() const { +base::FilePath HeadlessWindowManager::base_path() const { return location_; } diff --git a/ui/ozone/platform/test/test_window_manager.h b/ui/ozone/platform/headless/headless_window_manager.h index b7adc14..f2710bc 100644 --- a/ui/ozone/platform/test/test_window_manager.h +++ b/ui/ozone/platform/headless/headless_window_manager.h @@ -2,11 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_OZONE_PLATFORM_TEST_TEST_WINDOW_MANAGER_H_ -#define UI_OZONE_PLATFORM_TEST_TEST_WINDOW_MANAGER_H_ +#ifndef UI_OZONE_PLATFORM_HEADLESS_HEADLESS_WINDOW_MANAGER_H_ +#define UI_OZONE_PLATFORM_HEADLESS_HEADLESS_WINDOW_MANAGER_H_ #include "base/files/file_path.h" #include "base/id_map.h" +#include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/threading/thread_checker.h" #include "ui/gfx/native_widget_types.h" @@ -14,24 +15,24 @@ namespace ui { -class TestWindow; +class HeadlessWindow; -class TestWindowManager { +class HeadlessWindowManager { public: - explicit TestWindowManager(const base::FilePath& dump_location); - ~TestWindowManager(); + explicit HeadlessWindowManager(const base::FilePath& dump_location); + ~HeadlessWindowManager(); // Initialize (mainly check that we have a place to write output to). void Initialize(); // Register a new window. Returns the window id. - int32_t AddWindow(TestWindow* window); + int32_t AddWindow(HeadlessWindow* window); // Remove a window. - void RemoveWindow(int32_t window_id, TestWindow* window); + void RemoveWindow(int32_t window_id, HeadlessWindow* window); // Find a window object by id; - TestWindow* GetWindow(int32_t window_id); + HeadlessWindow* GetWindow(int32_t window_id); // User-supplied path for images. base::FilePath base_path() const; @@ -39,12 +40,12 @@ class TestWindowManager { private: base::FilePath location_; - IDMap<TestWindow> windows_; + IDMap<HeadlessWindow> windows_; base::ThreadChecker thread_checker_; - DISALLOW_COPY_AND_ASSIGN(TestWindowManager); + DISALLOW_COPY_AND_ASSIGN(HeadlessWindowManager); }; } // namespace ui -#endif // UI_OZONE_PLATFORM_TEST_TEST_WINDOW_MANAGER_H_ +#endif // UI_OZONE_PLATFORM_HEADLESS_HEADLESS_WINDOW_MANAGER_H_ diff --git a/ui/ozone/platform/test/ozone_platform_test.cc b/ui/ozone/platform/headless/ozone_platform_headless.cc index ed69388..0fc1f19 100644 --- a/ui/ozone/platform/test/ozone_platform_test.cc +++ b/ui/ozone/platform/headless/ozone_platform_headless.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/ozone/platform/test/ozone_platform_test.h" +#include "ui/ozone/platform/headless/ozone_platform_headless.h" #include "base/command_line.h" #include "base/files/file_path.h" @@ -12,9 +12,9 @@ #include "ui/events/platform/platform_event_source.h" #include "ui/ozone/common/native_display_delegate_ozone.h" #include "ui/ozone/common/stub_overlay_manager.h" -#include "ui/ozone/platform/test/test_surface_factory.h" -#include "ui/ozone/platform/test/test_window.h" -#include "ui/ozone/platform/test/test_window_manager.h" +#include "ui/ozone/platform/headless/headless_surface_factory.h" +#include "ui/ozone/platform/headless/headless_window.h" +#include "ui/ozone/platform/headless/headless_window_manager.h" #include "ui/ozone/public/cursor_factory_ozone.h" #include "ui/ozone/public/gpu_platform_support.h" #include "ui/ozone/public/gpu_platform_support_host.h" @@ -27,24 +27,24 @@ namespace ui { namespace { -// A test implementation of PlatformEventSource that we can instantiate to make +// A headless implementation of PlatformEventSource that we can instantiate to +// make // sure that the PlatformEventSource has an instance while in unit tests. -class TestPlatformEventSource : public ui::PlatformEventSource { +class HeadlessPlatformEventSource : public ui::PlatformEventSource { public: - TestPlatformEventSource() {} - ~TestPlatformEventSource() override {} + HeadlessPlatformEventSource() {} + ~HeadlessPlatformEventSource() override {} private: - DISALLOW_COPY_AND_ASSIGN(TestPlatformEventSource); + DISALLOW_COPY_AND_ASSIGN(HeadlessPlatformEventSource); }; -// OzonePlatform for testing -// -// This platform dumps images to a file for testing purposes. -class OzonePlatformTest : public OzonePlatform { +// OzonePlatform for headless mode +class OzonePlatformHeadless : public OzonePlatform { public: - OzonePlatformTest(const base::FilePath& dump_file) : file_path_(dump_file) {} - ~OzonePlatformTest() override {} + OzonePlatformHeadless(const base::FilePath& dump_file) + : file_path_(dump_file) {} + ~OzonePlatformHeadless() override {} // OzonePlatform: ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { @@ -72,7 +72,7 @@ class OzonePlatformTest : public OzonePlatform { PlatformWindowDelegate* delegate, const gfx::Rect& bounds) override { return make_scoped_ptr<PlatformWindow>( - new TestWindow(delegate, window_manager_.get(), bounds)); + new HeadlessWindow(delegate, window_manager_.get(), bounds)); } scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { return make_scoped_ptr(new NativeDisplayDelegateOzone()); @@ -82,12 +82,12 @@ class OzonePlatformTest : public OzonePlatform { } void InitializeUI() override { - window_manager_.reset(new TestWindowManager(file_path_)); + window_manager_.reset(new HeadlessWindowManager(file_path_)); window_manager_->Initialize(); - surface_factory_.reset(new TestSurfaceFactory(window_manager_.get())); + surface_factory_.reset(new HeadlessSurfaceFactory(window_manager_.get())); // This unbreaks tests that create their own. if (!PlatformEventSource::GetInstance()) - platform_event_source_.reset(new TestPlatformEventSource); + platform_event_source_.reset(new HeadlessPlatformEventSource); KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( make_scoped_ptr(new StubKeyboardLayoutEngine())); @@ -99,13 +99,13 @@ class OzonePlatformTest : public OzonePlatform { void InitializeGPU() override { if (!surface_factory_) - surface_factory_.reset(new TestSurfaceFactory()); + surface_factory_.reset(new HeadlessSurfaceFactory()); gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); } private: - scoped_ptr<TestWindowManager> window_manager_; - scoped_ptr<TestSurfaceFactory> surface_factory_; + scoped_ptr<HeadlessWindowManager> window_manager_; + scoped_ptr<HeadlessSurfaceFactory> surface_factory_; scoped_ptr<PlatformEventSource> platform_event_source_; scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; scoped_ptr<InputController> input_controller_; @@ -114,17 +114,17 @@ class OzonePlatformTest : public OzonePlatform { scoped_ptr<OverlayManagerOzone> overlay_manager_; base::FilePath file_path_; - DISALLOW_COPY_AND_ASSIGN(OzonePlatformTest); + DISALLOW_COPY_AND_ASSIGN(OzonePlatformHeadless); }; } // namespace -OzonePlatform* CreateOzonePlatformTest() { +OzonePlatform* CreateOzonePlatformHeadless() { base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); base::FilePath location; if (cmd->HasSwitch(switches::kOzoneDumpFile)) location = cmd->GetSwitchValuePath(switches::kOzoneDumpFile); - return new OzonePlatformTest(location); + return new OzonePlatformHeadless(location); } } // namespace ui diff --git a/ui/ozone/platform/test/ozone_platform_test.h b/ui/ozone/platform/headless/ozone_platform_headless.h index fb25fd6..0c3e94c 100644 --- a/ui/ozone/platform/test/ozone_platform_test.h +++ b/ui/ozone/platform/headless/ozone_platform_headless.h @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_OZONE_PLATFORM_TEST_OZONE_PLATFORM_TEST_H_ -#define UI_OZONE_PLATFORM_TEST_OZONE_PLATFORM_TEST_H_ +#ifndef UI_OZONE_PLATFORM_HEADLESS_OZONE_PLATFORM_HEADLESS_H_ +#define UI_OZONE_PLATFORM_HEADLESS_OZONE_PLATFORM_HEADLESS_H_ namespace ui { class OzonePlatform; // Constructor hook for use in ozone_platform_list.cc -OzonePlatform* CreateOzonePlatformTest(); +OzonePlatform* CreateOzonePlatformHeadless(); } // namespace ui -#endif // UI_OZONE_PLATFORM_TEST_OZONE_PLATFORM_TEST_H_ +#endif // UI_OZONE_PLATFORM_HEADLESS_OZONE_PLATFORM_HEADLESS_H_ diff --git a/ui/ozone/platform/test/BUILD.gn b/ui/ozone/platform/test/BUILD.gn deleted file mode 100644 index 2148d7b..0000000 --- a/ui/ozone/platform/test/BUILD.gn +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -source_set("test") { - sources = [ - "client_native_pixmap_factory_test.cc", - "client_native_pixmap_factory_test.h", - "ozone_platform_test.cc", - "ozone_platform_test.h", - "test_surface_factory.cc", - "test_surface_factory.h", - "test_window.cc", - "test_window.h", - "test_window_manager.cc", - "test_window_manager.h", - ] - - deps = [ - "//base", - "//skia", - "//ui/base", - "//ui/gfx/geometry", - "//ui/events/ozone:events_ozone_layout", - "//ui/events/platform", - ] -} diff --git a/ui/ozone/platform/test/client_native_pixmap_factory_test.h b/ui/ozone/platform/test/client_native_pixmap_factory_test.h deleted file mode 100644 index ed2ead8..0000000 --- a/ui/ozone/platform/test/client_native_pixmap_factory_test.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_OZONE_PLATFORM_TEST_CLIENT_NATIVE_PIXMAP_FACTORY_TEST_H_ -#define UI_OZONE_PLATFORM_TEST_CLIENT_NATIVE_PIXMAP_FACTORY_TEST_H_ - -namespace ui { - -class ClientNativePixmapFactory; - -// Constructor hook for use in constructor_list.cc -ClientNativePixmapFactory* CreateClientNativePixmapFactoryTest(); - -} // namespace ui - -#endif // UI_OZONE_PLATFORM_TEST_CLIENT_NATIVE_PIXMAP_FACTORY_TEST_H_ diff --git a/ui/ozone/platform/test/test_window.cc b/ui/ozone/platform/test/test_window.cc deleted file mode 100644 index 8cbe171..0000000 --- a/ui/ozone/platform/test/test_window.cc +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/ozone/platform/test/test_window.h" - -#include <string> - -#include "base/files/file_path.h" -#include "base/strings/string_number_conversions.h" -#include "ui/events/platform/platform_event_source.h" -#include "ui/ozone/platform/test/test_window_manager.h" -#include "ui/platform_window/platform_window_delegate.h" - -namespace ui { - -TestWindow::TestWindow(PlatformWindowDelegate* delegate, - TestWindowManager* manager, - const gfx::Rect& bounds) - : delegate_(delegate), manager_(manager), bounds_(bounds) { - widget_ = manager_->AddWindow(this); - delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f); -} - -TestWindow::~TestWindow() { - manager_->RemoveWindow(widget_, this); -} - -base::FilePath TestWindow::path() { - base::FilePath base_path = manager_->base_path(); - if (base_path.empty() || base_path == base::FilePath("/dev/null")) - return base_path; - - // Disambiguate multiple window output files with the window id. - return base_path.Append(base::IntToString(widget_)); -} - -gfx::Rect TestWindow::GetBounds() { - return bounds_; -} - -void TestWindow::SetBounds(const gfx::Rect& bounds) { - bounds_ = bounds; - delegate_->OnBoundsChanged(bounds); -} - -void TestWindow::SetTitle(const base::string16& title) { -} - -void TestWindow::Show() { -} - -void TestWindow::Hide() { -} - -void TestWindow::Close() { -} - -void TestWindow::SetCapture() { -} - -void TestWindow::ReleaseCapture() { -} - -void TestWindow::ToggleFullscreen() { -} - -void TestWindow::Maximize() { -} - -void TestWindow::Minimize() { -} - -void TestWindow::Restore() { -} - -void TestWindow::SetCursor(PlatformCursor cursor) { -} - -void TestWindow::MoveCursorTo(const gfx::Point& location) { -} - -void TestWindow::ConfineCursorToBounds(const gfx::Rect& bounds) { -} - -PlatformImeController* TestWindow::GetPlatformImeController() { - return nullptr; -} - -} // namespace ui |