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

Unified Diff: ash/mus/window_manager_unittest.cc

Issue 2235493002: mash: Disable ash_sysui; begin removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Connect to chrome on mash session launch; add missing gn dep. Created 4 years, 4 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 | « ash/mus/window_manager_application.cc ('k') | ash/public/interfaces/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/window_manager_unittest.cc
diff --git a/ash/mus/window_manager_unittest.cc b/ash/mus/window_manager_unittest.cc
index 7e29fee549b3e44cfda8517a0e684ab8ffec1ccf..1e77c8ca35797f57ea096657a8444c59e589108c 100644
--- a/ash/mus/window_manager_unittest.cc
+++ b/ash/mus/window_manager_unittest.cc
@@ -2,15 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <stdint.h>
-
#include <memory>
-#include <utility>
-#include "ash/public/interfaces/user_window_controller.mojom.h"
#include "base/bind.h"
#include "base/macros.h"
-#include "base/run_loop.h"
#include "services/shell/public/cpp/service_test.h"
#include "services/ui/public/cpp/window.h"
#include "services/ui/public/cpp/window_tree_client.h"
@@ -48,69 +43,6 @@ void OnEmbed(bool success) {
ASSERT_TRUE(success);
}
-class TestUserWindowObserver : public mojom::UserWindowObserver {
- public:
- explicit TestUserWindowObserver(shell::Connector* connector)
- : binding_(this), window_count_(0u), expected_window_count_(0u) {
- connector->ConnectToInterface("mojo:ash", &user_window_controller_);
- user_window_controller_->AddUserWindowObserver(
- binding_.CreateInterfacePtrAndBind());
- }
-
- ~TestUserWindowObserver() override {}
-
- bool WaitUntilWindowCountReaches(size_t expected) {
- DCHECK(quit_callback_.is_null());
- if (window_count_ != expected) {
- base::RunLoop loop;
- quit_callback_ = loop.QuitClosure();
- expected_window_count_ = expected;
- loop.Run();
- quit_callback_ = base::Closure();
- }
- return window_count_ == expected;
- }
-
- private:
- void QuitIfNecessary() {
- if (window_count_ == expected_window_count_ && !quit_callback_.is_null())
- quit_callback_.Run();
- }
-
- // mojom::UserWindowObserver:
- void OnUserWindowObserverAdded(
- mojo::Array<mojom::UserWindowPtr> user_windows) override {
- window_count_ = user_windows.size();
- QuitIfNecessary();
- }
-
- void OnUserWindowAdded(mojom::UserWindowPtr user_window) override {
- ++window_count_;
- QuitIfNecessary();
- }
-
- void OnUserWindowRemoved(uint32_t window_id) override {
- ASSERT_TRUE(window_count_);
- --window_count_;
- QuitIfNecessary();
- }
-
- void OnUserWindowTitleChanged(uint32_t window_id,
- const mojo::String& window_title) override {}
- void OnUserWindowFocusChanged(uint32_t window_id, bool has_focus) override {}
- void OnUserWindowAppIconChanged(uint32_t window_id,
- mojo::Array<uint8_t> app_icon) override {}
-
- mojom::UserWindowControllerPtr user_window_controller_;
- mojo::Binding<mojom::UserWindowObserver> binding_;
-
- size_t window_count_;
- size_t expected_window_count_;
- base::Closure quit_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(TestUserWindowObserver);
-};
-
TEST_F(WindowManagerTest, OpenWindow) {
WindowTreeClientDelegate window_tree_delegate;
@@ -138,23 +70,5 @@ TEST_F(WindowManagerTest, OpenWindow) {
ASSERT_TRUE(!child_client->GetRoots().empty());
}
-TEST_F(WindowManagerTest, OpenWindowAndClose) {
- connector()->Connect("mojo:ash");
-
- TestUserWindowObserver observer(connector());
-
- // Connect to mus and create a new top level window.
- WindowTreeClientDelegate window_tree_delegate;
- std::unique_ptr<ui::WindowTreeClient> client(
- new ui::WindowTreeClient(&window_tree_delegate, nullptr, nullptr));
- client->ConnectViaWindowTreeFactory(connector());
- ui::Window* top_level_window = client->NewTopLevelWindow(nullptr);
- ASSERT_TRUE(top_level_window);
-
- observer.WaitUntilWindowCountReaches(1u);
- client.reset();
- observer.WaitUntilWindowCountReaches(0u);
-}
-
} // namespace mus
} // namespace ash
« no previous file with comments | « ash/mus/window_manager_application.cc ('k') | ash/public/interfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698