Commit 13115867 authored by Mike Wasserman's avatar Mike Wasserman Committed by Commit Bot

services_unittests: remove OzonePlatform shutdown and redundant init.

Remove problematic OzonePlatform::Shutdown method.
(per-process gpu init was torn down with per-fixture aura::Env dtor)

Remove redundant run_all_service_tests GPU init of OzonePatform
(done as needed via WindowServiceTestSetup / GLSurfaceTestSupport)
Remove obsolete WindowTreeClientWmOzoneTest aura_unittests fixture.
Add some gl_factory_ozone.cc failure logging.

Bug: 855191
Test: No regressions, no problems running services_unittests, etc.
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: If798b639e626738e3ba6d4c4a550cf3cc02c70ab
Reviewed-on: https://chromium-review.googlesource.com/1144186
Commit-Queue: Michael Wasserman <msw@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577061}
parent 1f2f8e11
...@@ -37,10 +37,6 @@ source_set("run_all_service_tests") { ...@@ -37,10 +37,6 @@ source_set("run_all_service_tests") {
if (is_android) { if (is_android) {
deps += [ "//mojo/public/java/system:native_support" ] deps += [ "//mojo/public/java/system:native_support" ]
} }
if (use_ozone) {
deps += [ "//ui/ozone" ]
}
} }
bundle_data("tests_bundle_data") { bundle_data("tests_bundle_data") {
......
...@@ -12,16 +12,12 @@ ...@@ -12,16 +12,12 @@
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_paths.h" #include "ui/base/ui_base_paths.h"
#if defined(USE_OZONE)
#include "ui/ozone/public/ozone_platform.h"
#endif
namespace { namespace {
class ServiceTestSuite : public base::TestSuite { class ServiceTestSuite : public base::TestSuite {
public: public:
ServiceTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {} ServiceTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
~ServiceTestSuite() override {} ~ServiceTestSuite() override = default;
protected: protected:
void Initialize() override { void Initialize() override {
...@@ -32,13 +28,6 @@ class ServiceTestSuite : public base::TestSuite { ...@@ -32,13 +28,6 @@ class ServiceTestSuite : public base::TestSuite {
ASSERT_TRUE(base::PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path)); ASSERT_TRUE(base::PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path); ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
#if defined(USE_OZONE)
ui::OzonePlatform::InitParams params;
params.single_process = true;
ui::OzonePlatform::InitializeForGPU(params);
ui::OzonePlatform::GetInstance()->AfterSandboxEntry();
#endif
// base::TestSuite and ViewsInit both try to load icu. That's ok for tests. // base::TestSuite and ViewsInit both try to load icu. That's ok for tests.
base::i18n::AllowMultipleInitializeCallsForTesting(); base::i18n::AllowMultipleInitializeCallsForTesting();
} }
......
...@@ -52,11 +52,6 @@ Env::~Env() { ...@@ -52,11 +52,6 @@ Env::~Env() {
for (EnvObserver& observer : observers_) for (EnvObserver& observer : observers_)
observer.OnWillDestroyEnv(); observer.OnWillDestroyEnv();
#if defined(USE_OZONE)
if (mode_ == Mode::LOCAL)
ui::OzonePlatform::Shutdown();
#endif
DCHECK_EQ(this, lazy_tls_ptr.Pointer()->Get()); DCHECK_EQ(this, lazy_tls_ptr.Pointer()->Get());
lazy_tls_ptr.Pointer()->Set(NULL); lazy_tls_ptr.Pointer()->Set(NULL);
} }
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "ui/aura/mus/window_tree_host_mus.h" #include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/mus/window_tree_host_mus_init_params.h" #include "ui/aura/mus/window_tree_host_mus_init_params.h"
#include "ui/aura/test/aura_mus_test_base.h" #include "ui/aura/test/aura_mus_test_base.h"
#include "ui/aura/test/aura_test_suite.h"
#include "ui/aura/test/mus/test_window_tree.h" #include "ui/aura/test/mus/test_window_tree.h"
#include "ui/aura/test/mus/window_tree_client_private.h" #include "ui/aura/test/mus/window_tree_client_private.h"
#include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/test_window_delegate.h"
...@@ -55,8 +54,6 @@ ...@@ -55,8 +54,6 @@
#include "ui/display/screen.h" #include "ui/display/screen.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
#include "ui/events/platform/platform_event_observer.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/test/test_event_handler.h" #include "ui/events/test/test_event_handler.h"
#include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect.h"
...@@ -2989,84 +2986,4 @@ TEST_F(WindowTreeClientClientTest, ChangeFocusInEmbedRootWindow) { ...@@ -2989,84 +2986,4 @@ TEST_F(WindowTreeClientClientTest, ChangeFocusInEmbedRootWindow) {
window_tree_client()->OnWindowFocused(server_id(embed_root->window())); window_tree_client()->OnWindowFocused(server_id(embed_root->window()));
} }
#if defined(USE_OZONE)
class TestPlatformEventObserver : public ui::PlatformEventObserver {
public:
TestPlatformEventObserver() = default;
~TestPlatformEventObserver() override = default;
int will_process_count() const { return will_process_count_; }
int did_process_count() const { return did_process_count_; }
ui::EventType will_process_type() const { return will_process_type_; }
ui::EventType did_process_type() const { return did_process_type_; }
// PlatformEventObserver:
void WillProcessEvent(const ui::PlatformEvent& event) override {
will_process_count_++;
will_process_type_ = static_cast<const ui::Event*>(event)->type();
}
void DidProcessEvent(const ui::PlatformEvent& event) override {
did_process_count_++;
did_process_type_ = static_cast<const ui::Event*>(event)->type();
}
private:
int will_process_count_ = 0;
int did_process_count_ = 0;
ui::EventType will_process_type_ = ui::ET_UNKNOWN;
ui::EventType did_process_type_ = ui::ET_UNKNOWN;
DISALLOW_COPY_AND_ASSIGN(TestPlatformEventObserver);
};
// Base class that installs a new version of Env configured for Mus in SetUp()
// (and installs a new version of Env configured for Local during TearDown()).
// This is necessary as when Env is created with a Model of Local it installs
// a PlatformEventSource, not the one that WindowTreeClient installs.
class WindowTreeClientWmOzoneTest : public test::AuraMusWmTestBase {
public:
WindowTreeClientWmOzoneTest() = default;
~WindowTreeClientWmOzoneTest() override = default;
// test::AuraMusWmTestBase:
void SetUp() override {
env_reinstaller_ = std::make_unique<test::EnvReinstaller>();
env_ = Env::CreateInstance(Env::Mode::MUS);
AuraMusWmTestBase::SetUp();
}
void TearDown() override {
AuraMusWmTestBase::TearDown();
env_.reset();
env_reinstaller_.reset();
}
private:
std::unique_ptr<test::EnvReinstaller> env_reinstaller_;
std::unique_ptr<Env> env_;
DISALLOW_COPY_AND_ASSIGN(WindowTreeClientWmOzoneTest);
};
// Used to verify PlatformEventSource is correctly wired up in ozone.
TEST_F(WindowTreeClientWmOzoneTest, PlatformEventSourceInstalled) {
ASSERT_TRUE(ui::PlatformEventSource::GetInstance());
TestPlatformEventObserver test_observer;
ui::PlatformEventSource::GetInstance()->AddPlatformEventObserver(
&test_observer);
ui::MouseEvent event(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(),
ui::EventTimeForNow(), ui::EF_NONE, 0);
window_tree_client()->OnWindowInputEvent(1, server_id(root_window()), 0,
ui::Id(), gfx::PointF(),
ui::Event::Clone(event), 0);
ui::PlatformEventSource::GetInstance()->RemovePlatformEventObserver(
&test_observer);
EXPECT_EQ(1, test_observer.will_process_count());
EXPECT_EQ(1, test_observer.did_process_count());
EXPECT_EQ(ui::ET_MOUSE_MOVED, test_observer.will_process_type());
EXPECT_EQ(ui::ET_MOUSE_MOVED, test_observer.did_process_type());
}
#endif
} // namespace aura } // namespace aura
...@@ -50,7 +50,7 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, ...@@ -50,7 +50,7 @@ scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
return stub_context; return stub_context;
} }
default: default:
NOTREACHED(); NOTREACHED() << "Expected Mock or Stub, actual:" << GetGLImplementation();
} }
return nullptr; return nullptr;
} }
...@@ -66,7 +66,7 @@ scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) { ...@@ -66,7 +66,7 @@ scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
case kGLImplementationStubGL: case kGLImplementationStubGL:
return InitializeGLSurface(new GLSurfaceStub()); return InitializeGLSurface(new GLSurfaceStub());
default: default:
NOTREACHED(); NOTREACHED() << "Expected Mock or Stub, actual:" << GetGLImplementation();
} }
return nullptr; return nullptr;
...@@ -99,7 +99,7 @@ scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat( ...@@ -99,7 +99,7 @@ scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat(
case kGLImplementationStubGL: case kGLImplementationStubGL:
return InitializeGLSurface(new GLSurfaceStub); return InitializeGLSurface(new GLSurfaceStub);
default: default:
NOTREACHED(); NOTREACHED() << "Expected Mock or Stub, actual:" << GetGLImplementation();
} }
return nullptr; return nullptr;
...@@ -116,7 +116,7 @@ void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) { ...@@ -116,7 +116,7 @@ void SetDisabledExtensionsPlatform(const std::string& disabled_extensions) {
case kGLImplementationStubGL: case kGLImplementationStubGL:
break; break;
default: default:
NOTREACHED(); NOTREACHED() << "Expected Mock or Stub, actual:" << GetGLImplementation();
} }
} }
...@@ -129,7 +129,7 @@ bool InitializeExtensionSettingsOneOffPlatform() { ...@@ -129,7 +129,7 @@ bool InitializeExtensionSettingsOneOffPlatform() {
case kGLImplementationStubGL: case kGLImplementationStubGL:
return true; return true;
default: default:
NOTREACHED(); NOTREACHED() << "Expected Mock or Stub, actual:" << GetGLImplementation();
return false; return false;
} }
} }
......
...@@ -66,14 +66,6 @@ void OzonePlatform::InitializeForGPU(const InitParams& args) { ...@@ -66,14 +66,6 @@ void OzonePlatform::InitializeForGPU(const InitParams& args) {
std::move(instance_callback.Get()).Run(instance_); std::move(instance_callback.Get()).Run(instance_);
} }
// static
void OzonePlatform::Shutdown() {
base::AutoLock lock(GetOzoneInstanceLock());
auto* tmp = instance_;
instance_ = nullptr;
delete tmp;
}
// static // static
OzonePlatform* OzonePlatform::GetInstance() { OzonePlatform* OzonePlatform::GetInstance() {
base::AutoLock lock(GetOzoneInstanceLock()); base::AutoLock lock(GetOzoneInstanceLock());
......
...@@ -105,10 +105,6 @@ class OZONE_EXPORT OzonePlatform { ...@@ -105,10 +105,6 @@ class OZONE_EXPORT OzonePlatform {
// provided by |args| as with InitalizeForUI. // provided by |args| as with InitalizeForUI.
static void InitializeForGPU(const InitParams& args); static void InitializeForGPU(const InitParams& args);
// Deletes the instance. Does nothing if OzonePlatform has not yet been
// initialized.
static void Shutdown();
static OzonePlatform* GetInstance(); static OzonePlatform* GetInstance();
// Registers a callback to be run when the OzonePlatform is initialized. Note // Registers a callback to be run when the OzonePlatform is initialized. Note
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment