OLD | NEW |
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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "mojo/application_manager/application_manager.h" | 7 #include "mojo/application_manager/application_manager.h" |
8 #include "mojo/public/cpp/application/application_delegate.h" | 8 #include "mojo/public/cpp/application/application_delegate.h" |
9 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
10 #include "mojo/public/cpp/application/service_provider_impl.h" | 10 #include "mojo/public/cpp/application/service_provider_impl.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 private: | 197 private: |
198 // Overridden from testing::Test: | 198 // Overridden from testing::Test: |
199 virtual void SetUp() override { | 199 virtual void SetUp() override { |
200 test_helper_.Init(); | 200 test_helper_.Init(); |
201 test_helper_.SetLoaderForURL( | 201 test_helper_.SetLoaderForURL( |
202 scoped_ptr<ApplicationLoader>(new TestApplicationLoader(base::Bind( | 202 scoped_ptr<ApplicationLoader>(new TestApplicationLoader(base::Bind( |
203 &WindowManagerApiTest::OnRootAdded, base::Unretained(this)))), | 203 &WindowManagerApiTest::OnRootAdded, base::Unretained(this)))), |
204 GURL(kTestServiceURL)); | 204 GURL(kTestServiceURL)); |
205 test_helper_.application_manager()->ConnectToService( | 205 test_helper_.application_manager()->ConnectToService( |
206 GURL("mojo:mojo_view_manager"), &view_manager_init_); | 206 GURL("mojo:view_manager"), &view_manager_init_); |
207 ASSERT_TRUE(InitEmbed(view_manager_init_.get(), | 207 ASSERT_TRUE( |
208 "mojo:mojo_core_window_manager")); | 208 InitEmbed(view_manager_init_.get(), "mojo:core_window_manager")); |
209 ConnectToWindowManager(); | 209 ConnectToWindowManager(); |
210 } | 210 } |
211 virtual void TearDown() override {} | 211 virtual void TearDown() override {} |
212 | 212 |
213 void ConnectToWindowManager() { | 213 void ConnectToWindowManager() { |
214 test_helper_.application_manager()->ConnectToService( | 214 test_helper_.application_manager()->ConnectToService( |
215 GURL("mojo:mojo_core_window_manager"), &window_manager_); | 215 GURL("mojo:core_window_manager"), &window_manager_); |
216 base::RunLoop connect_loop; | 216 base::RunLoop connect_loop; |
217 window_manager_client_.reset(new TestWindowManagerClient(&connect_loop)); | 217 window_manager_client_.reset(new TestWindowManagerClient(&connect_loop)); |
218 window_manager_.set_client(window_manager_client()); | 218 window_manager_.set_client(window_manager_client()); |
219 connect_loop.Run(); | 219 connect_loop.Run(); |
220 } | 220 } |
221 | 221 |
222 void OnRootAdded(View* root) { | 222 void OnRootAdded(View* root) { |
223 if (!root_added_callback_.is_null()) | 223 if (!root_added_callback_.is_null()) |
224 root_added_callback_.Run(root); | 224 root_added_callback_.Run(root); |
225 } | 225 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 Id second_window = OpenWindow(); | 270 Id second_window = OpenWindow(); |
271 window_manager_->ActivateWindow(second_window, | 271 window_manager_->ActivateWindow(second_window, |
272 base::Bind(&EmptyResultCallback)); | 272 base::Bind(&EmptyResultCallback)); |
273 ids = WaitForActiveWindowChange(); | 273 ids = WaitForActiveWindowChange(); |
274 EXPECT_EQ(ids.first, first_window); | 274 EXPECT_EQ(ids.first, first_window); |
275 EXPECT_EQ(ids.second, second_window); | 275 EXPECT_EQ(ids.second, second_window); |
276 } | 276 } |
277 | 277 |
278 } // namespace mojo | 278 } // namespace mojo |
OLD | NEW |