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

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

Issue 2741063002: Setup DiscardableMemory in the ash process (Closed)
Patch Set: Rebase Created 3 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
« no previous file with comments | « no previous file | services/ui/ws/window_manager_client_unittest.cc » ('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 "ash/public/interfaces/constants.mojom.h" 9 #include "ash/public/interfaces/constants.mojom.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 display::Display(1, gfx::Rect(0, 0, 200, 200)), 84 display::Display(1, gfx::Rect(0, 0, 200, 200)),
85 display::DisplayList::Type::PRIMARY); 85 display::DisplayList::Type::PRIMARY);
86 display::Screen::SetScreenInstance(&screen); 86 display::Screen::SetScreenInstance(&screen);
87 87
88 WindowTreeClientDelegate window_tree_delegate; 88 WindowTreeClientDelegate window_tree_delegate;
89 89
90 connector()->Connect(mojom::kServiceName); 90 connector()->Connect(mojom::kServiceName);
91 91
92 // Connect to mus and create a new top level window. The request goes to 92 // Connect to mus and create a new top level window. The request goes to
93 // |ash|, but is async. 93 // |ash|, but is async.
94 aura::WindowTreeClient client(connector(), &window_tree_delegate); 94 aura::WindowTreeClient client(connector(), &window_tree_delegate, nullptr,
95 nullptr, nullptr, false);
95 client.ConnectViaWindowTreeFactory(); 96 client.ConnectViaWindowTreeFactory();
96 aura::test::EnvTestHelper().SetWindowTreeClient(&client); 97 aura::test::EnvTestHelper().SetWindowTreeClient(&client);
97 std::map<std::string, std::vector<uint8_t>> properties; 98 std::map<std::string, std::vector<uint8_t>> properties;
98 properties[ui::mojom::WindowManager::kWindowType_InitProperty] = 99 properties[ui::mojom::WindowManager::kWindowType_InitProperty] =
99 mojo::ConvertTo<std::vector<uint8_t>>( 100 mojo::ConvertTo<std::vector<uint8_t>>(
100 static_cast<int32_t>(ui::mojom::WindowType::WINDOW)); 101 static_cast<int32_t>(ui::mojom::WindowType::WINDOW));
101 aura::WindowTreeHostMus window_tree_host_mus(&client, &properties); 102 aura::WindowTreeHostMus window_tree_host_mus(&client, &properties);
102 window_tree_host_mus.InitHost(); 103 window_tree_host_mus.InitHost();
103 aura::Window* child_window = new aura::Window(nullptr); 104 aura::Window* child_window = new aura::Window(nullptr);
104 child_window->Init(ui::LAYER_NOT_DRAWN); 105 child_window->Init(ui::LAYER_NOT_DRAWN);
105 window_tree_host_mus.window()->AddChild(child_window); 106 window_tree_host_mus.window()->AddChild(child_window);
106 107
107 // Create another WindowTreeClient by way of embedding in 108 // Create another WindowTreeClient by way of embedding in
108 // |child_window|. This blocks until it succeeds. 109 // |child_window|. This blocks until it succeeds.
109 ui::mojom::WindowTreeClientPtr tree_client; 110 ui::mojom::WindowTreeClientPtr tree_client;
110 auto tree_client_request = MakeRequest(&tree_client); 111 auto tree_client_request = MakeRequest(&tree_client);
111 client.Embed(child_window, std::move(tree_client), 0u, base::Bind(&OnEmbed)); 112 client.Embed(child_window, std::move(tree_client), 0u, base::Bind(&OnEmbed));
112 aura::WindowTreeClient child_client(connector(), &window_tree_delegate, 113 aura::WindowTreeClient child_client(connector(), &window_tree_delegate,
113 nullptr, std::move(tree_client_request)); 114 nullptr, std::move(tree_client_request),
115 nullptr, false);
114 window_tree_delegate.WaitForEmbed(); 116 window_tree_delegate.WaitForEmbed();
115 ASSERT_TRUE(!child_client.GetRoots().empty()); 117 ASSERT_TRUE(!child_client.GetRoots().empty());
116 window_tree_delegate.DestroyWindowTreeHost(); 118 window_tree_delegate.DestroyWindowTreeHost();
117 } 119 }
118 120
119 } // namespace mus 121 } // namespace mus
120 } // namespace ash 122 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | services/ui/ws/window_manager_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698