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

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

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 years, 10 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
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 "components/mus/public/cpp/tests/window_server_test_base.h" 5 #include "components/mus/public/cpp/tests/window_server_test_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
11 #include "components/mus/public/cpp/window.h" 11 #include "components/mus/public/cpp/window.h"
12 #include "components/mus/public/cpp/window_tree_connection.h" 12 #include "components/mus/public/cpp/window_tree_connection.h"
13 #include "components/mus/public/cpp/window_tree_host_factory.h" 13 #include "components/mus/public/cpp/window_tree_host_factory.h"
14 #include "mojo/shell/public/cpp/application_impl.h" 14 #include "mojo/shell/public/cpp/shell.h"
15 15
16 namespace mus { 16 namespace mus {
17 namespace { 17 namespace {
18 18
19 base::RunLoop* current_run_loop = nullptr; 19 base::RunLoop* current_run_loop = nullptr;
20 20
21 void TimeoutRunLoop(const base::Closure& timeout_task, bool* timeout) { 21 void TimeoutRunLoop(const base::Closure& timeout_task, bool* timeout) {
22 CHECK(current_run_loop); 22 CHECK(current_run_loop);
23 *timeout = true; 23 *timeout = true;
24 timeout_task.Run(); 24 timeout_task.Run();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 return false; 58 return false;
59 59
60 current_run_loop->Quit(); 60 current_run_loop->Quit();
61 current_run_loop = nullptr; 61 current_run_loop = nullptr;
62 return true; 62 return true;
63 } 63 }
64 64
65 void WindowServerTestBase::SetUp() { 65 void WindowServerTestBase::SetUp() {
66 ApplicationTestBase::SetUp(); 66 ApplicationTestBase::SetUp();
67 67
68 CreateWindowTreeHost(application_impl(), this, &host_, this); 68 CreateWindowTreeHost(shell(), this, &host_, this);
69 69
70 ASSERT_TRUE(DoRunLoopWithTimeout()); // RunLoop should be quit by OnEmbed(). 70 ASSERT_TRUE(DoRunLoopWithTimeout()); // RunLoop should be quit by OnEmbed().
71 std::swap(window_manager_, most_recent_connection_); 71 std::swap(window_manager_, most_recent_connection_);
72 } 72 }
73 73
74 mojo::ApplicationDelegate* WindowServerTestBase::GetApplicationDelegate() { 74 mojo::ApplicationDelegate* WindowServerTestBase::GetApplicationDelegate() {
75 return this; 75 return this;
76 } 76 }
77 77
78 bool WindowServerTestBase::AcceptConnection( 78 bool WindowServerTestBase::AcceptConnection(
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 void WindowServerTestBase::Create( 126 void WindowServerTestBase::Create(
127 mojo::ApplicationConnection* connection, 127 mojo::ApplicationConnection* connection,
128 mojo::InterfaceRequest<mojom::WindowTreeClient> request) { 128 mojo::InterfaceRequest<mojom::WindowTreeClient> request) {
129 WindowTreeConnection::Create( 129 WindowTreeConnection::Create(
130 this, std::move(request), 130 this, std::move(request),
131 WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); 131 WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED);
132 } 132 }
133 133
134 } // namespace mus 134 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/public/cpp/lib/window_tree_host_factory.cc ('k') | components/mus/public/cpp/window_tree_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698