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

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

Issue 1843333005: Makes WindowTreeClientTest destroy state in TearDown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change tests only Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // is the client id is not zero, but adding this as rest of code here 589 // is the client id is not zero, but adding this as rest of code here
590 // assumes 1. 590 // assumes 1.
591 ASSERT_GT((*changes1())[0].connection_id, 0); 591 ASSERT_GT((*changes1())[0].connection_id, 0);
592 connection_id_1_ = (*changes1())[0].connection_id; 592 connection_id_1_ = (*changes1())[0].connection_id;
593 ASSERT_FALSE((*changes1())[0].windows.empty()); 593 ASSERT_FALSE((*changes1())[0].windows.empty());
594 root_window_id_ = (*changes1())[0].windows[0].window_id; 594 root_window_id_ = (*changes1())[0].windows[0].window_id;
595 ASSERT_EQ(root_window_id_, wt_client1_->root_window_id()); 595 ASSERT_EQ(root_window_id_, wt_client1_->root_window_id());
596 changes1()->clear(); 596 changes1()->clear();
597 } 597 }
598 598
599 void TearDown() override {
600 // Destroy these before the message loop is destroyed (happens in
601 // WindowServerShellTestBase::TearDown).
602 wt_client1_.reset();
603 wt_client2_.reset();
604 wt_client3_.reset();
605 client_factory_.reset();
606 WindowServerShellTestBase::TearDown();
607 }
608
599 scoped_ptr<TestWindowTreeClientImpl> wt_client1_; 609 scoped_ptr<TestWindowTreeClientImpl> wt_client1_;
600 scoped_ptr<TestWindowTreeClientImpl> wt_client2_; 610 scoped_ptr<TestWindowTreeClientImpl> wt_client2_;
601 scoped_ptr<TestWindowTreeClientImpl> wt_client3_; 611 scoped_ptr<TestWindowTreeClientImpl> wt_client3_;
602 612
603 mojom::WindowTreeHostPtr host_; 613 mojom::WindowTreeHostPtr host_;
604 614
605 private: 615 private:
606 scoped_ptr<WindowTreeClientFactory> client_factory_; 616 scoped_ptr<WindowTreeClientFactory> client_factory_;
607 int connection_id_1_; 617 int connection_id_1_;
608 int connection_id_2_; 618 int connection_id_2_;
609 Id root_window_id_; 619 Id root_window_id_;
610 620
611 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientTest); 621 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientTest);
612 }; 622 };
613 623
614 // Verifies two clients/connections get different ids. 624 // Verifies two clients/connections get different ids.
615 TEST_F(WindowTreeClientTest, TwoClientsGetDifferentConnectionIds) { 625 TEST_F(WindowTreeClientTest, TwoClientsGetDifferentConnectionIds) {
616 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); 626 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true));
617 627
618 ASSERT_EQ(1u, changes2()->size()); 628 ASSERT_EQ(1u, changes2()->size());
619 ASSERT_NE(connection_id_1(), connection_id_2()); 629 ASSERT_NE(connection_id_1(), connection_id_2());
620 } 630 }
621 631
622 // Disabled due to flakes on win8_chromium_ng; see https://crbug.com/598925.
623 #if defined(OS_WIN)
624 #define MAYBE_WindowsRemovedWhenEmbedding \
625 DISABLED_WindowsRemovedWhenEmbedding
626 #else
627 #define MAYBE_WindowsRemovedWhenEmbedding WindowsRemovedWhenEmbedding
628 #endif
629 // Verifies when Embed() is invoked any child windows are removed. 632 // Verifies when Embed() is invoked any child windows are removed.
630 TEST_F(WindowTreeClientTest, MAYBE_WindowsRemovedWhenEmbedding) { 633 TEST_F(WindowTreeClientTest, WindowsRemovedWhenEmbedding) {
631 // Two windows 1 and 2. 2 is parented to 1. 634 // Two windows 1 and 2. 2 is parented to 1.
632 Id window_1_1 = wt_client1()->NewWindow(1); 635 Id window_1_1 = wt_client1()->NewWindow(1);
633 ASSERT_TRUE(window_1_1); 636 ASSERT_TRUE(window_1_1);
634 ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1)); 637 ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
635 638
636 Id window_1_2 = wt_client1()->NewWindow(2); 639 Id window_1_2 = wt_client1()->NewWindow(2);
637 ASSERT_TRUE(window_1_2); 640 ASSERT_TRUE(window_1_2);
638 ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2)); 641 ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2));
639 642
640 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false)); 643 ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(false));
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 1926
1924 // TODO(sky): make sure coverage of what was 1927 // TODO(sky): make sure coverage of what was
1925 // WindowManagerTest.SecondEmbedRoot_InitService and 1928 // WindowManagerTest.SecondEmbedRoot_InitService and
1926 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window 1929 // WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window
1927 // manager 1930 // manager
1928 // tests. 1931 // tests.
1929 1932
1930 } // namespace test 1933 } // namespace test
1931 } // namespace ws 1934 } // namespace ws
1932 } // namespace mus 1935 } // namespace mus
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698