diff options
-rw-r--r-- | mojo/shell/background/background_shell.cc | 8 | ||||
-rw-r--r-- | ui/views/mus/BUILD.gn | 5 | ||||
-rw-r--r-- | ui/views/mus/native_widget_mus.cc | 4 | ||||
-rw-r--r-- | ui/views/mus/platform_test_helper_mus.cc | 28 |
4 files changed, 32 insertions, 13 deletions
diff --git a/mojo/shell/background/background_shell.cc b/mojo/shell/background/background_shell.cc index 3ba1203..7afef7a 100644 --- a/mojo/shell/background/background_shell.cc +++ b/mojo/shell/background/background_shell.cc @@ -125,9 +125,11 @@ class BackgroundShell::MojoThread : public base::SimpleThread { context_ = context.get(); scoped_ptr<mojo::shell::Context::InitParams> context_init_params( new mojo::shell::Context::InitParams); - context_init_params->app_catalog = std::move(init_params_->app_catalog); - context_init_params->native_runner_delegate = - init_params_->native_runner_delegate; + if (init_params_) { + context_init_params->app_catalog = std::move(init_params_->app_catalog); + context_init_params->native_runner_delegate = + init_params_->native_runner_delegate; + } context_->Init(std::move(context_init_params)); message_loop_->Run(); diff --git a/ui/views/mus/BUILD.gn b/ui/views/mus/BUILD.gn index 71f251a..c9b0ec3 100644 --- a/ui/views/mus/BUILD.gn +++ b/ui/views/mus/BUILD.gn @@ -145,9 +145,7 @@ test("views_mus_unittests") { sources = [ "../run_all_unittests.cc", "../run_all_unittests.h", - "../widget/native_widget_unittest.cc", - "../widget/root_view_unittest.cc", - "../widget/widget_unittest.cc", + "../view_targeter_unittest.cc", "platform_test_helper_mus.cc", "run_all_unittests_mus.cc", ] @@ -160,6 +158,7 @@ test("views_mus_unittests") { "//cc", "//mojo/shell/background:lib", "//mojo/shell/background:main", + "//mojo/shell/background/tests:test_support", "//mojo/shell/public/cpp:sources", "//mojo/shell/runner/host:lib", "//skia", diff --git a/ui/views/mus/native_widget_mus.cc b/ui/views/mus/native_widget_mus.cc index 3905e17..d485155 100644 --- a/ui/views/mus/native_widget_mus.cc +++ b/ui/views/mus/native_widget_mus.cc @@ -348,6 +348,10 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) { parent_mus->AddTransientWindow(window_); } + // TODO(sky): deal with show state. + if (!params.bounds.size().IsEmpty()) + SetBounds(params.bounds); + // TODO(beng): much else, see [Desktop]NativeWidgetAura. native_widget_delegate_->OnNativeWidgetCreated(false); diff --git a/ui/views/mus/platform_test_helper_mus.cc b/ui/views/mus/platform_test_helper_mus.cc index bc99b4b..918c550 100644 --- a/ui/views/mus/platform_test_helper_mus.cc +++ b/ui/views/mus/platform_test_helper_mus.cc @@ -6,14 +6,19 @@ #include "base/command_line.h" #include "mojo/shell/background/background_shell.h" +#include "mojo/shell/background/tests/test_application_catalog_store.h" #include "mojo/shell/public/cpp/shell_client.h" #include "mojo/shell/public/cpp/shell_connection.h" #include "ui/views/mus/window_manager_connection.h" #include "url/gurl.h" +using mojo::shell::BackgroundShell; + namespace views { namespace { +const char kTestUrl[] = "mojo://test-app"; + class DefaultShellClient : public mojo::ShellClient { public: DefaultShellClient() {} @@ -23,18 +28,27 @@ class DefaultShellClient : public mojo::ShellClient { DISALLOW_COPY_AND_ASSIGN(DefaultShellClient); }; +scoped_ptr<mojo::shell::TestApplicationCatalogStore> +BuildTestApplicationCatalogStore() { + scoped_ptr<base::ListValue> apps(new base::ListValue); + apps->Append( + mojo::shell::BuildPermissiveSerializedAppInfo(GURL(kTestUrl), "test")); + return make_scoped_ptr( + new mojo::shell::TestApplicationCatalogStore(std::move(apps))); +} + class PlatformTestHelperMus : public PlatformTestHelper { public: PlatformTestHelperMus() { - // Force the new edk. - base::CommandLine::ForCurrentProcess()->AppendSwitch("use-new-edk"); - - background_shell_.reset(new mojo::shell::BackgroundShell); - background_shell_->Init(nullptr); + background_shell_.reset(new BackgroundShell); + scoped_ptr<BackgroundShell::InitParams> init_params( + new BackgroundShell::InitParams); + init_params->app_catalog = BuildTestApplicationCatalogStore(); + background_shell_->Init(std::move(init_params)); shell_client_.reset(new DefaultShellClient); shell_connection_.reset(new mojo::ShellConnection( shell_client_.get(), - background_shell_->CreateShellClientRequest(GURL("mojo://test-app")))); + background_shell_->CreateShellClientRequest(GURL(kTestUrl)))); shell_connection_->WaitForInitialize(); // ui/views/mus requires a WindowManager running, for now use the desktop // one. @@ -50,7 +64,7 @@ class PlatformTestHelperMus : public PlatformTestHelper { } private: - scoped_ptr<mojo::shell::BackgroundShell> background_shell_; + scoped_ptr<BackgroundShell> background_shell_; scoped_ptr<mojo::ShellConnection> shell_connection_; scoped_ptr<DefaultShellClient> shell_client_; |