| 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 "mojo/shell/application_manager.h" | 5 #include "mojo/shell/application_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 597 |
| 598 TEST_F(ApplicationManagerTest, TestEndApplicationClosure) { | 598 TEST_F(ApplicationManagerTest, TestEndApplicationClosure) { |
| 599 ClosingApplicationLoader* loader = new ClosingApplicationLoader(); | 599 ClosingApplicationLoader* loader = new ClosingApplicationLoader(); |
| 600 application_manager_->SetLoaderForURL( | 600 application_manager_->SetLoaderForURL( |
| 601 scoped_ptr<ApplicationLoader>(loader), GURL("test:test")); | 601 scoped_ptr<ApplicationLoader>(loader), GURL("test:test")); |
| 602 | 602 |
| 603 bool called = false; | 603 bool called = false; |
| 604 scoped_ptr<ConnectParams> params(new ConnectParams); | 604 scoped_ptr<ConnectParams> params(new ConnectParams); |
| 605 params->set_source(CreateShellIdentity()); | 605 params->set_source(CreateShellIdentity()); |
| 606 params->set_target( | 606 params->set_target( |
| 607 Identity(GURL("test:test"), "", mojom::Connector::kUserRoot, | 607 Identity(GURL("test:test"), "", mojom::Connector::kUserRoot)); |
| 608 GetPermissiveCapabilityFilter())); | |
| 609 application_manager_->SetInstanceQuitCallback( | 608 application_manager_->SetInstanceQuitCallback( |
| 610 base::Bind(&QuitClosure, params->target(), &called)); | 609 base::Bind(&QuitClosure, params->target(), &called)); |
| 611 application_manager_->Connect(std::move(params)); | 610 application_manager_->Connect(std::move(params)); |
| 612 loop_.Run(); | 611 loop_.Run(); |
| 613 EXPECT_TRUE(called); | 612 EXPECT_TRUE(called); |
| 614 } | 613 } |
| 615 | 614 |
| 616 TEST_F(ApplicationManagerTest, SameIdentityShouldNotCauseDuplicateLoad) { | 615 TEST_F(ApplicationManagerTest, SameIdentityShouldNotCauseDuplicateLoad) { |
| 617 // 1 because ApplicationManagerTest connects once at startup. | 616 // 1 because ApplicationManagerTest connects once at startup. |
| 618 EXPECT_EQ(1, test_loader_->num_loads()); | 617 EXPECT_EQ(1, test_loader_->num_loads()); |
| 619 | 618 |
| 620 TestServicePtr test_service; | 619 TestServicePtr test_service; |
| 621 ConnectToInterface(GURL("test:foo"), &test_service); | 620 ConnectToInterface(GURL("test:foo"), &test_service); |
| 622 EXPECT_EQ(2, test_loader_->num_loads()); | 621 EXPECT_EQ(2, test_loader_->num_loads()); |
| 623 | 622 |
| 624 // Exactly the same URL as above. | 623 // Exactly the same URL as above. |
| 625 ConnectToInterface(GURL("test:foo"), &test_service); | 624 ConnectToInterface(GURL("test:foo"), &test_service); |
| 626 EXPECT_EQ(2, test_loader_->num_loads()); | 625 EXPECT_EQ(2, test_loader_->num_loads()); |
| 627 | 626 |
| 628 // A different identity because the domain is different. | 627 // A different identity because the domain is different. |
| 629 ConnectToInterface(GURL("test:bar"), &test_service); | 628 ConnectToInterface(GURL("test:bar"), &test_service); |
| 630 EXPECT_EQ(3, test_loader_->num_loads()); | 629 EXPECT_EQ(3, test_loader_->num_loads()); |
| 631 } | 630 } |
| 632 | 631 |
| 633 } // namespace test | 632 } // namespace test |
| 634 } // namespace shell | 633 } // namespace shell |
| 635 } // namespace mojo | 634 } // namespace mojo |
| OLD | NEW |