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

Side by Side Diff: ash/mus/window_manager_unittest.cc

Issue 2694623016: chromeos: Makes AshTestBase/Helper target mash when appropriate (Closed)
Patch Set: feedback Created 3 years, 10 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 | « ash/mus/window_manager_application.h ('k') | ash/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <map> 5 #include <map>
6 #include <memory> 6 #include <memory>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; 59 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_;
60 60
61 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientDelegate); 61 DISALLOW_COPY_AND_ASSIGN(WindowTreeClientDelegate);
62 }; 62 };
63 63
64 class WindowManagerTest : public service_manager::test::ServiceTest { 64 class WindowManagerTest : public service_manager::test::ServiceTest {
65 public: 65 public:
66 WindowManagerTest() : service_manager::test::ServiceTest("mash_unittests") {} 66 WindowManagerTest() : service_manager::test::ServiceTest("mash_unittests") {}
67 ~WindowManagerTest() override {} 67 ~WindowManagerTest() override {}
68 68
69 // service_manager::test::ServiceTest:
70 void SetUp() override {
71 service_manager::test::ServiceTest::SetUp();
72
73 // This test connects to the real mus. This results in
74 // aura::WindowTreeClient resetting the context_factory on Env. As all
75 // tests share the same Env (see mash_test_suite) we need to restore the
76 // context_factory when done.
77 aura::Env* env = aura::Env::GetInstance();
78 initial_context_factory_ = env->context_factory();
79 initial_context_factory_private_ = env->context_factory_private();
80 }
81
82 void TearDown() override {
83 aura::Env* env = aura::Env::GetInstance();
84 env->set_context_factory(initial_context_factory_);
85 env->set_context_factory_private(initial_context_factory_private_);
86 }
87
69 private: 88 private:
89 ui::ContextFactory* initial_context_factory_ = nullptr;
90 ui::ContextFactoryPrivate* initial_context_factory_private_ = nullptr;
91
70 DISALLOW_COPY_AND_ASSIGN(WindowManagerTest); 92 DISALLOW_COPY_AND_ASSIGN(WindowManagerTest);
71 }; 93 };
72 94
73 void OnEmbed(bool success) { 95 void OnEmbed(bool success) {
74 ASSERT_TRUE(success); 96 ASSERT_TRUE(success);
75 } 97 }
76 98
77 TEST_F(WindowManagerTest, OpenWindow) { 99 TEST_F(WindowManagerTest, OpenWindow) {
78 display::ScreenBase screen; 100 display::ScreenBase screen;
79 screen.display_list().AddDisplay( 101 screen.display_list().AddDisplay(
(...skipping 27 matching lines...) Expand all
107 client.Embed(child_window, std::move(tree_client), 0u, base::Bind(&OnEmbed)); 129 client.Embed(child_window, std::move(tree_client), 0u, base::Bind(&OnEmbed));
108 aura::WindowTreeClient child_client(connector(), &window_tree_delegate, 130 aura::WindowTreeClient child_client(connector(), &window_tree_delegate,
109 nullptr, std::move(tree_client_request)); 131 nullptr, std::move(tree_client_request));
110 window_tree_delegate.WaitForEmbed(); 132 window_tree_delegate.WaitForEmbed();
111 ASSERT_TRUE(!child_client.GetRoots().empty()); 133 ASSERT_TRUE(!child_client.GetRoots().empty());
112 window_tree_delegate.DestroyWindowTreeHost(); 134 window_tree_delegate.DestroyWindowTreeHost();
113 } 135 }
114 136
115 } // namespace mus 137 } // namespace mus
116 } // namespace ash 138 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/window_manager_application.h ('k') | ash/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698