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

Side by Side Diff: mojo/shell/tests/application_manager_unittest.cc

Issue 1719193003: Add a user id parameter to connections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 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
OLDNEW
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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 EXPECT_TRUE(c.encountered_error()); 593 EXPECT_TRUE(c.encountered_error());
594 } 594 }
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->SetTargetURL(GURL("test:test")); 603 params->set_source(CreateShellIdentity());
604 params->set_target(
605 Identity(GURL("test:test"), "", mojom::Shell::kUserRoot,
606 GetPermissiveCapabilityFilter()));
604 application_manager_->SetInstanceQuitCallback( 607 application_manager_->SetInstanceQuitCallback(
605 base::Bind(&QuitClosure, params->target(), &called)); 608 base::Bind(&QuitClosure, params->target(), &called));
606 application_manager_->Connect(std::move(params)); 609 application_manager_->Connect(std::move(params));
607 loop_.Run(); 610 loop_.Run();
608 EXPECT_TRUE(called); 611 EXPECT_TRUE(called);
609 } 612 }
610 613
611 TEST_F(ApplicationManagerTest, SameIdentityShouldNotCauseDuplicateLoad) { 614 TEST_F(ApplicationManagerTest, SameIdentityShouldNotCauseDuplicateLoad) {
612 // 1 because ApplicationManagerTest connects once at startup. 615 // 1 because ApplicationManagerTest connects once at startup.
613 EXPECT_EQ(1, test_loader_->num_loads()); 616 EXPECT_EQ(1, test_loader_->num_loads());
614 617
615 TestServicePtr test_service; 618 TestServicePtr test_service;
616 ConnectToInterface(GURL("test:foo"), &test_service); 619 ConnectToInterface(GURL("test:foo"), &test_service);
617 EXPECT_EQ(2, test_loader_->num_loads()); 620 EXPECT_EQ(2, test_loader_->num_loads());
618 621
619 // Exactly the same URL as above. 622 // Exactly the same URL as above.
620 ConnectToInterface(GURL("test:foo"), &test_service); 623 ConnectToInterface(GURL("test:foo"), &test_service);
621 EXPECT_EQ(2, test_loader_->num_loads()); 624 EXPECT_EQ(2, test_loader_->num_loads());
622 625
623 // A different identity because the domain is different. 626 // A different identity because the domain is different.
624 ConnectToInterface(GURL("test:bar"), &test_service); 627 ConnectToInterface(GURL("test:bar"), &test_service);
625 EXPECT_EQ(3, test_loader_->num_loads()); 628 EXPECT_EQ(3, test_loader_->num_loads());
626 } 629 }
627 630
628 } // namespace test 631 } // namespace test
629 } // namespace shell 632 } // namespace shell
630 } // namespace mojo 633 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/tests/application_manager_apptest_target.cc ('k') | mojo/shell/tests/capability_filter_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698