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

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

Issue 2471033005: Adds DesktopWindowTreeHostMus (Closed)
Patch Set: fix Created 4 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
Index: ui/aura/test/aura_test_helper.h
diff --git a/ui/aura/test/aura_test_helper.h b/ui/aura/test/aura_test_helper.h
index c04f52c32ac7904690eb6a0f2c12d7ba49875635..2906973936ea42ee2d07500c008992af96c1d0a6 100644
--- a/ui/aura/test/aura_test_helper.h
+++ b/ui/aura/test/aura_test_helper.h
@@ -53,8 +53,15 @@ class AuraTestHelper {
explicit AuraTestHelper(base::MessageLoopForUI* message_loop);
~AuraTestHelper();
- void EnableMus(WindowTreeClientDelegate* window_tree_delegate,
- WindowManagerDelegate* window_manager_delegate);
+ // Makes aura target mus with a mock WindowTree (TestWindowTree). Must be
+ // called before SetUp().
+ void EnableMusWithTestWindowTree(
+ WindowTreeClientDelegate* window_tree_delegate,
+ WindowManagerDelegate* window_manager_delegate);
+
+ // Makes aura target mus with the specified WindowTreeClient. Must be called
+ // before SetUp().
+ void EnableMusWithWindowTreeClient(WindowTreeClient* window_tree_client);
// Creates and initializes (shows and sizes) the RootWindow for use in tests.
void SetUp(ui::ContextFactory* context_factory);
@@ -72,19 +79,39 @@ class AuraTestHelper {
TestScreen* test_screen() { return test_screen_.get(); }
+ // This function only returns a valid value if EnableMusWithTestWindowTree()
+ // was called.
TestWindowTree* window_tree();
+
+ // Returns a WindowTreeClient only if one of the EnableMus functions is
+ // called.
WindowTreeClient* window_tree_client();
client::FocusClient* focus_client() { return focus_client_.get(); }
client::CaptureClient* capture_client();
private:
- Env::WindowPortFactory InitMus();
+ enum class Mode {
+ // Classic aura.
+ LOCAL,
+
+ // Mus with a test WindowTree implementation that does not target the real
+ // service:ui.
+ MUS_CREATE_WINDOW_TREE_CLIENT,
- std::unique_ptr<WindowPort> CreateWindowPortMus(Window* window);
+ // Mus without creating a WindowTree. This is used when the test wants to
+ // create the WindowTreeClient itself. This mode is enabled by way of
+ // EnableMusWithWindowTreeClient().
+ MUS,
+ };
- base::MessageLoopForUI* message_loop_;
- bool use_mus_ = false;
+ // Initializes a WindowTreeClient with a test WindowTree.
+ void InitWindowTreeClient();
+
+ // Factory function for creating the appropriate WindowPort function.
+ std::unique_ptr<WindowPort> CreateWindowPort(Window* window);
+
+ Mode mode_ = Mode::LOCAL;
bool setup_called_;
bool teardown_called_;
std::unique_ptr<TestWindowTreeClientSetup> window_tree_client_setup_;
@@ -99,6 +126,8 @@ class AuraTestHelper {
WindowTreeClientDelegate* window_tree_delegate_ = nullptr;
WindowManagerDelegate* window_manager_delegate_ = nullptr;
+ WindowTreeClient* window_tree_client_ = nullptr;
+
DISALLOW_COPY_AND_ASSIGN(AuraTestHelper);
};

Powered by Google App Engine
This is Rietveld 408576698