diff --git a/BUILD.gn b/BUILD.gn index b7d2cb1f8c2cd..6755a0cf08c40 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -589,7 +589,7 @@ group("mojo_apptests") { if (is_win || is_linux) { deps += [ "//components/resource_provider:resource_provider_unittests", - "//mash/wm:tests", + "//mash:mash_unittests", "//media/mojo/services:tests", "//ui/views/mus:tests", ] diff --git a/mash/BUILD.gn b/mash/BUILD.gn index f2abd8fb45b45..8d82d0a55f1b0 100644 --- a/mash/BUILD.gn +++ b/mash/BUILD.gn @@ -2,6 +2,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//mojo/public/mojo_application_manifest.gni") import("//testing/test.gni") # Target that builders build. @@ -9,7 +10,7 @@ group("all") { testonly = true deps = [ - ":tests", + ":mash_unittests", "//components/leveldb", "//mash/example", "//mash/init", @@ -20,22 +21,23 @@ group("all") { ] } -group("tests") { - testonly = true - - deps = [ - ":mash_unittests", - "//mash/wm:tests", - ] -} - test("mash_unittests") { deps = [ "//base", - "//base/test:run_all_unittests", "//base/test:test_config", "//base/test:test_support", "//mash/wm:unittests", "//mojo/platform_handle:platform_handle_impl", + "//mojo/shell/background:main", + "//mojo/shell/public/cpp/test:run_all_shelltests", + ] + data_deps = [ + ":unittests_manifest", ] } + +mojo_application_manifest("unittests_manifest") { + type = "exe" + application_name = "mash_unittests" + source = "unittests_manifest.json" +} diff --git a/mash/unittests_manifest.json b/mash/unittests_manifest.json new file mode 100644 index 0000000000000..0f3e63e0df981 --- /dev/null +++ b/mash/unittests_manifest.json @@ -0,0 +1,5 @@ +{ + "name": "exe:mash_unittests", + "display_name": "Mash Unittests", + "capabilities": { "*": ["*"] } +} diff --git a/mash/wm/BUILD.gn b/mash/wm/BUILD.gn index 6548409c0b54a..283de718237de 100644 --- a/mash/wm/BUILD.gn +++ b/mash/wm/BUILD.gn @@ -8,13 +8,6 @@ import("//mojo/public/mojo_application_manifest.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//tools/grit/repack.gni") -group("tests") { - testonly = true - deps = [ - ":apptests", - ] -} - source_set("lib") { sources = [ "accelerator_registrar_impl.cc", @@ -140,50 +133,14 @@ repack("resources") { ] } -mojo_native_application("apptests") { - output_name = "mash_wm_apptests" - testonly = true - - sources = [ - "accelerator_registrar_apptest.cc", - "window_manager_apptest.cc", - ] - - deps = [ - "//base", - "//base/test:test_config", - "//components/mus/public/cpp", - "//components/mus/public/interfaces", - "//mojo/common:common_base", - "//mojo/converters/geometry", - "//mojo/converters/input_events", - "//mojo/shell/public/cpp:sources", - "//mojo/shell/public/cpp:test_support", - "//ui/mojo/geometry:interfaces", - "//ui/mojo/geometry:util", - ] - - data_deps = [ - ":apptest_manifest", - ":wm", - ] - - if (use_x11) { - deps += [ "//tools/xdisplaycheck" ] - } -} - -mojo_application_manifest("apptest_manifest") { - application_name = "mash_wm_apptests" - source = "apptest_manifest.json" -} - source_set("unittests") { testonly = true sources = [ + "accelerator_registrar_unittest.cc", "frame/move_loop_unittest.cc", "layout_manager_unittest.cc", + "window_manager_unittest.cc", ] deps = [ @@ -192,12 +149,14 @@ source_set("unittests") { "//base/test:test_config", "//components/mus/public/cpp", "//components/mus/public/cpp/tests:unittest_support", + "//components/mus/public/interfaces", "//mojo/converters/geometry", "//mojo/converters/input_events", "//mojo/edk/system", "//mojo/gles2", "//mojo/platform_handle", "//mojo/public/cpp/system", + "//mojo/shell/public/cpp:shell_test_support", "//testing/gtest", "//ui/base", "//ui/events", diff --git a/mash/wm/accelerator_registrar_apptest.cc b/mash/wm/accelerator_registrar_unittest.cc similarity index 95% rename from mash/wm/accelerator_registrar_apptest.cc rename to mash/wm/accelerator_registrar_unittest.cc index a16d21059d5c6..fa755bc1d42df 100644 --- a/mash/wm/accelerator_registrar_apptest.cc +++ b/mash/wm/accelerator_registrar_unittest.cc @@ -11,7 +11,7 @@ #include "components/mus/public/cpp/window.h" #include "components/mus/public/interfaces/accelerator_registrar.mojom.h" #include "mojo/public/cpp/bindings/binding.h" -#include "mojo/shell/public/cpp/application_test_base.h" +#include "mojo/shell/public/cpp/shell_test.h" using mus::mojom::AcceleratorHandler; using mus::mojom::AcceleratorHandlerPtr; @@ -65,9 +65,9 @@ class TestAcceleratorHandler : public AcceleratorHandler { DISALLOW_COPY_AND_ASSIGN(TestAcceleratorHandler); }; -class AcceleratorRegistrarTest : public mojo::test::ApplicationTestBase { +class AcceleratorRegistrarTest : public mojo::test::ShellTest { public: - AcceleratorRegistrarTest() {} + AcceleratorRegistrarTest() : mojo::test::ShellTest("exe:mash_unittests") {} ~AcceleratorRegistrarTest() override {} protected: diff --git a/mash/wm/apptest_manifest.json b/mash/wm/apptest_manifest.json deleted file mode 100644 index 02cd859fb5c4c..0000000000000 --- a/mash/wm/apptest_manifest.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "mojo:mash_wm_apptests", - "display_name": "Desktop Window Manager Apptests", - "capabilities": { "*": ["*"] } -} diff --git a/mash/wm/window_manager_apptest.cc b/mash/wm/window_manager_unittest.cc similarity index 87% rename from mash/wm/window_manager_apptest.cc rename to mash/wm/window_manager_unittest.cc index 605b8255ccd7c..5b9e16deaeded 100644 --- a/mash/wm/window_manager_apptest.cc +++ b/mash/wm/window_manager_unittest.cc @@ -11,7 +11,7 @@ #include "components/mus/public/cpp/window_tree_connection.h" #include "components/mus/public/cpp/window_tree_delegate.h" #include "components/mus/public/interfaces/window_tree.mojom.h" -#include "mojo/shell/public/cpp/application_test_base.h" +#include "mojo/shell/public/cpp/shell_test.h" namespace mash { namespace wm { @@ -29,13 +29,20 @@ class WindowTreeDelegateImpl : public mus::WindowTreeDelegate { DISALLOW_COPY_AND_ASSIGN(WindowTreeDelegateImpl); }; -using WindowManagerAppTest = mojo::test::ApplicationTestBase; +class WindowManagerTest : public mojo::test::ShellTest { + public: + WindowManagerTest() : mojo::test::ShellTest("exe:mash_unittests") {} + ~WindowManagerTest() override {} + + private: + DISALLOW_COPY_AND_ASSIGN(WindowManagerTest); +}; void OnEmbed(bool success) { ASSERT_TRUE(success); } -TEST_F(WindowManagerAppTest, OpenWindow) { +TEST_F(WindowManagerTest, OpenWindow) { WindowTreeDelegateImpl window_tree_delegate; // Bring up the the desktop_wm. diff --git a/mojo/tools/data/apptests b/mojo/tools/data/apptests index a3a4940d742bf..8e6ceef804c76 100644 --- a/mojo/tools/data/apptests +++ b/mojo/tools/data/apptests @@ -34,12 +34,6 @@ tests = [ # TODO(msw): Get these tests passing on Android too. http://crbug.com/486220 if config.target_os != config.OS_ANDROID: tests += [ - { - 'test': 'mojo:mash_wm_apptests', - 'type': 'gtest_isolated', - 'args': ['--use-x11-test-config', - '--override-use-gl-with-osmesa-for-tests'] - }, { 'test': 'mojo:media_apptests', 'type': 'gtest_isolated',