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