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

Side by Side Diff: ui/views/mus/platform_test_helper_mus.cc

Issue 1797153002: Reinstate wait-for-Initialize when Chrome is run in Mash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shell-client
Patch Set: fix views_mus_unittests too Created 4 years, 9 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
« no previous file with comments | « mojo/shell/public/cpp/shell_connection.h ('k') | ui/views/mus/screen_mus.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 "ui/views/test/platform_test_helper.h" 5 #include "ui/views/test/platform_test_helper.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h"
8 #include "mojo/shell/background/background_shell.h" 9 #include "mojo/shell/background/background_shell.h"
9 #include "mojo/shell/background/tests/test_catalog_store.h" 10 #include "mojo/shell/background/tests/test_catalog_store.h"
10 #include "mojo/shell/public/cpp/connector.h" 11 #include "mojo/shell/public/cpp/connector.h"
11 #include "mojo/shell/public/cpp/shell_client.h" 12 #include "mojo/shell/public/cpp/shell_client.h"
12 #include "mojo/shell/public/cpp/shell_connection.h" 13 #include "mojo/shell/public/cpp/shell_connection.h"
13 #include "ui/aura/env.h" 14 #include "ui/aura/env.h"
14 #include "ui/views/mus/window_manager_connection.h" 15 #include "ui/views/mus/window_manager_connection.h"
15 #include "ui/views/views_delegate.h" 16 #include "ui/views/views_delegate.h"
16 17
17 using mojo::shell::BackgroundShell; 18 using mojo::shell::BackgroundShell;
(...skipping 24 matching lines...) Expand all
42 PlatformTestHelperMus() { 43 PlatformTestHelperMus() {
43 background_shell_.reset(new BackgroundShell); 44 background_shell_.reset(new BackgroundShell);
44 scoped_ptr<BackgroundShell::InitParams> init_params( 45 scoped_ptr<BackgroundShell::InitParams> init_params(
45 new BackgroundShell::InitParams); 46 new BackgroundShell::InitParams);
46 init_params->catalog_store = BuildTestCatalogStore(); 47 init_params->catalog_store = BuildTestCatalogStore();
47 background_shell_->Init(std::move(init_params)); 48 background_shell_->Init(std::move(init_params));
48 shell_client_.reset(new DefaultShellClient); 49 shell_client_.reset(new DefaultShellClient);
49 shell_connection_.reset(new mojo::ShellConnection( 50 shell_connection_.reset(new mojo::ShellConnection(
50 shell_client_.get(), 51 shell_client_.get(),
51 background_shell_->CreateShellClientRequest(kTestName))); 52 background_shell_->CreateShellClientRequest(kTestName)));
53
54 // TODO(rockot): Remove this RunLoop. http://crbug.com/594852.
55 base::RunLoop wait_loop;
56 shell_connection_->set_initialize_handler(wait_loop.QuitClosure());
57 wait_loop.Run();
58
52 // ui/views/mus requires a WindowManager running, for now use the desktop 59 // ui/views/mus requires a WindowManager running, for now use the desktop
53 // one. 60 // one.
54 mojo::Connector* connector = shell_connection_->connector(); 61 mojo::Connector* connector = shell_connection_->connector();
55 connector->Connect("mojo:desktop_wm"); 62 connector->Connect("mojo:desktop_wm");
56 WindowManagerConnection::Create(connector); 63 WindowManagerConnection::Create(connector);
57 64
58 // On X we need to reset the ContextFactory before every NativeWidgetMus 65 // On X we need to reset the ContextFactory before every NativeWidgetMus
59 // is created. 66 // is created.
60 // TODO(sad): this is a hack, figure out a better solution. 67 // TODO(sad): this is a hack, figure out a better solution.
61 ViewsDelegate::GetInstance()->set_native_widget_factory(base::Bind( 68 ViewsDelegate::GetInstance()->set_native_widget_factory(base::Bind(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 }; 100 };
94 101
95 } // namespace 102 } // namespace
96 103
97 // static 104 // static
98 scoped_ptr<PlatformTestHelper> PlatformTestHelper::Create() { 105 scoped_ptr<PlatformTestHelper> PlatformTestHelper::Create() {
99 return make_scoped_ptr(new PlatformTestHelperMus); 106 return make_scoped_ptr(new PlatformTestHelperMus);
100 } 107 }
101 108
102 } // namespace views 109 } // namespace views
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/shell_connection.h ('k') | ui/views/mus/screen_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698