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

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

Issue 2123363002: ShellTest -> ServiceTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « services/shell/tests/lifecycle/BUILD.gn ('k') | services/shell/tests/shell/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/shell_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[] = "mojo:lifecycle_unittest_app";
24 const char kTestParentName[] = "mojo:lifecycle_unittest_parent"; 24 const char kTestParentName[] = "mojo:lifecycle_unittest_parent";
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 // Set when the client wants to wait for this object to track the destruction 120 // Set when the client wants to wait for this object to track the destruction
121 // of an instance before proceeding. 121 // of an instance before proceeding.
122 base::RunLoop* destruction_loop_ = nullptr; 122 base::RunLoop* destruction_loop_ = nullptr;
123 123
124 DISALLOW_COPY_AND_ASSIGN(InstanceState); 124 DISALLOW_COPY_AND_ASSIGN(InstanceState);
125 }; 125 };
126 126
127 } // namespace 127 } // namespace
128 128
129 class LifecycleTest : public test::ShellTest { 129 class LifecycleTest : public test::ServiceTest {
130 public: 130 public:
131 LifecycleTest() : ShellTest(kTestName) {} 131 LifecycleTest() : ServiceTest(kTestName) {}
132 ~LifecycleTest() override {} 132 ~LifecycleTest() override {}
133 133
134 protected: 134 protected:
135 // test::ShellTest: 135 // test::ServiceTest:
136 void SetUp() override { 136 void SetUp() override {
137 test::ShellTest::SetUp(); 137 test::ServiceTest::SetUp();
138 InitPackage(); 138 InitPackage();
139 instances_ = TrackInstances(); 139 instances_ = TrackInstances();
140 } 140 }
141 void TearDown() override { 141 void TearDown() override {
142 instances_.reset(); 142 instances_.reset();
143 test::ShellTest::TearDown(); 143 test::ServiceTest::TearDown();
144 } 144 }
145 145
146 bool CanRunCrashTest() { 146 bool CanRunCrashTest() {
147 return !base::CommandLine::ForCurrentProcess()->HasSwitch("single-process"); 147 return !base::CommandLine::ForCurrentProcess()->HasSwitch("single-process");
148 } 148 }
149 149
150 void InitPackage() { 150 void InitPackage() {
151 test::mojom::LifecycleControlPtr lifecycle = ConnectTo(kTestPackageName); 151 test::mojom::LifecycleControlPtr lifecycle = ConnectTo(kTestPackageName);
152 base::RunLoop loop; 152 base::RunLoop loop;
153 lifecycle.set_connection_error_handler(base::Bind(&QuitLoop, &loop)); 153 lifecycle.set_connection_error_handler(base::Bind(&QuitLoop, &loop));
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 parent->Quit(); 445 parent->Quit();
446 446
447 // Quitting the parent should cascade-quit the child. 447 // Quitting the parent should cascade-quit the child.
448 WaitForInstanceDestruction(); 448 WaitForInstanceDestruction();
449 EXPECT_EQ(0u, instances()->GetNewInstanceCount()); 449 EXPECT_EQ(0u, instances()->GetNewInstanceCount());
450 EXPECT_FALSE(instances()->HasInstanceForName(kTestParentName)); 450 EXPECT_FALSE(instances()->HasInstanceForName(kTestParentName));
451 EXPECT_FALSE(instances()->HasInstanceForName(kTestAppName)); 451 EXPECT_FALSE(instances()->HasInstanceForName(kTestAppName));
452 } 452 }
453 453
454 } // namespace shell 454 } // namespace shell
OLDNEW
« no previous file with comments | « services/shell/tests/lifecycle/BUILD.gn ('k') | services/shell/tests/shell/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698