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

Side by Side Diff: mojo/shell/tests/lifecycle/lifecycle_unittest.cc

Issue 1775813002: Eliminate CapabilityFilter parameter from CreateInstance, instead reading it from the associated ma… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@41qual
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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/base_paths.h" 5 #include "base/base_paths.h"
6 #include "base/base_switches.h" 6 #include "base/base_switches.h"
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // Generate a token for the child to find and connect to a primordial pipe 196 // Generate a token for the child to find and connect to a primordial pipe
197 // and pass that as well. 197 // and pass that as well.
198 std::string primordial_pipe_token = mojo::edk::GenerateRandomToken(); 198 std::string primordial_pipe_token = mojo::edk::GenerateRandomToken();
199 child_command_line.AppendSwitchASCII(switches::kPrimordialPipeToken, 199 child_command_line.AppendSwitchASCII(switches::kPrimordialPipeToken,
200 primordial_pipe_token); 200 primordial_pipe_token);
201 201
202 // Allocate the pipe locally. 202 // Allocate the pipe locally.
203 mojo::ScopedMessagePipeHandle pipe = 203 mojo::ScopedMessagePipeHandle pipe =
204 mojo::edk::CreateParentMessagePipe(primordial_pipe_token); 204 mojo::edk::CreateParentMessagePipe(primordial_pipe_token);
205 205
206 mojo::shell::mojom::CapabilityFilterPtr filter(
207 mojo::shell::mojom::CapabilityFilter::New());
208 mojo::Array<mojo::String> test_interfaces;
209 test_interfaces.push_back("*");
210 filter->filter.insert("*", std::move(test_interfaces));
211
212 mojo::shell::mojom::ShellPtr shell; 206 mojo::shell::mojom::ShellPtr shell;
213 connector()->ConnectToInterface("mojo:shell", &shell); 207 connector()->ConnectToInterface("mojo:shell", &shell);
214 208
215 mojo::shell::mojom::ShellClientFactoryPtr factory; 209 mojo::shell::mojom::ShellClientFactoryPtr factory;
216 factory.Bind(mojo::InterfacePtrInfo<mojo::shell::mojom::ShellClientFactory>( 210 factory.Bind(mojo::InterfacePtrInfo<mojo::shell::mojom::ShellClientFactory>(
217 std::move(pipe), 0u)); 211 std::move(pipe), 0u));
218 base::RunLoop loop; 212 base::RunLoop loop;
219 mojo::shell::mojom::IdentityPtr target(mojo::shell::mojom::Identity::New()); 213 mojo::Identity target(kTestExeName, mojom::kInheritUserID);
220 target->name = kTestExeName; 214 shell->CreateInstance(std::move(factory),
221 target->user_id = mojom::kInheritUserID; 215 mojo::shell::mojom::Identity::From(target),
222 target->instance = ""; 216 std::move(request),
223 shell->CreateInstance(std::move(factory), std::move(target),
224 std::move(filter), std::move(request),
225 base::Bind(&LifecycleTest::OnConnectionCompleted, 217 base::Bind(&LifecycleTest::OnConnectionCompleted,
226 base::Unretained(this), &loop)); 218 base::Unretained(this), &loop));
227 loop.Run(); 219 loop.Run();
228 220
229 base::LaunchOptions options; 221 base::LaunchOptions options;
230 #if defined(OS_WIN) 222 #if defined(OS_WIN)
231 options.handles_to_inherit = &handle_passing_info; 223 options.handles_to_inherit = &handle_passing_info;
232 #elif defined(OS_POSIX) 224 #elif defined(OS_POSIX)
233 options.fds_to_remap = &handle_passing_info; 225 options.fds_to_remap = &handle_passing_info;
234 #endif 226 #endif
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 loop.Run(); 500 loop.Run();
509 501
510 WaitForInstanceDestruction(); 502 WaitForInstanceDestruction();
511 EXPECT_FALSE(instances()->HasInstanceForName(kTestExeName)); 503 EXPECT_FALSE(instances()->HasInstanceForName(kTestExeName));
512 EXPECT_EQ(0u, instances()->GetNewInstanceCount()); 504 EXPECT_EQ(0u, instances()->GetNewInstanceCount());
513 } 505 }
514 506
515 507
516 } // namespace shell 508 } // namespace shell
517 } // namespace mojo 509 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698