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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "mojo/common/common_type_converters.h" | 13 #include "mojo/common/common_type_converters.h" |
14 #include "mojo/geometry/geometry_type_converters.h" | 14 #include "mojo/geometry/geometry_type_converters.h" |
15 #include "mojo/public/cpp/application/connect.h" | |
16 #include "mojo/public/cpp/bindings/allocation_scope.h" | 15 #include "mojo/public/cpp/bindings/allocation_scope.h" |
17 #include "mojo/public/cpp/environment/environment.h" | 16 #include "mojo/public/cpp/environment/environment.h" |
| 17 #include "mojo/public/cpp/shell/connect.h" |
18 #include "mojo/services/public/cpp/view_manager/util.h" | 18 #include "mojo/services/public/cpp/view_manager/util.h" |
19 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" | 19 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" |
20 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 20 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
21 #include "mojo/shell/shell_test_helper.h" | 21 #include "mojo/shell/shell_test_helper.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
24 | 24 |
25 namespace mojo { | 25 namespace mojo { |
26 | 26 |
27 // TODO(sky): remove this when Darin is done with cleanup. | 27 // TODO(sky): remove this when Darin is done with cleanup. |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); | 369 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); |
370 }; | 370 }; |
371 | 371 |
372 class ViewManagerConnectionTest : public testing::Test { | 372 class ViewManagerConnectionTest : public testing::Test { |
373 public: | 373 public: |
374 ViewManagerConnectionTest() {} | 374 ViewManagerConnectionTest() {} |
375 | 375 |
376 virtual void SetUp() OVERRIDE { | 376 virtual void SetUp() OVERRIDE { |
377 test_helper_.Init(); | 377 test_helper_.Init(); |
378 | 378 |
379 ConnectToService(test_helper_.service_provider(), | 379 ConnectTo(test_helper_.shell(), "mojo:mojo_view_manager", &view_manager_); |
380 "mojo:mojo_view_manager", | |
381 &view_manager_); | |
382 view_manager_.set_client(&client_); | 380 view_manager_.set_client(&client_); |
383 | 381 |
384 client_.WaitForId(); | 382 client_.WaitForId(); |
385 client_.GetAndClearChanges(); | 383 client_.GetAndClearChanges(); |
386 } | 384 } |
387 | 385 |
388 protected: | 386 protected: |
389 // Creates a second connection to the viewmanager. | 387 // Creates a second connection to the viewmanager. |
390 void EstablishSecondConnection() { | 388 void EstablishSecondConnection() { |
391 ConnectToService(test_helper_.service_provider(), | 389 ConnectTo(test_helper_.shell(), "mojo:mojo_view_manager", &view_manager2_); |
392 "mojo:mojo_view_manager", | |
393 &view_manager2_); | |
394 view_manager2_.set_client(&client2_); | 390 view_manager2_.set_client(&client2_); |
395 | 391 |
396 client2_.WaitForId(); | 392 client2_.WaitForId(); |
397 client2_.GetAndClearChanges(); | 393 client2_.GetAndClearChanges(); |
398 } | 394 } |
399 | 395 |
400 void EstablishSecondConnectionWithRoot(TransportNodeId root_id) { | 396 void EstablishSecondConnectionWithRoot(TransportNodeId root_id) { |
401 EstablishSecondConnection(); | 397 EstablishSecondConnection(); |
402 client2_.ClearId(); | 398 client2_.ClearId(); |
403 | 399 |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 ASSERT_EQ(1u, nodes.size()); | 1439 ASSERT_EQ(1u, nodes.size()); |
1444 EXPECT_EQ("node=1,1 parent=null view=null", nodes[0].ToString()); | 1440 EXPECT_EQ("node=1,1 parent=null view=null", nodes[0].ToString()); |
1445 } | 1441 } |
1446 | 1442 |
1447 // TODO(sky): add coverage of test that destroys connections and ensures other | 1443 // TODO(sky): add coverage of test that destroys connections and ensures other |
1448 // connections get deletion notification (or advanced server id). | 1444 // connections get deletion notification (or advanced server id). |
1449 | 1445 |
1450 } // namespace service | 1446 } // namespace service |
1451 } // namespace view_manager | 1447 } // namespace view_manager |
1452 } // namespace mojo | 1448 } // namespace mojo |
OLD | NEW |