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

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

Issue 2390013002: Rename mojo: to service: (Closed)
Patch Set: . Created 4 years, 2 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 <memory> 5 #include <memory>
6 6
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/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/process/process.h" 11 #include "base/process/process.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "services/shell/public/cpp/identity.h" 13 #include "services/shell/public/cpp/identity.h"
14 #include "services/shell/public/cpp/service_test.h" 14 #include "services/shell/public/cpp/service_test.h"
15 #include "services/shell/public/interfaces/service_manager.mojom.h" 15 #include "services/shell/public/interfaces/service_manager.mojom.h"
16 #include "services/shell/tests/lifecycle/lifecycle_unittest.mojom.h" 16 #include "services/shell/tests/lifecycle/lifecycle_unittest.mojom.h"
17 #include "services/shell/tests/util.h" 17 #include "services/shell/tests/util.h"
18 18
19 namespace shell { 19 namespace shell {
20 20
21 namespace { 21 namespace {
22 22
23 const char kTestAppName[] = "mojo:lifecycle_unittest_app"; 23 const char kTestAppName[] = "service:lifecycle_unittest_app";
24 const char kTestParentName[] = "mojo:lifecycle_unittest_parent"; 24 const char kTestParentName[] = "service:lifecycle_unittest_parent";
25 const char kTestExeName[] = "exe:lifecycle_unittest_exe"; 25 const char kTestExeName[] = "exe:lifecycle_unittest_exe";
26 const char kTestPackageName[] = "mojo:lifecycle_unittest_package"; 26 const char kTestPackageName[] = "service:lifecycle_unittest_package";
27 const char kTestPackageAppNameA[] = "mojo:lifecycle_unittest_package_app_a"; 27 const char kTestPackageAppNameA[] = "service:lifecycle_unittest_package_app_a";
28 const char kTestPackageAppNameB[] = "mojo:lifecycle_unittest_package_app_b"; 28 const char kTestPackageAppNameB[] = "service:lifecycle_unittest_package_app_b";
29 const char kTestName[] = "mojo:lifecycle_unittest"; 29 const char kTestName[] = "service:lifecycle_unittest";
30 30
31 void QuitLoop(base::RunLoop* loop) { 31 void QuitLoop(base::RunLoop* loop) {
32 loop->Quit(); 32 loop->Quit();
33 } 33 }
34 34
35 void DecrementCountAndQuitWhenZero(base::RunLoop* loop, size_t* count) { 35 void DecrementCountAndQuitWhenZero(base::RunLoop* loop, size_t* count) {
36 if (!--(*count)) 36 if (!--(*count))
37 loop->Quit(); 37 loop->Quit();
38 } 38 }
39 39
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 184
185 void WaitForInstanceDestruction() { 185 void WaitForInstanceDestruction() {
186 base::RunLoop loop; 186 base::RunLoop loop;
187 instances()->WaitForInstanceDestruction(&loop); 187 instances()->WaitForInstanceDestruction(&loop);
188 loop.Run(); 188 loop.Run();
189 } 189 }
190 190
191 private: 191 private:
192 std::unique_ptr<InstanceState> TrackInstances() { 192 std::unique_ptr<InstanceState> TrackInstances() {
193 mojom::ServiceManagerPtr service_manager; 193 mojom::ServiceManagerPtr service_manager;
194 connector()->ConnectToInterface("mojo:shell", &service_manager); 194 connector()->ConnectToInterface("service:shell", &service_manager);
195 mojom::ServiceManagerListenerPtr listener; 195 mojom::ServiceManagerListenerPtr listener;
196 base::RunLoop loop; 196 base::RunLoop loop;
197 InstanceState* state = new InstanceState(GetProxy(&listener), &loop); 197 InstanceState* state = new InstanceState(GetProxy(&listener), &loop);
198 service_manager->AddListener(std::move(listener)); 198 service_manager->AddListener(std::move(listener));
199 loop.Run(); 199 loop.Run();
200 return base::WrapUnique(state); 200 return base::WrapUnique(state);
201 } 201 }
202 202
203 std::unique_ptr<InstanceState> instances_; 203 std::unique_ptr<InstanceState> instances_;
204 204
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 parent->Quit(); 443 parent->Quit();
444 444
445 // Quitting the parent should cascade-quit the child. 445 // Quitting the parent should cascade-quit the child.
446 WaitForInstanceDestruction(); 446 WaitForInstanceDestruction();
447 EXPECT_EQ(0u, instances()->GetNewInstanceCount()); 447 EXPECT_EQ(0u, instances()->GetNewInstanceCount());
448 EXPECT_FALSE(instances()->HasInstanceForName(kTestParentName)); 448 EXPECT_FALSE(instances()->HasInstanceForName(kTestParentName));
449 EXPECT_FALSE(instances()->HasInstanceForName(kTestAppName)); 449 EXPECT_FALSE(instances()->HasInstanceForName(kTestAppName));
450 } 450 }
451 451
452 } // namespace shell 452 } // namespace shell
OLDNEW
« no previous file with comments | « services/shell/tests/lifecycle/app_manifest.json ('k') | services/shell/tests/lifecycle/lifecycle_unittest_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698