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

Unified Diff: ui/aura/test/aura_test_base.h

Issue 2445163002: Make aura work with mus (Closed)
Patch Set: NON_EXPORTED_BASE_CLASS Created 4 years, 2 months 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 | « ui/aura/test/aura_mus_test_base.cc ('k') | ui/aura/test/aura_test_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/aura_test_base.h
diff --git a/ui/aura/test/aura_test_base.h b/ui/aura/test/aura_test_base.h
index 6ab77f1cd78a07bf7500ac49b72dd660027d36a0..84e72893beca95c876292e57c8cbd5a5ef392450 100644
--- a/ui/aura/test/aura_test_base.h
+++ b/ui/aura/test/aura_test_base.h
@@ -9,16 +9,29 @@
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/aura/mus/window_manager_delegate.h"
+#include "ui/aura/mus/window_tree_client_delegate.h"
#include "ui/aura/test/aura_test_helper.h"
+namespace ui {
+namespace mojom {
+class WindowTreeClient;
+}
+}
+
namespace aura {
class Window;
class WindowDelegate;
+class WindowManagerDelegate;
+class WindowTreeClientDelegate;
+
namespace test {
// A base class for aura unit tests.
// TODO(beng): Instances of this test will create and own a RootWindow.
-class AuraTestBase : public testing::Test {
+class AuraTestBase : public testing::Test,
+ public WindowTreeClientDelegate,
+ public WindowManagerDelegate {
public:
AuraTestBase();
~AuraTestBase() override;
@@ -32,6 +45,19 @@ class AuraTestBase : public testing::Test {
aura::WindowDelegate* delegate);
protected:
+ void set_window_manager_delegate(
+ WindowManagerDelegate* window_manager_delegate) {
+ window_manager_delegate_ = window_manager_delegate;
+ }
+
+ void set_window_tree_client_delegate(
+ WindowTreeClientDelegate* window_tree_client_delegate) {
+ window_tree_client_delegate_ = window_tree_client_delegate;
+ }
+
+ // Turns on mus. Must be called before SetUp().
+ void EnableMus();
+
void RunAllPendingInMessageLoop();
void ParentWindow(Window* window);
@@ -45,10 +71,58 @@ class AuraTestBase : public testing::Test {
ui::EventProcessor* event_processor() { return helper_->event_processor(); }
TestScreen* test_screen() { return helper_->test_screen(); }
+ TestWindowTree* window_tree() { return helper_->window_tree(); }
+ WindowTreeClient* window_tree_client_impl() {
+ return helper_->window_tree_client();
+ }
+ ui::mojom::WindowTreeClient* window_tree_client();
+
+ // Resets the PropertyConverter.
+ void SetPropertyConverter(std::unique_ptr<PropertyConverter> helper);
+
+ // WindowTreeClientDelegate:
+ void OnEmbed(Window* root) override;
+ void OnUnembed(Window* root) override;
+ void OnEmbedRootDestroyed(Window* root) override;
+ void OnLostConnection(WindowTreeClient* client) override;
+ void OnPointerEventObserved(const ui::PointerEvent& event,
+ Window* target) override;
+
+ // WindowManagerDelegate:
+ void SetWindowManagerClient(WindowManagerClient* client) override;
+ bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override;
+ bool OnWmSetProperty(
+ Window* window,
+ const std::string& name,
+ std::unique_ptr<std::vector<uint8_t>>* new_data) override;
+ Window* OnWmCreateTopLevelWindow(
+ std::map<std::string, std::vector<uint8_t>>* properties) override;
+ void OnWmClientJankinessChanged(const std::set<Window*>& client_windows,
+ bool janky) override;
+ void OnWmNewDisplay(Window* window, const display::Display& display) override;
+ void OnWmDisplayRemoved(Window* window) override;
+ void OnWmDisplayModified(const display::Display& display) override;
+ ui::mojom::EventResult OnAccelerator(uint32_t id,
+ const ui::Event& event) override;
+ void OnWmPerformMoveLoop(Window* window,
+ ui::mojom::MoveLoopSource source,
+ const gfx::Point& cursor_location,
+ const base::Callback<void(bool)>& on_done) override;
+ void OnWmCancelMoveLoop(Window* window) override;
+ client::FocusClient* GetFocusClient() override;
+ client::CaptureClient* GetCaptureClient() override;
+ PropertyConverter* GetPropertyConverter() override;
+
private:
- bool setup_called_;
- bool teardown_called_;
+ // Only used for mus. Both are are initialized to this, but may be reset.
+ WindowManagerDelegate* window_manager_delegate_;
+ WindowTreeClientDelegate* window_tree_client_delegate_;
+
+ bool use_mus_ = false;
+ bool setup_called_ = false;
+ bool teardown_called_ = false;
base::MessageLoopForUI message_loop_;
+ std::unique_ptr<PropertyConverter> property_converter_;
std::unique_ptr<AuraTestHelper> helper_;
DISALLOW_COPY_AND_ASSIGN(AuraTestBase);
« no previous file with comments | « ui/aura/test/aura_mus_test_base.cc ('k') | ui/aura/test/aura_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698