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

Unified Diff: mojo/shell/public/cpp/lib/application_test_base.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
Index: mojo/shell/public/cpp/lib/application_test_base.cc
diff --git a/mojo/shell/public/cpp/lib/application_test_base.cc b/mojo/shell/public/cpp/lib/application_test_base.cc
index c895a243bedfd0f86d82c501b6cb4a16c235197b..c03f7f72566ae497848b8f9ebfc90a1af09e856a 100644
--- a/mojo/shell/public/cpp/lib/application_test_base.cc
+++ b/mojo/shell/public/cpp/lib/application_test_base.cc
@@ -4,6 +4,7 @@
#include <utility>
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
@@ -18,6 +19,7 @@ namespace mojo {
namespace test {
namespace {
+
// Share the application name with multiple application tests.
shell::mojom::IdentityPtr g_identity;
uint32_t g_id = shell::mojom::kInvalidInstanceID;
@@ -43,13 +45,14 @@ class ShellGrabber : public shell::mojom::ShellClient {
private:
// shell::mojom::ShellClient implementation.
- void Initialize(shell::mojom::ConnectorPtr connector,
- shell::mojom::IdentityPtr identity,
- uint32_t id) override {
+ void Initialize(shell::mojom::IdentityPtr identity,
+ uint32_t id,
+ const InitializeCallback& callback) override {
+ callback.Run(GetProxy(&g_connector));
+
g_identity = std::move(identity);
g_id = id;
g_shell_client_request = binding_.Unbind();
- g_connector = std::move(connector);
}
void AcceptConnection(
@@ -65,6 +68,8 @@ class ShellGrabber : public shell::mojom::ShellClient {
Binding<ShellClient> binding_;
};
+void IgnoreConnectorRequest(shell::mojom::ConnectorRequest) {}
+
} // namespace
MojoResult RunAllTests(MojoHandle shell_client_request_handle) {
@@ -115,9 +120,12 @@ TestHelper::TestHelper(ShellClient* client)
name_(g_identity->name),
userid_(g_identity->user_id),
instance_id_(g_id) {
+ shell_connection_->SetAppTestConnectorForTesting(std::move(g_connector));
+
// Fake ShellClient initialization.
shell::mojom::ShellClient* shell_client = shell_connection_.get();
- shell_client->Initialize(std::move(g_connector), std::move(g_identity), g_id);
+ shell_client->Initialize(std::move(g_identity), g_id,
+ base::Bind(&IgnoreConnectorRequest));
}
TestHelper::~TestHelper() {
« no previous file with comments | « mojo/shell/background/tests/background_shell_unittest.cc ('k') | mojo/shell/public/cpp/lib/shell_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698