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

Unified Diff: components/exo/test/exo_test_helper.cc

Issue 2562803002: exo: Replace pointer based stylus and replace with touch based stylus (Closed)
Patch Set: updated deps in gn file Created 4 years 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 | « components/exo/test/exo_test_helper.h ('k') | components/exo/touch.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/test/exo_test_helper.cc
diff --git a/components/exo/test/exo_test_helper.cc b/components/exo/test/exo_test_helper.cc
index 4abac957cd3cd7f57710d6ff9bdffccd9560d4e3..4efd5ca5dc08d6964b1b39463e4087c84fec1306 100644
--- a/components/exo/test/exo_test_helper.cc
+++ b/components/exo/test/exo_test_helper.cc
@@ -4,9 +4,17 @@
#include "components/exo/test/exo_test_helper.h"
+#include "ash/aura/wm_window_aura.h"
+#include "ash/common/wm/window_positioner.h"
+#include "ash/common/wm/window_positioning_utils.h"
+#include "ash/public/cpp/shell_window_ids.h"
+#include "components/exo/buffer.h"
+#include "components/exo/shell_surface.h"
+#include "components/exo/surface.h"
#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
#include "ui/aura/env.h"
#include "ui/compositor/compositor.h"
+#include "ui/views/widget/widget.h"
namespace exo {
namespace test {
@@ -14,7 +22,41 @@ namespace test {
////////////////////////////////////////////////////////////////////////////////
// ExoTestHelper, public:
-ExoTestHelper::ExoTestHelper() {}
+ExoTestWindow::ExoTestWindow(std::unique_ptr<gfx::GpuMemoryBuffer> gpu_buffer,
+ bool is_modal) {
+ surface_.reset(new Surface());
+ int container = is_modal ? ash::kShellWindowId_SystemModalContainer
+ : ash::kShellWindowId_DefaultContainer;
+ shell_surface_.reset(new ShellSurface(surface_.get(), nullptr,
+ gfx::Rect(gpu_buffer->GetSize()), true,
+ false, container));
+
+ buffer_.reset(new Buffer(std::move(gpu_buffer)));
+ surface_->Attach(buffer_.get());
+ surface_->Commit();
+
+ ash::wm::CenterWindow(
+ ash::WmWindowAura::Get(shell_surface_->GetWidget()->GetNativeWindow()));
+}
+
+ExoTestWindow::ExoTestWindow(ExoTestWindow&& other) {
+ surface_ = std::move(other.surface_);
+ buffer_ = std::move(other.buffer_);
+ shell_surface_ = std::move(other.shell_surface_);
+}
+
+ExoTestWindow::~ExoTestWindow() {}
+
+gfx::Point ExoTestWindow::origin() {
+ return surface_->window()->GetBoundsInScreen().origin();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// ExoTestHelper, public:
+
+ExoTestHelper::ExoTestHelper() {
+ ash::WindowPositioner::DisableAutoPositioning(true);
+}
ExoTestHelper::~ExoTestHelper() {}
@@ -28,5 +70,12 @@ std::unique_ptr<gfx::GpuMemoryBuffer> ExoTestHelper::CreateGpuMemoryBuffer(
gpu::kNullSurfaceHandle);
}
+ExoTestWindow ExoTestHelper::CreateWindow(int width,
+ int height,
+ bool is_modal) {
+ return ExoTestWindow(CreateGpuMemoryBuffer(gfx::Size(width, height)),
+ is_modal);
+}
+
} // namespace test
} // namespace exo
« no previous file with comments | « components/exo/test/exo_test_helper.h ('k') | components/exo/touch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698