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

Unified Diff: mojo/shell/tests/connect/connect_unittest.cc

Issue 1811483003: Remove support for Root identity singletons and rely on the all_users bit to be set. + test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@54login2
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: mojo/shell/tests/connect/connect_unittest.cc
diff --git a/mojo/shell/tests/connect/connect_unittest.cc b/mojo/shell/tests/connect/connect_unittest.cc
index 8dd65cea8555ca22a8d2f5e0b345c9833f731bf5..9cfb0a781b6976a459bb38337207a7e9dd7e54e4 100644
--- a/mojo/shell/tests/connect/connect_unittest.cc
+++ b/mojo/shell/tests/connect/connect_unittest.cc
@@ -352,6 +352,32 @@ TEST_F(ConnectTest, ConnectToClientProcess_Blocked) {
EXPECT_EQ(shell::mojom::ConnectResult::ACCESS_DENIED, result);
}
+// Verifies that a client with the "all_users" capability class can receive
+// connections from clients run as other users.
+TEST_F(ConnectTest, AllUsersSingleton) {
+ // Connect to an instance with an explicitly different user_id.
+ const std::string singleton_userid = base::GenerateGUID();
+ Connector::ConnectParams params(Identity(kTestAppName, singleton_userid));
+ scoped_ptr<Connection> connection = connector()->Connect(&params);
+ {
+ base::RunLoop loop;
+ connection->AddConnectionCompletedClosure(base::Bind(&QuitLoop, &loop));
+ loop.Run();
+ EXPECT_EQ(connection->GetRemoteIdentity().user_id(), singleton_userid);
+ }
+ // This connects using the current client's user_id, but should be bound to
+ // the instance run as |singleton_userid|.
+ scoped_ptr<Connection> inherit_connection =
+ connector()->Connect(kTestAppName);
+ {
+ base::RunLoop loop;
+ inherit_connection->AddConnectionCompletedClosure(
+ base::Bind(&QuitLoop, &loop));
+ loop.Run();
+ EXPECT_EQ(connection->GetRemoteIdentity().user_id(), singleton_userid);
+ }
+}
+
// Tests that we can expose an interface to targets on outbound connections.
TEST_F(ConnectTest, LocalInterface) {
// Connect to a standalone application.
« no previous file with comments | « mojo/shell/tests/connect/connect_test_app_manifest.json ('k') | mojo/shell/tests/connect/connect_unittests_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698