diff options
20 files changed, 231 insertions, 144 deletions
@@ -590,7 +590,6 @@ group("mojo_apptests") { deps += [ "//components/filesystem:apptests", "//components/leveldb:apptests", - "//components/mus/ws:tests", "//components/resource_provider:apptests", "//components/resource_provider:resource_provider_unittests", "//mash/wm:tests", @@ -617,6 +616,7 @@ group("gn_only") { if (is_win || is_linux) { deps += [ ":mojo_apptests", + "//components/mus/ws:tests", "//mash:all", "//mojo", ] diff --git a/components/mus/public/cpp/tests/BUILD.gn b/components/mus/public/cpp/tests/BUILD.gn index f89b23f..d0c6a05 100644 --- a/components/mus/public/cpp/tests/BUILD.gn +++ b/components/mus/public/cpp/tests/BUILD.gn @@ -20,6 +20,8 @@ source_set("test_support") { testonly = true sources = [ + "window_server_shelltest_base.cc", + "window_server_shelltest_base.h", "window_server_test_base.cc", "window_server_test_base.h", ] @@ -27,10 +29,13 @@ source_set("test_support") { deps = [ "//base", "//base/test:test_config", + "//components/mus/common:mus_common", "//components/mus/public/cpp", + "//mojo/shell/public/cpp:shell_test_support", "//mojo/shell/public/cpp:sources", "//mojo/shell/public/cpp:test_support", "//testing/gtest", + "//ui/gl", ] } diff --git a/components/mus/public/cpp/tests/window_server_shelltest_base.cc b/components/mus/public/cpp/tests/window_server_shelltest_base.cc new file mode 100644 index 0000000..030c7e0 --- /dev/null +++ b/components/mus/public/cpp/tests/window_server_shelltest_base.cc @@ -0,0 +1,58 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/mus/public/cpp/tests/window_server_shelltest_base.h" + +#include "base/command_line.h" +#include "base/macros.h" +#include "base/memory/scoped_ptr.h" +#include "components/mus/common/args.h" +#include "mojo/shell/public/cpp/shell_client.h" +#include "mojo/shell/public/cpp/shell_test.h" +#include "ui/gl/gl_switches.h" + +namespace mus { + +namespace { + +const char kTestAppName[] = "mojo:mus_ws_unittests_app"; + +class WindowServerShellTestClient : public mojo::test::ShellTestClient { + public: + explicit WindowServerShellTestClient(WindowServerShellTestBase* test) + : ShellTestClient(test), test_(test) {} + ~WindowServerShellTestClient() override {} + + private: + // mojo::test::ShellTestClient: + bool AcceptConnection(mojo::Connection* connection) override { + return test_->AcceptConnection(connection); + } + + WindowServerShellTestBase* test_; + + DISALLOW_COPY_AND_ASSIGN(WindowServerShellTestClient); +}; + +void EnsureCommandLineSwitch(const std::string& name) { + base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); + if (!cmd_line->HasSwitch(name)) + cmd_line->AppendSwitch(name); +} + +} // namespace + +WindowServerShellTestBase::WindowServerShellTestBase() + : ShellTest(kTestAppName) { + EnsureCommandLineSwitch(kUseX11TestConfig); + EnsureCommandLineSwitch(switches::kOverrideUseGLWithOSMesaForTests); +} + +WindowServerShellTestBase::~WindowServerShellTestBase() {} + +scoped_ptr<mojo::ShellClient> WindowServerShellTestBase::CreateShellClient() { + return make_scoped_ptr(new WindowServerShellTestClient(this)); +} + +} // namespace mus diff --git a/components/mus/public/cpp/tests/window_server_shelltest_base.h b/components/mus/public/cpp/tests/window_server_shelltest_base.h new file mode 100644 index 0000000..8fdb19e --- /dev/null +++ b/components/mus/public/cpp/tests/window_server_shelltest_base.h @@ -0,0 +1,31 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_MUS_PUBLIC_CPP_TESTS_WINDOW_SERVER_SHELLTEST_BASE_H_ +#define COMPONENTS_MUS_PUBLIC_CPP_TESTS_WINDOW_SERVER_SHELLTEST_BASE_H_ + +#include "base/macros.h" +#include "mojo/shell/public/cpp/connection.h" +#include "mojo/shell/public/cpp/shell_test.h" + +namespace mus { + +// Base class for all window manager shelltests to perform some common setup. +class WindowServerShellTestBase : public mojo::test::ShellTest { + public: + WindowServerShellTestBase(); + ~WindowServerShellTestBase() override; + + virtual bool AcceptConnection(mojo::Connection* connection) = 0; + + private: + // mojo::test::ShellTest: + scoped_ptr<mojo::ShellClient> CreateShellClient() override; + + DISALLOW_COPY_AND_ASSIGN(WindowServerShellTestBase); +}; + +} // namespace mus + +#endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_WINDOW_SERVER_SHELLTEST_BASE_H_ diff --git a/components/mus/public/cpp/tests/window_server_test_base.cc b/components/mus/public/cpp/tests/window_server_test_base.cc index affbf31..fe7a922 100644 --- a/components/mus/public/cpp/tests/window_server_test_base.cc +++ b/components/mus/public/cpp/tests/window_server_test_base.cc @@ -63,7 +63,7 @@ bool WindowServerTestBase::QuitRunLoop() { } void WindowServerTestBase::SetUp() { - ApplicationTestBase::SetUp(); + WindowServerShellTestBase::SetUp(); CreateWindowTreeHost(connector(), this, &host_, this); @@ -71,10 +71,6 @@ void WindowServerTestBase::SetUp() { std::swap(window_manager_, most_recent_connection_); } -mojo::ShellClient* WindowServerTestBase::GetShellClient() { - return this; -} - bool WindowServerTestBase::AcceptConnection(mojo::Connection* connection) { connection->AddInterface<mojom::WindowTreeClient>(this); return true; diff --git a/components/mus/public/cpp/tests/window_server_test_base.h b/components/mus/public/cpp/tests/window_server_test_base.h index 149fe26..7e04589 100644 --- a/components/mus/public/cpp/tests/window_server_test_base.h +++ b/components/mus/public/cpp/tests/window_server_test_base.h @@ -7,22 +7,21 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" +#include "components/mus/public/cpp/tests/window_server_shelltest_base.h" #include "components/mus/public/cpp/window_manager_delegate.h" #include "components/mus/public/cpp/window_tree_delegate.h" #include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/mus/public/interfaces/window_tree_host.mojom.h" -#include "mojo/shell/public/cpp/application_test_base.h" #include "mojo/shell/public/cpp/interface_factory.h" namespace mus { -// WindowServerTestBase is a base class for use with app tests that use +// WindowServerTestBase is a base class for use with shell tests that use // WindowServer. SetUp() connects to the WindowServer and blocks until OnEmbed() // has been invoked. window_manager() can be used to access the WindowServer // established as part of SetUp(). class WindowServerTestBase - : public mojo::test::ApplicationTestBase, - public mojo::ShellClient, + : public WindowServerShellTestBase, public WindowTreeDelegate, public WindowManagerDelegate, public mojo::InterfaceFactory<mojom::WindowTreeClient> { @@ -62,10 +61,7 @@ class WindowServerTestBase // testing::Test: void SetUp() override; - // test::ApplicationTestBase: - mojo::ShellClient* GetShellClient() override; - - // mojo::ShellClient: + // WindowServerShellTestBase: bool AcceptConnection(mojo::Connection* connection) override; // WindowTreeDelegate: diff --git a/components/mus/ws/BUILD.gn b/components/mus/ws/BUILD.gn index e9f94f0..b2fd280 100644 --- a/components/mus/ws/BUILD.gn +++ b/components/mus/ws/BUILD.gn @@ -132,8 +132,7 @@ source_set("test_support") { group("tests") { testonly = true deps = [ - ":apptests", - ":window_manager_unittests", + ":mus_ws_unittests", ] if (!is_android) { deps += @@ -141,7 +140,7 @@ group("tests") { } } -test("window_manager_unittests") { +test("mus_ws_unittests") { sources = [ "display_unittest.cc", "event_dispatcher_unittest.cc", @@ -157,6 +156,7 @@ test("window_manager_unittests") { "user_display_manager_unittest.cc", "window_coordinate_conversions_unittest.cc", "window_finder_unittest.cc", + "window_manager_client_unittest.cc", "window_tree_unittest.cc", ] @@ -168,66 +168,44 @@ test("window_manager_unittests") { "//cc:cc", "//components/mus/common:mus_common", "//components/mus/public/cpp", + "//components/mus/public/cpp/tests:test_support", "//components/mus/public/interfaces", "//components/mus/surfaces", "//mojo/converters/geometry", "//mojo/converters/input_events", "//mojo/converters/transform", - "//mojo/edk/test:run_all_unittests", "//mojo/gles2", - "//mojo/platform_handle:for_shared_library", + "//mojo/platform_handle:for_component", "//mojo/public/cpp/bindings:bindings", + "//mojo/shell/public/cpp:shell_test_support", + "//mojo/shell/public/cpp:sources", + "//mojo/shell/public/cpp:test_support", + "//mojo/shell/public/cpp/test:run_all_shelltests", "//mojo/shell/public/interfaces", "//testing/gtest", "//ui/events", "//ui/gfx", "//ui/gfx:test_support", "//ui/gfx/geometry", + "//ui/gl", "//ui/mojo/geometry:interfaces", + "//ui/mojo/geometry:util", ] if (!is_android) { # TODO(GYP) Enable on Android when osmesa links. deps += [ "//third_party/mesa:osmesa" ] } -} - -mojo_native_application("apptests") { - output_name = "mus_apptests" - testonly = true - - sources = [ - "window_manager_client_apptest.cc", - "window_tree_apptest.cc", - ] - - deps = [ - ":manifest", - ":test_support", - "//base", - "//base/test:test_config", - "//components/mus/common:mus_common", - "//components/mus/public/cpp", - "//components/mus/public/cpp/tests:test_support", - "//components/mus/public/interfaces", - "//mojo/converters/geometry", - "//mojo/shell/public/cpp:sources", - "//mojo/shell/public/cpp:test_support", - "//ui/gfx:test_support", - "//ui/gfx/geometry", - "//ui/mojo/geometry:interfaces", - "//ui/mojo/geometry:util", - ] - - data_deps = [ - ":lib", - ] if (use_x11) { deps += [ "//tools/xdisplaycheck" ] } + + data_deps = [ + ":mus_ws_unittests_app_manifest", + ] } -mojo_application_manifest("manifest") { - application_name = "mus_apptests" - source = "apptest_manifest.json" +mojo_application_manifest("mus_ws_unittests_app_manifest") { + application_name = "mus_ws_unittests_app" + source = "mus_ws_unittests_app_manifest.json" } diff --git a/components/mus/ws/apptest_manifest.json b/components/mus/ws/apptest_manifest.json deleted file mode 100644 index 6306189c2..0000000 --- a/components/mus/ws/apptest_manifest.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "mojo:mus_apptests", - "display_name": "Mus Apptests", - "capabilities": { "*": [ "*" ] } -} diff --git a/components/mus/ws/mus_ws_unittests_app_manifest.json b/components/mus/ws/mus_ws_unittests_app_manifest.json new file mode 100644 index 0000000..ad68fd6 --- /dev/null +++ b/components/mus/ws/mus_ws_unittests_app_manifest.json @@ -0,0 +1,5 @@ +{ + "name": "mojo:mus_ws_unittests_app", + "display_name": "Mus Window Server Unittests", + "capabilities": { "*": [ "*" ] } +} diff --git a/components/mus/ws/window_manager_client_apptest.cc b/components/mus/ws/window_manager_client_unittest.cc index fe3cc17..33623de 100644 --- a/components/mus/ws/window_manager_client_apptest.cc +++ b/components/mus/ws/window_manager_client_unittest.cc @@ -16,7 +16,6 @@ #include "components/mus/public/cpp/window_tree_connection_observer.h" #include "components/mus/public/cpp/window_tree_delegate.h" #include "mojo/converters/geometry/geometry_type_converters.h" -#include "mojo/shell/public/cpp/application_test_base.h" #include "ui/gfx/geometry/rect.h" #include "ui/mojo/geometry/geometry_util.h" @@ -845,8 +844,7 @@ TEST_F(WindowServerTest, Activation) { ValidIndexOf(parent->children(), child1)); } -// Very flaky: http://crbug.com/592313. -TEST_F(WindowServerTest, DISABLED_ActivationNext) { +TEST_F(WindowServerTest, ActivationNext) { Window* parent = GetFirstWMRoot(); Window* child1 = NewVisibleWindow(parent, window_manager()); Window* child2 = NewVisibleWindow(parent, window_manager()); diff --git a/components/mus/ws/window_tree_apptest.cc b/components/mus/ws/window_tree_client_unittest.cc index 8970435..7401a9a 100644 --- a/components/mus/ws/window_tree_apptest.cc +++ b/components/mus/ws/window_tree_client_unittest.cc @@ -10,13 +10,14 @@ #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" +#include "components/mus/public/cpp/tests/window_server_shelltest_base.h" #include "components/mus/public/interfaces/window_tree.mojom.h" #include "components/mus/public/interfaces/window_tree_host.mojom.h" #include "components/mus/ws/ids.h" #include "components/mus/ws/test_change_tracker.h" #include "mojo/converters/geometry/geometry_type_converters.h" #include "mojo/public/cpp/bindings/associated_binding.h" -#include "mojo/shell/public/cpp/application_test_base.h" +#include "mojo/shell/public/cpp/shell_test.h" using mojo::Array; using mojo::Callback; @@ -472,12 +473,12 @@ class WindowTreeClientFactory } // namespace -class WindowTreeAppTest : public mojo::test::ApplicationTestBase, - public mojo::ShellClient { +class WindowTreeClientTest : public WindowServerShellTestBase { public: - WindowTreeAppTest() + WindowTreeClientTest() : connection_id_1_(0), connection_id_2_(0), root_window_id_(0) {} - ~WindowTreeAppTest() override {} + + ~WindowTreeClientTest() override {} protected: // Returns the changes from the various connections. @@ -567,12 +568,17 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase, return client; } - // ApplicationTestBase: - mojo::ShellClient* GetShellClient() override { return this; } + // WindowServerShellTestBase: + bool AcceptConnection(mojo::Connection* connection) override { + connection->AddInterface(client_factory_.get()); + return true; + } + void SetUp() override { - ApplicationTestBase::SetUp(); client_factory_.reset(new WindowTreeClientFactory()); + WindowServerShellTestBase::SetUp(); + mojom::WindowTreeHostFactoryPtr factory; connector()->ConnectToInterface("mojo:mus", &factory); @@ -599,12 +605,6 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase, changes1()->clear(); } - // mojo::ShellClient implementation. - bool AcceptConnection(Connection* connection) override { - connection->AddInterface(client_factory_.get()); - return true; - } - scoped_ptr<TestWindowTreeClientImpl> wt_client1_; scoped_ptr<TestWindowTreeClientImpl> wt_client2_; scoped_ptr<TestWindowTreeClientImpl> wt_client3_; @@ -617,11 +617,11 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase, int connection_id_2_; Id root_window_id_; - DISALLOW_COPY_AND_ASSIGN(WindowTreeAppTest); + DISALLOW_COPY_AND_ASSIGN(WindowTreeClientTest); }; // Verifies two clients/connections get different ids. -TEST_F(WindowTreeAppTest, TwoClientsGetDifferentConnectionIds) { +TEST_F(WindowTreeClientTest, TwoClientsGetDifferentConnectionIds) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); ASSERT_EQ(1u, changes2()->size()); @@ -629,7 +629,7 @@ TEST_F(WindowTreeAppTest, TwoClientsGetDifferentConnectionIds) { } // Verifies when Embed() is invoked any child windows are removed. -TEST_F(WindowTreeAppTest, WindowsRemovedWhenEmbedding) { +TEST_F(WindowTreeClientTest, WindowsRemovedWhenEmbedding) { // Two windows 1 and 2. 2 is parented to 1. Id window_1_1 = wt_client1()->NewWindow(1); ASSERT_TRUE(window_1_1); @@ -699,7 +699,7 @@ TEST_F(WindowTreeAppTest, WindowsRemovedWhenEmbedding) { // Verifies once Embed() has been invoked the parent connection can't see any // children. -TEST_F(WindowTreeAppTest, CantAccessChildrenOfEmbeddedWindow) { +TEST_F(WindowTreeClientTest, CantAccessChildrenOfEmbeddedWindow) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); @@ -748,7 +748,7 @@ TEST_F(WindowTreeAppTest, CantAccessChildrenOfEmbeddedWindow) { } // Verifies once Embed() has been invoked the parent can't mutate the children. -TEST_F(WindowTreeAppTest, CantModifyChildrenOfEmbeddedWindow) { +TEST_F(WindowTreeClientTest, CantModifyChildrenOfEmbeddedWindow) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); @@ -773,7 +773,7 @@ TEST_F(WindowTreeAppTest, CantModifyChildrenOfEmbeddedWindow) { } // Verifies client gets a valid id. -TEST_F(WindowTreeAppTest, NewWindow) { +TEST_F(WindowTreeClientTest, NewWindow) { Id window_1_1 = wt_client1()->NewWindow(1); ASSERT_TRUE(window_1_1); EXPECT_TRUE(changes1()->empty()); @@ -789,7 +789,7 @@ TEST_F(WindowTreeAppTest, NewWindow) { } // Verifies AddWindow fails when window is already in position. -TEST_F(WindowTreeAppTest, AddWindowWithNoChange) { +TEST_F(WindowTreeClientTest, AddWindowWithNoChange) { // Create the embed point now so that the ids line up. ASSERT_TRUE(wt_client1()->NewWindow(1)); Id window_1_2 = wt_client1()->NewWindow(2); @@ -807,7 +807,7 @@ TEST_F(WindowTreeAppTest, AddWindowWithNoChange) { } // Verifies AddWindow fails when window is already in position. -TEST_F(WindowTreeAppTest, AddAncestorFails) { +TEST_F(WindowTreeClientTest, AddAncestorFails) { // Create the embed point now so that the ids line up. ASSERT_TRUE(wt_client1()->NewWindow(1)); Id window_1_2 = wt_client1()->NewWindow(2); @@ -825,7 +825,7 @@ TEST_F(WindowTreeAppTest, AddAncestorFails) { } // Verifies adding to root sends right notifications. -TEST_F(WindowTreeAppTest, AddToRoot) { +TEST_F(WindowTreeClientTest, AddToRoot) { // Create the embed point now so that the ids line up. Id window_1_1 = wt_client1()->NewWindow(1); ASSERT_TRUE(window_1_1); @@ -851,7 +851,7 @@ TEST_F(WindowTreeAppTest, AddToRoot) { } // Verifies HierarchyChanged is correctly sent for various adds/removes. -TEST_F(WindowTreeAppTest, WindowHierarchyChangedWindows) { +TEST_F(WindowTreeClientTest, WindowHierarchyChangedWindows) { // Create the embed point now so that the ids line up. Id window_1_1 = wt_client1()->NewWindow(1); // 1,2->1,11. @@ -922,7 +922,7 @@ TEST_F(WindowTreeAppTest, WindowHierarchyChangedWindows) { } } -TEST_F(WindowTreeAppTest, WindowHierarchyChangedAddingKnownToUnknown) { +TEST_F(WindowTreeClientTest, WindowHierarchyChangedAddingKnownToUnknown) { // Create the following structure: root -> 1 -> 11 and 2->21 (2 has no // parent). ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); @@ -970,7 +970,7 @@ TEST_F(WindowTreeAppTest, WindowHierarchyChangedAddingKnownToUnknown) { } } -TEST_F(WindowTreeAppTest, ReorderWindow) { +TEST_F(WindowTreeClientTest, ReorderWindow) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_2_1 = wt_client2()->NewWindow(1); @@ -1043,7 +1043,7 @@ TEST_F(WindowTreeAppTest, ReorderWindow) { } // Verifies DeleteWindow works. -TEST_F(WindowTreeAppTest, DeleteWindow) { +TEST_F(WindowTreeClientTest, DeleteWindow) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); Id window_2_1 = wt_client2()->NewWindow(1); @@ -1073,14 +1073,14 @@ TEST_F(WindowTreeAppTest, DeleteWindow) { } // Verifies DeleteWindow isn't allowed from a separate connection. -TEST_F(WindowTreeAppTest, DeleteWindowFromAnotherConnectionDisallowed) { +TEST_F(WindowTreeClientTest, DeleteWindowFromAnotherConnectionDisallowed) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); EXPECT_FALSE(wt_client2()->DeleteWindow(BuildWindowId(connection_id_1(), 1))); } // Verifies if a window was deleted and then reused that other clients are // properly notified. -TEST_F(WindowTreeAppTest, ReuseDeletedWindowId) { +TEST_F(WindowTreeClientTest, ReuseDeletedWindowId) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); Id window_2_1 = wt_client2()->NewWindow(1); @@ -1125,7 +1125,7 @@ TEST_F(WindowTreeAppTest, ReuseDeletedWindowId) { } // Assertions for GetWindowTree. -TEST_F(WindowTreeAppTest, GetWindowTree) { +TEST_F(WindowTreeClientTest, GetWindowTree) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); @@ -1183,7 +1183,7 @@ TEST_F(WindowTreeAppTest, GetWindowTree) { } } -TEST_F(WindowTreeAppTest, SetWindowBounds) { +TEST_F(WindowTreeClientTest, SetWindowBounds) { Id window_1_1 = wt_client1()->NewWindow(1); ASSERT_TRUE(window_1_1); ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1)); @@ -1211,7 +1211,7 @@ TEST_F(WindowTreeAppTest, SetWindowBounds) { } // Verify AddWindow fails when trying to manipulate windows in other roots. -TEST_F(WindowTreeAppTest, CantMoveWindowsFromOtherRoot) { +TEST_F(WindowTreeClientTest, CantMoveWindowsFromOtherRoot) { // Create 1 and 2 in the first connection. Id window_1_1 = wt_client1()->NewWindow(1); Id window_1_2 = wt_client1()->NewWindow(2); @@ -1231,7 +1231,7 @@ TEST_F(WindowTreeAppTest, CantMoveWindowsFromOtherRoot) { // Verify RemoveWindowFromParent fails for windows that are descendants of the // roots. -TEST_F(WindowTreeAppTest, CantRemoveWindowsInOtherRoots) { +TEST_F(WindowTreeClientTest, CantRemoveWindowsInOtherRoots) { // Create 1 and 2 in the first connection and parent both to the root. Id window_1_1 = wt_client1()->NewWindow(1); Id window_1_2 = wt_client1()->NewWindow(2); @@ -1274,7 +1274,7 @@ TEST_F(WindowTreeAppTest, CantRemoveWindowsInOtherRoots) { } // Verify GetWindowTree fails for windows that are not descendants of the roots. -TEST_F(WindowTreeAppTest, CantGetWindowTreeOfOtherRoots) { +TEST_F(WindowTreeClientTest, CantGetWindowTreeOfOtherRoots) { // Create 1 and 2 in the first connection and parent both to the root. Id window_1_1 = wt_client1()->NewWindow(1); Id window_1_2 = wt_client1()->NewWindow(2); @@ -1303,7 +1303,7 @@ TEST_F(WindowTreeAppTest, CantGetWindowTreeOfOtherRoots) { windows[0].ToString()); } -TEST_F(WindowTreeAppTest, EmbedWithSameWindowId) { +TEST_F(WindowTreeClientTest, EmbedWithSameWindowId) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); changes2()->clear(); @@ -1327,7 +1327,7 @@ TEST_F(WindowTreeAppTest, EmbedWithSameWindowId) { } } -TEST_F(WindowTreeAppTest, EmbedWithSameWindowId2) { +TEST_F(WindowTreeClientTest, EmbedWithSameWindowId2) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); changes2()->clear(); @@ -1398,7 +1398,7 @@ TEST_F(WindowTreeAppTest, EmbedWithSameWindowId2) { } // Assertions for SetWindowVisibility. -TEST_F(WindowTreeAppTest, SetWindowVisibility) { +TEST_F(WindowTreeClientTest, SetWindowVisibility) { // Create 1 and 2 in the first connection and parent both to the root. Id window_1_1 = wt_client1()->NewWindow(1); Id window_1_2 = wt_client1()->NewWindow(2); @@ -1474,7 +1474,7 @@ TEST_F(WindowTreeAppTest, SetWindowVisibility) { } // Test that we hear the cursor change in other connections. -TEST_F(WindowTreeAppTest, SetCursor) { +TEST_F(WindowTreeClientTest, SetCursor) { // Get a second connection to listen in. ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); @@ -1489,7 +1489,7 @@ TEST_F(WindowTreeAppTest, SetCursor) { } // Assertions for SetWindowVisibility sending notifications. -TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) { +TEST_F(WindowTreeClientTest, SetWindowVisibilityNotifications) { // Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root. Id window_1_1 = wt_client1()->NewWindow(1); ASSERT_TRUE(window_1_1); @@ -1581,7 +1581,7 @@ TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) { } } -TEST_F(WindowTreeAppTest, SetWindowProperty) { +TEST_F(WindowTreeClientTest, SetWindowProperty) { Id window_1_1 = wt_client1()->NewWindow(1); ASSERT_TRUE(window_1_1); @@ -1629,7 +1629,7 @@ TEST_F(WindowTreeAppTest, SetWindowProperty) { } } -TEST_F(WindowTreeAppTest, OnEmbeddedAppDisconnected) { +TEST_F(WindowTreeClientTest, OnEmbeddedAppDisconnected) { // Create connection 2 and 3. ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); @@ -1657,7 +1657,7 @@ TEST_F(WindowTreeAppTest, OnEmbeddedAppDisconnected) { // Verifies when the parent of an Embed() is destroyed the embedded app gets // a WindowDeleted (and doesn't trigger a DCHECK). -TEST_F(WindowTreeAppTest, OnParentOfEmbedDisconnects) { +TEST_F(WindowTreeClientTest, OnParentOfEmbedDisconnects) { // Create connection 2 and 3. ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); @@ -1681,7 +1681,7 @@ TEST_F(WindowTreeAppTest, OnParentOfEmbedDisconnects) { // Verifies WindowTreeImpl doesn't incorrectly erase from its internal // map when a window from another connection with the same window_id is removed. -TEST_F(WindowTreeAppTest, DontCleanMapOnDestroy) { +TEST_F(WindowTreeClientTest, DontCleanMapOnDestroy) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); ASSERT_TRUE(wt_client2()->NewWindow(1)); @@ -1696,7 +1696,7 @@ TEST_F(WindowTreeAppTest, DontCleanMapOnDestroy) { } // Verifies Embed() works when supplying a WindowTreeClient. -TEST_F(WindowTreeAppTest, EmbedSupplyingWindowTreeClient) { +TEST_F(WindowTreeClientTest, EmbedSupplyingWindowTreeClient) { ASSERT_TRUE(wt_client1()->NewWindow(1)); TestWindowTreeClientImpl client2; @@ -1709,7 +1709,7 @@ TEST_F(WindowTreeAppTest, EmbedSupplyingWindowTreeClient) { SingleChangeToDescription(*client2.tracker()->changes())); } -TEST_F(WindowTreeAppTest, EmbedFailsFromOtherConnection) { +TEST_F(WindowTreeClientTest, EmbedFailsFromOtherConnection) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); @@ -1729,7 +1729,7 @@ TEST_F(WindowTreeAppTest, EmbedFailsFromOtherConnection) { } // Verifies Embed() from window manager on another connections window works. -TEST_F(WindowTreeAppTest, EmbedFromOtherConnection) { +TEST_F(WindowTreeClientTest, EmbedFromOtherConnection) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); @@ -1746,7 +1746,7 @@ TEST_F(WindowTreeAppTest, EmbedFromOtherConnection) { EXPECT_EQ(std::string(), SingleChangeToDescription(*changes2())); } -TEST_F(WindowTreeAppTest, CantEmbedFromConnectionRoot) { +TEST_F(WindowTreeClientTest, CantEmbedFromConnectionRoot) { // Shouldn't be able to embed into the root. ASSERT_FALSE(EmbedUrl(connector(), wt1(), test_name(), root_window_id())); @@ -1778,7 +1778,7 @@ TEST_F(WindowTreeAppTest, CantEmbedFromConnectionRoot) { } // Verifies that a transient window tracks its parent's lifetime. -TEST_F(WindowTreeAppTest, TransientWindowTracksTransientParentLifetime) { +TEST_F(WindowTreeClientTest, TransientWindowTracksTransientParentLifetime) { ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); Id window_1_1 = BuildWindowId(connection_id_1(), 1); @@ -1823,7 +1823,7 @@ TEST_F(WindowTreeAppTest, TransientWindowTracksTransientParentLifetime) { ChangesToDescription1(*changes1())[1]); } -TEST_F(WindowTreeAppTest, Ids) { +TEST_F(WindowTreeClientTest, Ids) { const Id window_1_100 = wt_client1()->NewWindow(100); ASSERT_TRUE(window_1_100); ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_100)); @@ -1869,7 +1869,7 @@ TEST_F(WindowTreeAppTest, Ids) { // Tests that setting capture fails when no input event has occurred, and there // is no notification of lost capture. -TEST_F(WindowTreeAppTest, ExplicitCaptureWithoutInput) { +TEST_F(WindowTreeClientTest, ExplicitCaptureWithoutInput) { Id window_1_1 = wt_client1()->NewWindow(1); // Add the window to the root, so that they have a Display to handle input @@ -1891,7 +1891,7 @@ TEST_F(WindowTreeAppTest, ExplicitCaptureWithoutInput) { // TODO(jonross): Enable this once apptests can send input events to the server. // Enabling capture requires that the connection be processing events. -TEST_F(WindowTreeAppTest, DISABLED_ExplicitCapturePropagation) { +TEST_F(WindowTreeClientTest, DISABLED_ExplicitCapturePropagation) { Id window_1_1 = wt_client1()->NewWindow(1); Id window_1_2 = wt_client1()->NewWindow(2); diff --git a/mash/wm/BUILD.gn b/mash/wm/BUILD.gn index 935186c..39f95ec 100644 --- a/mash/wm/BUILD.gn +++ b/mash/wm/BUILD.gn @@ -154,7 +154,6 @@ mojo_native_application("apptests") { "//base", "//base/test:test_config", "//components/mus/public/cpp", - "//components/mus/public/cpp/tests:test_support", "//components/mus/public/interfaces", "//mojo/common:common_base", "//mojo/converters/geometry", diff --git a/mojo/shell/public/cpp/test/BUILD.gn b/mojo/shell/public/cpp/test/BUILD.gn new file mode 100644 index 0000000..d074dbc --- /dev/null +++ b/mojo/shell/public/cpp/test/BUILD.gn @@ -0,0 +1,28 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//testing/test.gni") + +group("test") { + testonly = true + deps = [ + ":run_all_shelltests", + ] +} + +source_set("run_all_shelltests") { + testonly = true + + sources = [ + "run_all_shelltests.cc", + ] + + deps = [ + "//base", + "//base/test:test_support", + "//mojo/edk/system", + "//mojo/shell/background:lib", + "//mojo/shell/background:main", + ] +} diff --git a/mojo/shell/tests/mojo_shell_unittests.cc b/mojo/shell/public/cpp/test/run_all_shelltests.cc index 946d9c9..ee19ea2 100644 --- a/mojo/shell/tests/mojo_shell_unittests.cc +++ b/mojo/shell/public/cpp/test/run_all_shelltests.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <signal.h> - #include "base/test/launcher/unit_test_launcher.h" #include "base/test/test_suite.h" #include "mojo/edk/embedder/embedder.h" diff --git a/mojo/shell/tests/BUILD.gn b/mojo/shell/tests/BUILD.gn index 37283ac..91c2970 100644 --- a/mojo/shell/tests/BUILD.gn +++ b/mojo/shell/tests/BUILD.gn @@ -17,7 +17,6 @@ group("tests") { test("mojo_shell_unittests") { sources = [ "loader_unittest.cc", - "mojo_shell_unittests.cc", ] deps = [ @@ -25,6 +24,7 @@ test("mojo_shell_unittests") { "//base", "//base/test:test_support", "//mojo/edk/system", + "//mojo/public/cpp/bindings", "//mojo/public/cpp/system", "//mojo/services/catalog:unittests", "//mojo/shell", @@ -32,6 +32,8 @@ test("mojo_shell_unittests") { "//mojo/shell/background:main", "//mojo/shell/background/tests:unittests", "//mojo/shell/public/cpp", + "//mojo/shell/public/cpp/test:run_all_shelltests", + "//mojo/shell/public/interfaces", "//mojo/shell/tests/connect", "//mojo/shell/tests/lifecycle", "//mojo/shell/tests/shell", diff --git a/mojo/tools/data/apptests b/mojo/tools/data/apptests index 68cef9e..a8f0a35 100644 --- a/mojo/tools/data/apptests +++ b/mojo/tools/data/apptests @@ -21,13 +21,6 @@ # # TODO(vtl|msw): Add a way of specifying data dependencies. -mus_apptests = { 'test': 'mojo:mus_apptests' } -# osmesa is not used on android, so no flags are needed for -# mus_apptests. -if config.target_os != config.OS_ANDROID: - mus_apptests['args'] = [ '--use-x11-test-config', - '--override-use-gl-with-osmesa-for-tests' ] - # WARNING: If you add a test make sure the gn target mojo_apptests depends upon # it. tests = [ @@ -71,16 +64,6 @@ if config.target_os != config.OS_ANDROID: # 'test': 'mojo:media_pipeline_integration_apptests', # 'type': 'gtest_isolated', # }, - # TODO(crbug.com/560626): Fix and enable mus_apptests on Android. - mus_apptests, - # TODO(sky): enable when works (http://crbug.com/577274 and likely - # http://crbug.com/569367). -# { -# 'test': 'mojo:views_apptests', -# 'type': 'gtest_isolated', -# 'args': ['--use-x11-test-config', -# '--override-use-gl-with-osmesa-for-tests', '--enable-logging'] -# }, { 'test': 'mojo:leveldb_apptests', 'type': 'gtest_isolated', diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json index 80a577f..982f1dc 100644 --- a/testing/buildbot/chromium.linux.json +++ b/testing/buildbot/chromium.linux.json @@ -842,6 +842,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "mus_ws_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "nacl_loader_unittests" }, { @@ -932,9 +938,6 @@ "test": "views_unittests" }, { - "test": "window_manager_unittests" - }, - { "swarming": { "can_use_on_swarming_builders": true }, @@ -1241,6 +1244,12 @@ "swarming": { "can_use_on_swarming_builders": true }, + "test": "mus_ws_unittests" + }, + { + "swarming": { + "can_use_on_swarming_builders": true + }, "test": "nacl_loader_unittests" }, { diff --git a/testing/buildbot/chromium.mojo.json b/testing/buildbot/chromium.mojo.json index d3debac..32da10e 100644 --- a/testing/buildbot/chromium.mojo.json +++ b/testing/buildbot/chromium.mojo.json @@ -16,6 +16,9 @@ ], "gtest_tests": [ { + "test": "mus_ws_unittests" + }, + { "test": "views_mus_unittests" } ], @@ -32,6 +35,9 @@ ], "gtest_tests": [ { + "test": "mus_ws_unittests" + }, + { "test": "views_mus_unittests" } ], diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json index cb45f9e..e104989 100644 --- a/testing/buildbot/chromium.win.json +++ b/testing/buildbot/chromium.win.json @@ -1752,13 +1752,13 @@ "test": "mash_unittests" }, { - "test": "resource_provider_unittests" + "test": "mus_ws_unittests" }, { - "test": "ui_touch_selection_unittests" + "test": "resource_provider_unittests" }, { - "test": "window_manager_unittests" + "test": "ui_touch_selection_unittests" } ] }, diff --git a/testing/buildbot/gn_isolate_map.pyl b/testing/buildbot/gn_isolate_map.pyl index 8c95f75..00e2fdd 100644 --- a/testing/buildbot/gn_isolate_map.pyl +++ b/testing/buildbot/gn_isolate_map.pyl @@ -388,6 +388,10 @@ "label": "//mash:mash_unittests", "type": "unknown", }, + "mus_ws_unittests": { + "label": "//components/mus/ws:mus_ws_unittests", + "type": "windowed_test_launcher", + }, "nacl_loader_unittests": { "label": "//components/nacl/loader:nacl_loader_unittests", "type": "raw", @@ -538,10 +542,6 @@ "label": "//third_party/WebKit/Source/web:webkit_unit_tests", "type": "console_test_launcher", }, - "window_manager_unittests": { - "label": "//components/mus/ws:window_manager_unittests", - "type": "unknown", - }, "wm_unittests": { "label": "//ui/wm:wm_unittests", "type": "windowed_test_launcher", |