Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: content/browser/compositor/software_output_device_ozone_unittest.cc

Issue 729523005: [Ozone] Fix SoftwareOutputDevice tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/compositor/DEPS ('k') | content/content_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/compositor/software_output_device_ozone_unittest.cc
diff --git a/content/browser/compositor/software_output_device_ozone_unittest.cc b/content/browser/compositor/software_output_device_ozone_unittest.cc
index 8b720055d8f91b547f0cc816a036903dd2559db4..9be28d1cf4c9ae34ce24736ffb9c381b22a6f624 100644
--- a/content/browser/compositor/software_output_device_ozone_unittest.cc
+++ b/content/browser/compositor/software_output_device_ozone_unittest.cc
@@ -15,52 +15,37 @@
#include "ui/gfx/skia_util.h"
#include "ui/gfx/vsync_provider.h"
#include "ui/gl/gl_implementation.h"
-#include "ui/ozone/public/surface_factory_ozone.h"
+#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/surface_ozone_canvas.h"
+#include "ui/platform_window/platform_window.h"
+#include "ui/platform_window/platform_window_delegate.h"
namespace {
-class MockSurfaceOzone : public ui::SurfaceOzoneCanvas {
+class TestPlatformWindowDelegate : public ui::PlatformWindowDelegate {
public:
- MockSurfaceOzone() {}
- virtual ~MockSurfaceOzone() {}
-
- // ui::SurfaceOzoneCanvas overrides:
- virtual void ResizeCanvas(const gfx::Size& size) override {
- surface_ = skia::AdoptRef(SkSurface::NewRaster(
- SkImageInfo::MakeN32Premul(size.width(), size.height())));
- }
- virtual skia::RefPtr<SkCanvas> GetCanvas() override {
- return skia::SharePtr(surface_->getCanvas());
- }
- virtual void PresentCanvas(const gfx::Rect& damage) override {}
- virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override {
- return scoped_ptr<gfx::VSyncProvider>();
+ TestPlatformWindowDelegate() : widget_(gfx::kNullAcceleratedWidget) {}
+ ~TestPlatformWindowDelegate() override {}
+
+ gfx::AcceleratedWidget GetAcceleratedWidget() const { return widget_; }
+
+ // ui::PlatformWindowDelegate:
+ void OnBoundsChanged(const gfx::Rect& new_bounds) override {}
+ void OnDamageRect(const gfx::Rect& damaged_region) override {}
+ void DispatchEvent(ui::Event* event) override {}
+ void OnCloseRequest() override {}
+ void OnClosed() override {}
+ void OnWindowStateChanged(ui::PlatformWindowState new_state) override {}
+ void OnLostCapture() override {}
+ void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget) override {
+ widget_ = widget;
}
+ void OnActivationChanged(bool active) override {}
private:
- skia::RefPtr<SkSurface> surface_;
-
- DISALLOW_COPY_AND_ASSIGN(MockSurfaceOzone);
-};
-
-class MockSurfaceFactoryOzone : public ui::SurfaceFactoryOzone {
- public:
- MockSurfaceFactoryOzone() {}
- virtual ~MockSurfaceFactoryOzone() {}
-
- virtual bool LoadEGLGLES2Bindings(
- AddGLLibraryCallback add_gl_library,
- SetGLGetProcAddressProcCallback set_gl_get_proc_address) override {
- return false;
- }
- virtual scoped_ptr<ui::SurfaceOzoneCanvas> CreateCanvasForWidget(
- gfx::AcceleratedWidget widget) override {
- return make_scoped_ptr<ui::SurfaceOzoneCanvas>(new MockSurfaceOzone());
- }
+ gfx::AcceleratedWidget widget_;
- private:
- DISALLOW_COPY_AND_ASSIGN(MockSurfaceFactoryOzone);
+ DISALLOW_COPY_AND_ASSIGN(TestPlatformWindowDelegate);
};
} // namespace
@@ -80,7 +65,8 @@ class SoftwareOutputDeviceOzoneTest : public testing::Test {
private:
scoped_ptr<ui::Compositor> compositor_;
scoped_ptr<base::MessageLoop> message_loop_;
- scoped_ptr<ui::SurfaceFactoryOzone> surface_factory_;
+ TestPlatformWindowDelegate window_delegate_;
+ scoped_ptr<ui::PlatformWindow> window_;
DISALLOW_COPY_AND_ASSIGN(SoftwareOutputDeviceOzoneTest);
};
@@ -97,14 +83,12 @@ void SoftwareOutputDeviceOzoneTest::SetUp() {
ui::ContextFactory* context_factory =
ui::InitializeContextFactoryForTests(enable_pixel_output_);
- surface_factory_.reset(new MockSurfaceFactoryOzone());
-
const gfx::Size size(500, 400);
- const gfx::AcceleratedWidget kTestAcceleratedWidget = 1;
- compositor_.reset(
- new ui::Compositor(kTestAcceleratedWidget,
- context_factory,
- base::MessageLoopProxy::current()));
+ window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow(
+ &window_delegate_, gfx::Rect(size));
+ compositor_.reset(new ui::Compositor(window_delegate_.GetAcceleratedWidget(),
+ context_factory,
+ base::MessageLoopProxy::current()));
compositor_->SetScaleAndSize(1.0f, size);
output_device_.reset(new content::SoftwareOutputDeviceOzone(
@@ -115,7 +99,7 @@ void SoftwareOutputDeviceOzoneTest::SetUp() {
void SoftwareOutputDeviceOzoneTest::TearDown() {
output_device_.reset();
compositor_.reset();
- surface_factory_.reset();
+ window_.reset();
ui::TerminateContextFactoryForTests();
}
« no previous file with comments | « content/browser/compositor/DEPS ('k') | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698