Chromium Code Reviews| Index: mojo/shell/public/cpp/lib/shell_test.cc |
| diff --git a/mojo/shell/public/cpp/lib/shell_test.cc b/mojo/shell/public/cpp/lib/shell_test.cc |
| index e5cb3c2edb822e6b922836e9e867bf49433676a0..605e7c59b1b3f2b951e8bf719f2d4cb0dc76b0f1 100644 |
| --- a/mojo/shell/public/cpp/lib/shell_test.cc |
| +++ b/mojo/shell/public/cpp/lib/shell_test.cc |
| @@ -5,6 +5,7 @@ |
| #include "mojo/shell/public/cpp/shell_test.h" |
| #include "base/message_loop/message_loop.h" |
| +#include "base/run_loop.h" |
| #include "mojo/shell/background/background_shell.h" |
| #include "mojo/shell/public/cpp/shell_client.h" |
| @@ -44,6 +45,7 @@ void ShellTest::InitializeCalled(Connector* connector, |
| initialize_name_ = name; |
| initialize_instance_id_ = id; |
| initialize_userid_ = user_id; |
| + initialize_called_.Run(); |
| } |
| void ShellTest::SetUp() { |
| @@ -51,10 +53,20 @@ void ShellTest::SetUp() { |
| message_loop_ = CreateMessageLoop(); |
| background_shell_.reset(new shell::BackgroundShell); |
| background_shell_->Init(nullptr); |
| + |
| + // Create the shell connection. We don't proceed until we get our |
| + // ShellClient's Initialize() method is called. |
| + base::RunLoop run_loop; |
|
yzshen1
2016/03/17 22:56:57
I am personally fine with this, but not sure wheth
|
| + base::MessageLoop::ScopedNestableTaskAllower allow( |
| + base::MessageLoop::current()); |
| + initialize_called_ = run_loop.QuitClosure(); |
| + |
| shell_connection_.reset(new ShellConnection( |
| shell_client_.get(), |
| background_shell_->CreateShellClientRequest(test_name_))); |
| connector_ = shell_connection_->connector(); |
| + |
| + run_loop.Run(); |
| } |
| void ShellTest::TearDown() { |