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

Unified Diff: services/shell/tests/lifecycle/lifecycle_unittest.cc

Issue 2179023004: Make Service own ServiceContext. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/shell/tests/connect/connect_unittest.cc ('k') | services/shell/tests/lifecycle/parent.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/tests/lifecycle/lifecycle_unittest.cc
diff --git a/services/shell/tests/lifecycle/lifecycle_unittest.cc b/services/shell/tests/lifecycle/lifecycle_unittest.cc
index 830d0fcd0e791b24c806ddb27d5ae23851490957..7f1181af1113669700b9208ba8089b206c8b9333 100644
--- a/services/shell/tests/lifecycle/lifecycle_unittest.cc
+++ b/services/shell/tests/lifecycle/lifecycle_unittest.cc
@@ -38,12 +38,11 @@ void DecrementCountAndQuitWhenZero(base::RunLoop* loop, size_t* count) {
}
struct Instance {
- Instance() : id(mojom::kInvalidInstanceID), pid(0) {}
- Instance(const Identity& identity, uint32_t id, uint32_t pid)
- : identity(identity), id(id), pid(pid) {}
+ Instance() : pid(0) {}
+ Instance(const Identity& identity, uint32_t pid)
+ : identity(identity), pid(pid) {}
Identity identity;
- uint32_t id;
uint32_t pid;
};
@@ -72,8 +71,7 @@ class InstanceState : public mojom::ServiceManagerListener {
// mojom::ServiceManagerListener:
void OnInit(mojo::Array<mojom::ServiceInfoPtr> instances) override {
for (const auto& instance : instances) {
- Instance i(instance->identity.To<Identity>(), instance->id,
- instance->pid);
+ Instance i(instance->identity.To<Identity>(), instance->pid);
initial_instances_[i.identity.name()] = i;
instances_[i.identity.name()] = i;
}
@@ -81,20 +79,22 @@ class InstanceState : public mojom::ServiceManagerListener {
}
void OnServiceCreated(mojom::ServiceInfoPtr instance) override {
instances_[instance->identity->name] =
- Instance(instance->identity.To<Identity>(), instance->id,
- instance->pid);
+ Instance(instance->identity.To<Identity>(), instance->pid);
}
- void OnServiceStarted(uint32_t id, uint32_t pid) override {
+ void OnServiceStarted(mojom::IdentityPtr identity_ptr,
+ uint32_t pid) override {
+ Identity identity = identity_ptr.To<Identity>();
for (auto& instance : instances_) {
- if (instance.second.id == id) {
+ if (instance.second.identity == identity) {
instance.second.pid = pid;
break;
}
}
}
- void OnServiceStopped(uint32_t id) override {
+ void OnServiceStopped(mojom::IdentityPtr identity_ptr) override {
+ Identity identity = identity_ptr.To<Identity>();
for (auto it = instances_.begin(); it != instances_.end(); ++it) {
- if (it->second.id == id) {
+ if (it->second.identity == identity) {
instances_.erase(it);
break;
}
« no previous file with comments | « services/shell/tests/connect/connect_unittest.cc ('k') | services/shell/tests/lifecycle/parent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698