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

Side by Side Diff: components/mus/ws/window_tree_apptest.cc

Issue 1743473002: Change Mojo URLs to structured names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@18collapse
Patch Set: . 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 int* connection_id) { 540 int* connection_id) {
541 return EstablishConnectionViaEmbedWithPolicyBitmask( 541 return EstablishConnectionViaEmbedWithPolicyBitmask(
542 owner, root_id, mojom::WindowTree::kAccessPolicyDefault, connection_id); 542 owner, root_id, mojom::WindowTree::kAccessPolicyDefault, connection_id);
543 } 543 }
544 544
545 scoped_ptr<TestWindowTreeClientImpl> 545 scoped_ptr<TestWindowTreeClientImpl>
546 EstablishConnectionViaEmbedWithPolicyBitmask(WindowTree* owner, 546 EstablishConnectionViaEmbedWithPolicyBitmask(WindowTree* owner,
547 Id root_id, 547 Id root_id,
548 uint32_t policy_bitmask, 548 uint32_t policy_bitmask,
549 int* connection_id) { 549 int* connection_id) {
550 if (!EmbedUrl(connector(), owner, test_url(), root_id)) { 550 if (!EmbedUrl(connector(), owner, test_name(), root_id)) {
551 ADD_FAILURE() << "Embed() failed"; 551 ADD_FAILURE() << "Embed() failed";
552 return nullptr; 552 return nullptr;
553 } 553 }
554 scoped_ptr<TestWindowTreeClientImpl> client = 554 scoped_ptr<TestWindowTreeClientImpl> client =
555 client_factory_->WaitForInstance(); 555 client_factory_->WaitForInstance();
556 if (!client.get()) { 556 if (!client.get()) {
557 ADD_FAILURE() << "WaitForInstance failed"; 557 ADD_FAILURE() << "WaitForInstance failed";
558 return nullptr; 558 return nullptr;
559 } 559 }
560 client->WaitForOnEmbed(); 560 client->WaitForOnEmbed();
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1)); 1717 ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
1718 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws2(), window_2_1)); 1718 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws2(), window_2_1));
1719 1719
1720 Id window_3_3 = ws_client3()->NewWindow(3); 1720 Id window_3_3 = ws_client3()->NewWindow(3);
1721 ASSERT_TRUE(window_3_3); 1721 ASSERT_TRUE(window_3_3);
1722 ASSERT_TRUE(ws_client3()->AddWindow(window_2_1, window_3_3)); 1722 ASSERT_TRUE(ws_client3()->AddWindow(window_2_1, window_3_3));
1723 1723
1724 // 2 should not be able to embed in window_3_3 as window_3_3 was not created 1724 // 2 should not be able to embed in window_3_3 as window_3_3 was not created
1725 // by 1725 // by
1726 // 2. 1726 // 2.
1727 EXPECT_FALSE(EmbedUrl(connector(), ws2(), test_url(), window_3_3)); 1727 EXPECT_FALSE(EmbedUrl(connector(), ws2(), test_name(), window_3_3));
1728 } 1728 }
1729 1729
1730 // Verifies Embed() from window manager on another connections window works. 1730 // Verifies Embed() from window manager on another connections window works.
1731 TEST_F(WindowTreeAppTest, EmbedFromOtherConnection) { 1731 TEST_F(WindowTreeAppTest, EmbedFromOtherConnection) {
1732 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); 1732 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
1733 1733
1734 Id window_1_1 = BuildWindowId(connection_id_1(), 1); 1734 Id window_1_1 = BuildWindowId(connection_id_1(), 1);
1735 Id window_2_1 = ws_client2()->NewWindow(1); 1735 Id window_2_1 = ws_client2()->NewWindow(1);
1736 ASSERT_TRUE(window_2_1); 1736 ASSERT_TRUE(window_2_1);
1737 ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1)); 1737 ASSERT_TRUE(ws_client2()->AddWindow(window_1_1, window_2_1));
1738 1738
1739 changes2()->clear(); 1739 changes2()->clear();
1740 1740
1741 // Establish a third connection in window_2_1. 1741 // Establish a third connection in window_2_1.
1742 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws1(), window_2_1)); 1742 ASSERT_NO_FATAL_FAILURE(EstablishThirdConnection(ws1(), window_2_1));
1743 1743
1744 ASSERT_TRUE(ws_client2()->WaitForAllMessages()); 1744 ASSERT_TRUE(ws_client2()->WaitForAllMessages());
1745 EXPECT_EQ(std::string(), SingleChangeToDescription(*changes2())); 1745 EXPECT_EQ(std::string(), SingleChangeToDescription(*changes2()));
1746 } 1746 }
1747 1747
1748 TEST_F(WindowTreeAppTest, CantEmbedFromConnectionRoot) { 1748 TEST_F(WindowTreeAppTest, CantEmbedFromConnectionRoot) {
1749 // Shouldn't be able to embed into the root. 1749 // Shouldn't be able to embed into the root.
1750 ASSERT_FALSE(EmbedUrl(connector(), ws1(), test_url(), root_window_id())); 1750 ASSERT_FALSE(EmbedUrl(connector(), ws1(), test_name(), root_window_id()));
1751 1751
1752 // Even though the call above failed a WindowTreeClient was obtained. We need 1752 // Even though the call above failed a WindowTreeClient was obtained. We need
1753 // to 1753 // to
1754 // wait for it else we throw off the next connect. 1754 // wait for it else we throw off the next connect.
1755 WaitForWindowTreeClient(); 1755 WaitForWindowTreeClient();
1756 1756
1757 // Don't allow a connection to embed into its own root. 1757 // Don't allow a connection to embed into its own root.
1758 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); 1758 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
1759 EXPECT_FALSE(EmbedUrl(connector(), ws2(), test_url(), 1759 EXPECT_FALSE(EmbedUrl(connector(), ws2(), test_name(),
1760 BuildWindowId(connection_id_1(), 1))); 1760 BuildWindowId(connection_id_1(), 1)));
1761 1761
1762 // Need to wait for a WindowTreeClient for same reason as above. 1762 // Need to wait for a WindowTreeClient for same reason as above.
1763 WaitForWindowTreeClient(); 1763 WaitForWindowTreeClient();
1764 1764
1765 Id window_1_2 = ws_client1()->NewWindow(2); 1765 Id window_1_2 = ws_client1()->NewWindow(2);
1766 ASSERT_TRUE(window_1_2); 1766 ASSERT_TRUE(window_1_2);
1767 ASSERT_TRUE( 1767 ASSERT_TRUE(
1768 ws_client1()->AddWindow(BuildWindowId(connection_id_1(), 1), window_1_2)); 1768 ws_client1()->AddWindow(BuildWindowId(connection_id_1(), 1), window_1_2));
1769 ASSERT_TRUE(ws_client3_.get() == nullptr); 1769 ASSERT_TRUE(ws_client3_.get() == nullptr);
1770 ws_client3_ = EstablishConnectionViaEmbedWithPolicyBitmask( 1770 ws_client3_ = EstablishConnectionViaEmbedWithPolicyBitmask(
1771 ws1(), window_1_2, mojom::WindowTree::kAccessPolicyEmbedRoot, nullptr); 1771 ws1(), window_1_2, mojom::WindowTree::kAccessPolicyEmbedRoot, nullptr);
1772 ASSERT_TRUE(ws_client3_.get() != nullptr); 1772 ASSERT_TRUE(ws_client3_.get() != nullptr);
1773 1773
1774 // window_1_2 is ws3's root, so even though v3 is an embed root it should not 1774 // window_1_2 is ws3's root, so even though v3 is an embed root it should not
1775 // be able to Embed into itself. 1775 // be able to Embed into itself.
1776 ASSERT_FALSE(EmbedUrl(connector(), ws3(), test_url(), window_1_2)); 1776 ASSERT_FALSE(EmbedUrl(connector(), ws3(), test_name(), window_1_2));
1777 } 1777 }
1778 1778
1779 // Verifies that a transient window tracks its parent's lifetime. 1779 // Verifies that a transient window tracks its parent's lifetime.
1780 TEST_F(WindowTreeAppTest, TransientWindowTracksTransientParentLifetime) { 1780 TEST_F(WindowTreeAppTest, TransientWindowTracksTransientParentLifetime) {
1781 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); 1781 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
1782 Id window_1_1 = BuildWindowId(connection_id_1(), 1); 1782 Id window_1_1 = BuildWindowId(connection_id_1(), 1);
1783 1783
1784 Id window_2_1 = ws_client2()->NewWindow(1); 1784 Id window_2_1 = ws_client2()->NewWindow(1);
1785 Id window_2_2 = ws_client2()->NewWindow(2); 1785 Id window_2_2 = ws_client2()->NewWindow(2);
1786 Id window_2_3 = ws_client2()->NewWindow(3); 1786 Id window_2_3 = ws_client2()->NewWindow(3);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 // originating connection. 1922 // originating connection.
1923 1923
1924 // TODO(sky): make sure coverage of what was 1924 // TODO(sky): make sure coverage of what was
1925 // WindowManagerTest.SecondEmbedRoot_InitService and 1925 // WindowManagerTest.SecondEmbedRoot_InitService and
1926 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window 1926 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window
1927 // manager 1927 // manager
1928 // tests. 1928 // tests.
1929 1929
1930 } // namespace ws 1930 } // namespace ws
1931 } // namespace mus 1931 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_manager_client_apptest.cc ('k') | components/resource_provider/apptest_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698