| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "components/mus/public/cpp/window.h" | 6 #include "components/mus/public/cpp/window.h" |
| 7 #include "components/mus/public/cpp/window_tree_connection.h" | 7 #include "components/mus/public/cpp/window_tree_connection.h" |
| 8 #include "components/mus/public/cpp/window_tree_delegate.h" | 8 #include "components/mus/public/cpp/window_tree_delegate.h" |
| 9 #include "components/mus/public/interfaces/window_manager.mojom.h" | 9 #include "components/mus/public/interfaces/window_manager.mojom.h" |
| 10 #include "components/mus/public/interfaces/window_tree.mojom.h" | 10 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 // mus::WindowTreeDelegate: | 40 // mus::WindowTreeDelegate: |
| 41 void OnEmbed(mus::Window* root) override {} | 41 void OnEmbed(mus::Window* root) override {} |
| 42 void OnConnectionLost(mus::WindowTreeConnection* connection) override {} | 42 void OnConnectionLost(mus::WindowTreeConnection* connection) override {} |
| 43 | 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(WindowManagerAppTest); | 44 DISALLOW_COPY_AND_ASSIGN(WindowManagerAppTest); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 TEST_F(WindowManagerAppTest, SetPreferredSize) { | 47 TEST_F(WindowManagerAppTest, OpenWindow) { |
| 48 // TODO(beng): right now this only verifies that requests from other | 48 mus::mojom::WindowManagerPtr connection; |
| 49 // connections are blocked. We need to be able to reliably | 49 ConnectToWindowManager(&connection); |
| 50 // configure the size of the window manager's display before we | |
| 51 // can properly validate that centering actually happened. | |
| 52 mus::mojom::WindowManagerPtr connection1, connection2; | |
| 53 ConnectToWindowManager(&connection1); | |
| 54 ConnectToWindowManager(&connection2); | |
| 55 | 50 |
| 56 mus::Window* window_from_connection1 = OpenWindow(connection1.get()); | 51 ASSERT_TRUE(OpenWindow(connection.get())); |
| 57 mus::Window* window_from_connection2 = OpenWindow(connection2.get()); | |
| 58 | |
| 59 bool succeeded = false; | |
| 60 connection1->SetPreferredSize( | |
| 61 window_from_connection1->id(), mojo::Size::New(), | |
| 62 [&succeeded](mus::mojom::WindowManagerErrorCode result) { | |
| 63 succeeded = result == mus::mojom::WINDOW_MANAGER_ERROR_CODE_SUCCESS; | |
| 64 }); | |
| 65 ASSERT_TRUE(connection1.WaitForIncomingResponse()); | |
| 66 EXPECT_TRUE(succeeded); | |
| 67 | |
| 68 succeeded = false; | |
| 69 connection1->SetPreferredSize( | |
| 70 window_from_connection2->id(), mojo::Size::New(), | |
| 71 [&succeeded](mus::mojom::WindowManagerErrorCode result) { | |
| 72 succeeded = result == mus::mojom::WINDOW_MANAGER_ERROR_CODE_SUCCESS; | |
| 73 }); | |
| 74 ASSERT_TRUE(connection1.WaitForIncomingResponse()); | |
| 75 EXPECT_FALSE(succeeded); | |
| 76 } | 52 } |
| OLD | NEW |