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

Side by Side Diff: components/mus/public/cpp/tests/test_window_tree_connection_setup.cc

Issue 2018823002: Eliminate WindowTreeConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@connection
Patch Set: . Created 4 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/mus/public/cpp/tests/test_window_tree_connection_setup.h"
6
7 #include "components/mus/public/cpp/lib/window_tree_client_impl.h"
8 #include "components/mus/public/cpp/tests/test_window_tree.h"
9 #include "components/mus/public/cpp/tests/window_tree_client_impl_private.h"
10
11 namespace mus {
12
13 TestWindowTreeConnectionSetup::TestWindowTreeConnectionSetup() {}
14
15 TestWindowTreeConnectionSetup::~TestWindowTreeConnectionSetup() {
16 std::unique_ptr<WindowTreeConnection> window_tree_client =
17 std::move(window_tree_client_);
18 if (window_tree_client)
19 window_tree_client->RemoveObserver(this);
20 }
21
22 void TestWindowTreeConnectionSetup::Init(
23 WindowTreeDelegate* window_tree_delegate,
24 WindowManagerDelegate* window_manager_delegate) {
25 window_tree_.reset(new TestWindowTree);
26 window_tree_client_.reset(new WindowTreeClientImpl(
27 window_tree_delegate, window_manager_delegate, nullptr));
28 static_cast<WindowTreeConnection*>(window_tree_client_.get())
29 ->AddObserver(this);
30 WindowTreeClientImplPrivate(window_tree_client_.get())
31 .OnEmbed(window_tree_.get());
32 }
33
34 WindowTreeConnection* TestWindowTreeConnectionSetup::window_tree_connection() {
35 return window_tree_client_.get();
36 }
37
38 void TestWindowTreeConnectionSetup::OnWillDestroyConnection(
39 mus::WindowTreeConnection* connection) {
40 // See comment in header as to why we do this.
41 window_tree_client_.release();
42 }
43
44 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698