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

Unified Diff: mojo/shell/tests/shell/shell_unittest.cc

Issue 1793793002: Remove ShellConnection::WaitForInitialize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « mojo/shell/shell.cc ('k') | ui/views/mus/platform_test_helper_mus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/tests/shell/shell_unittest.cc
diff --git a/mojo/shell/tests/shell/shell_unittest.cc b/mojo/shell/tests/shell/shell_unittest.cc
index 4a0debf5442c557d16610146c1e00435b1dbfedc..04af796db64e9635b25cea4518d704d8b4aa11de 100644
--- a/mojo/shell/tests/shell/shell_unittest.cc
+++ b/mojo/shell/tests/shell/shell_unittest.cc
@@ -11,6 +11,7 @@
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/process/process_handle.h"
+#include "base/run_loop.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "mojo/shell/public/cpp/interface_factory.h"
#include "mojo/shell/public/cpp/shell_client.h"
@@ -92,7 +93,9 @@ class ShellTest : public mojo::test::ShellTest,
connector()->ConnectToInterface("mojo:shell", &shell);
shell->AddInstanceListener(binding_.CreateInterfacePtrAndBind());
- binding_.WaitForIncomingMethodCall();
+
+ wait_for_instances_loop_.reset(new base::RunLoop);
+ wait_for_instances_loop_->Run();
}
bool ContainsInstanceWithName(const std::string& name) const {
@@ -129,10 +132,15 @@ class ShellTest : public mojo::test::ShellTest,
initial_instances_.push_back(InstanceInfo(instances[i]->id,
instances[i]->identity->name));
}
+
+ DCHECK(wait_for_instances_loop_);
+ wait_for_instances_loop_->Quit();
}
+
void InstanceCreated(mojom::InstanceInfoPtr instance) override {
instances_.push_back(InstanceInfo(instance->id, instance->identity->name));
}
+
void InstanceDestroyed(uint32_t id) override {
for (auto it = instances_.begin(); it != instances_.end(); ++it) {
auto& instance = *it;
@@ -142,6 +150,7 @@ class ShellTest : public mojo::test::ShellTest,
}
}
}
+
void InstancePIDAvailable(uint32_t id, uint32_t pid) override {
for (auto& instance : instances_) {
if (instance.id == id) {
@@ -155,6 +164,7 @@ class ShellTest : public mojo::test::ShellTest,
Binding<mojom::InstanceListener> binding_;
std::vector<InstanceInfo> instances_;
std::vector<InstanceInfo> initial_instances_;
+ scoped_ptr<base::RunLoop> wait_for_instances_loop_;
DISALLOW_COPY_AND_ASSIGN(ShellTest);
};
« no previous file with comments | « mojo/shell/shell.cc ('k') | ui/views/mus/platform_test_helper_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698