Index: ui/aura/test/aura_test_base.cc |
diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc |
index da5bd43223459f176d29b7324785fd8e610ef41b..2de0e7712efef7b93dd2db8cb3278fd468898f9b 100644 |
--- a/ui/aura/test/aura_test_base.cc |
+++ b/ui/aura/test/aura_test_base.cc |
@@ -5,7 +5,8 @@ |
#include "ui/aura/test/aura_test_base.h" |
#include "ui/aura/client/window_parenting_client.h" |
-#include "ui/aura/test/aura_test_helper.h" |
+#include "ui/aura/mus/property_converter.h" |
+#include "ui/aura/mus/window_tree_client.h" |
#include "ui/aura/test/test_window_delegate.h" |
#include "ui/aura/window.h" |
#include "ui/base/ime/input_method_initializer.h" |
@@ -18,11 +19,39 @@ |
namespace aura { |
namespace test { |
+namespace { |
+ |
+class TestPropertyConverter : public PropertyConverter { |
+ public: |
+ TestPropertyConverter() {} |
+ ~TestPropertyConverter() override {} |
+ |
+ // PropertyConverter: |
+ bool ConvertPropertyForTransport( |
+ Window* window, |
+ const void* key, |
+ std::string* server_property_name, |
+ std::unique_ptr<std::vector<uint8_t>>* server_property_value) override { |
+ return false; |
+ } |
+ |
+ std::string GetTransportNameForPropertyKey(const void* key) override { |
+ return std::string(); |
+ } |
+ |
+ void SetPropertyFromTransportValue( |
+ Window* window, |
+ const std::string& server_property_name, |
+ const std::vector<uint8_t>* data) override {} |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(TestPropertyConverter); |
+}; |
+ |
+} // namespace |
AuraTestBase::AuraTestBase() |
- : setup_called_(false), |
- teardown_called_(false) { |
-} |
+ : window_manager_delegate_(this), window_tree_client_delegate_(this) {} |
AuraTestBase::~AuraTestBase() { |
CHECK(setup_called_) |
@@ -34,6 +63,8 @@ AuraTestBase::~AuraTestBase() { |
void AuraTestBase::SetUp() { |
setup_called_ = true; |
testing::Test::SetUp(); |
+ if (!property_converter_) |
+ property_converter_ = base::MakeUnique<TestPropertyConverter>(); |
// ContentTestSuiteBase might have already initialized |
// MaterialDesignController in unit_tests suite. |
ui::test::MaterialDesignControllerTestAPI::Uninitialize(); |
@@ -78,6 +109,8 @@ void AuraTestBase::SetUp() { |
ui::InitializeContextFactoryForTests(enable_pixel_output); |
helper_.reset(new AuraTestHelper(&message_loop_)); |
+ if (use_mus_) |
+ helper_->EnableMus(window_tree_client_delegate_, window_manager_delegate_); |
helper_->SetUp(context_factory); |
} |
@@ -107,6 +140,11 @@ Window* AuraTestBase::CreateNormalWindow(int id, Window* parent, |
return window; |
} |
+void AuraTestBase::EnableMus() { |
+ DCHECK(!setup_called_); |
+ use_mus_ = true; |
+} |
+ |
void AuraTestBase::RunAllPendingInMessageLoop() { |
helper_->RunAllPendingInMessageLoop(); |
} |
@@ -122,5 +160,79 @@ bool AuraTestBase::DispatchEventUsingWindowDispatcher(ui::Event* event) { |
return event->handled(); |
} |
+ui::mojom::WindowTreeClient* AuraTestBase::window_tree_client() { |
+ return helper_->window_tree_client(); |
+} |
+ |
+void AuraTestBase::SetPropertyConverter( |
+ std::unique_ptr<PropertyConverter> helper) { |
+ property_converter_ = std::move(helper); |
+} |
+ |
+void AuraTestBase::OnEmbed(Window* root) {} |
+ |
+void AuraTestBase::OnUnembed(Window* root) {} |
+ |
+void AuraTestBase::OnEmbedRootDestroyed(Window* root) {} |
+ |
+void AuraTestBase::OnLostConnection(WindowTreeClient* client) {} |
+ |
+void AuraTestBase::OnPointerEventObserved(const ui::PointerEvent& event, |
+ Window* target) {} |
+ |
+void AuraTestBase::SetWindowManagerClient(WindowManagerClient* client) {} |
+ |
+bool AuraTestBase::OnWmSetBounds(Window* window, gfx::Rect* bounds) { |
+ return true; |
+} |
+ |
+bool AuraTestBase::OnWmSetProperty( |
+ Window* window, |
+ const std::string& name, |
+ std::unique_ptr<std::vector<uint8_t>>* new_data) { |
+ return true; |
+} |
+ |
+Window* AuraTestBase::OnWmCreateTopLevelWindow( |
+ std::map<std::string, std::vector<uint8_t>>* properties) { |
+ return new Window(nullptr); |
+} |
+ |
+void AuraTestBase::OnWmClientJankinessChanged( |
+ const std::set<Window*>& client_windows, |
+ bool janky) {} |
+ |
+void AuraTestBase::OnWmNewDisplay(Window* window, |
+ const display::Display& display) {} |
+ |
+void AuraTestBase::OnWmDisplayRemoved(Window* window) {} |
+ |
+void AuraTestBase::OnWmDisplayModified(const display::Display& display) {} |
+ |
+ui::mojom::EventResult AuraTestBase::OnAccelerator(uint32_t id, |
+ const ui::Event& event) { |
+ return ui::mojom::EventResult::HANDLED; |
+} |
+ |
+void AuraTestBase::OnWmPerformMoveLoop( |
+ Window* window, |
+ ui::mojom::MoveLoopSource source, |
+ const gfx::Point& cursor_location, |
+ const base::Callback<void(bool)>& on_done) {} |
+ |
+void AuraTestBase::OnWmCancelMoveLoop(Window* window) {} |
+ |
+client::FocusClient* AuraTestBase::GetFocusClient() { |
+ return helper_->focus_client(); |
+} |
+ |
+client::CaptureClient* AuraTestBase::GetCaptureClient() { |
+ return helper_->capture_client(); |
+} |
+ |
+PropertyConverter* AuraTestBase::GetPropertyConverter() { |
+ return property_converter_.get(); |
+} |
+ |
} // namespace test |
} // namespace aura |