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 2bf697532c9aa2678f2a06e36e9483e39ee91334..23495433387b15917ad7d2902441216142ce8113 100644 |
--- a/mojo/shell/public/cpp/lib/application_test_base.cc |
+++ b/mojo/shell/public/cpp/lib/application_test_base.cc |
@@ -9,9 +9,9 @@ |
#include "mojo/public/cpp/bindings/binding.h" |
#include "mojo/public/cpp/environment/environment.h" |
#include "mojo/public/cpp/system/message_pipe.h" |
-#include "mojo/shell/public/cpp/application_impl.h" |
#include "mojo/shell/public/cpp/application_test_base.h" |
-#include "mojo/shell/public/interfaces/application.mojom.h" |
+#include "mojo/shell/public/cpp/shell_connection.h" |
+#include "mojo/shell/public/interfaces/shell_client.mojom.h" |
namespace mojo { |
namespace test { |
@@ -21,34 +21,33 @@ namespace { |
String g_url; |
uint32_t g_id = shell::mojom::Shell::kInvalidApplicationID; |
-// Application request handle passed from the shell in MojoMain, stored in |
-// between SetUp()/TearDown() so we can (re-)intialize new ApplicationImpls. |
-InterfaceRequest<shell::mojom::Application> g_application_request; |
+// ShellClient request handle passed from the shell in MojoMain, stored in |
+// between SetUp()/TearDown() so we can (re-)intialize new ShellConnections. |
+InterfaceRequest<shell::mojom::ShellClient> g_shell_client_request; |
-// Shell pointer passed in the initial mojo.Application.Initialize() call, |
+// Shell pointer passed in the initial mojo.ShellClient.Initialize() call, |
// stored in between initial setup and the first test and between SetUp/TearDown |
-// calls so we can (re-)initialize new ApplicationImpls. |
+// calls so we can (re-)initialize new ShellConnections. |
shell::mojom::ShellPtr g_shell; |
-class ShellGrabber : public shell::mojom::Application { |
+class ShellGrabber : public shell::mojom::ShellClient { |
public: |
- explicit ShellGrabber( |
- InterfaceRequest<shell::mojom::Application> application_request) |
- : binding_(this, std::move(application_request)) {} |
+ explicit ShellGrabber(InterfaceRequest<shell::mojom::ShellClient> request) |
+ : binding_(this, std::move(request)) {} |
void WaitForInitialize() { |
- // Initialize is always the first call made on Application. |
+ // Initialize is always the first call made on ShellClient. |
MOJO_CHECK(binding_.WaitForIncomingMethodCall()); |
} |
private: |
- // Application implementation. |
+ // shell::mojom::ShellClient implementation. |
void Initialize(shell::mojom::ShellPtr shell, |
const mojo::String& url, |
uint32_t id) override { |
g_url = url; |
g_id = id; |
- g_application_request = binding_.Unbind(); |
+ g_shell_client_request = binding_.Unbind(); |
g_shell = std::move(shell); |
} |
@@ -65,23 +64,23 @@ class ShellGrabber : public shell::mojom::Application { |
MOJO_CHECK(false); |
} |
- Binding<Application> binding_; |
+ Binding<ShellClient> binding_; |
}; |
} // namespace |
-MojoResult RunAllTests(MojoHandle application_request_handle) { |
+MojoResult RunAllTests(MojoHandle shell_client_request_handle) { |
{ |
// This loop is used for init, and then destroyed before running tests. |
Environment::InstantiateDefaultRunLoop(); |
// Grab the shell handle. |
ShellGrabber grabber( |
- MakeRequest<shell::mojom::Application>(MakeScopedHandle( |
- MessagePipeHandle(application_request_handle)))); |
+ MakeRequest<shell::mojom::ShellClient>(MakeScopedHandle( |
+ MessagePipeHandle(shell_client_request_handle)))); |
grabber.WaitForInitialize(); |
MOJO_CHECK(g_shell); |
- MOJO_CHECK(g_application_request.is_pending()); |
+ MOJO_CHECK(g_shell_client_request.is_pending()); |
int argc = 0; |
base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
@@ -107,31 +106,31 @@ MojoResult RunAllTests(MojoHandle application_request_handle) { |
int result = RUN_ALL_TESTS(); |
// Shut down our message pipes before exiting. |
- (void)g_application_request.PassMessagePipe(); |
+ (void)g_shell_client_request.PassMessagePipe(); |
g_shell.reset(); |
return (result == 0) ? MOJO_RESULT_OK : MOJO_RESULT_UNKNOWN; |
} |
TestHelper::TestHelper(ShellClient* client) |
- : application_impl_(new ApplicationImpl( |
+ : shell_connection_(new ShellConnection( |
client == nullptr ? &default_shell_client_ : client, |
- std::move(g_application_request))), |
+ std::move(g_shell_client_request))), |
url_(g_url) { |
- // Fake application initialization. |
- shell::mojom::Application* application = application_impl_.get(); |
- application->Initialize(std::move(g_shell), g_url, g_id); |
+ // Fake ShellClient initialization. |
+ shell::mojom::ShellClient* shell_client = shell_connection_.get(); |
+ shell_client->Initialize(std::move(g_shell), g_url, g_id); |
} |
TestHelper::~TestHelper() { |
// TODO: commented out until http://crbug.com/533107 is solved. |
// { |
- // ApplicationImpl::TestApi test_api(application_impl_); |
- // test_api.UnbindConnections(&g_application_request, &g_shell); |
+ // ShellConnection::TestApi test_api(shell_connection_); |
+ // test_api.UnbindConnections(&g_shell_client_request, &g_shell); |
// } |
- // We may have supplied a member as the client. Delete |application_impl_| |
+ // We may have supplied a member as the client. Delete |shell_connection_| |
// while still valid. |
- application_impl_.reset(); |
+ shell_connection_.reset(); |
} |
ApplicationTestBase::ApplicationTestBase() : test_helper_(nullptr) {} |
@@ -144,12 +143,12 @@ ShellClient* ApplicationTestBase::GetShellClient() { |
} |
void ApplicationTestBase::SetUp() { |
- // A run loop is recommended for ApplicationImpl initialization and |
+ // A run loop is recommended for ShellConnection initialization and |
// communication. |
if (ShouldCreateDefaultRunLoop()) |
Environment::InstantiateDefaultRunLoop(); |
- MOJO_CHECK(g_application_request.is_pending()); |
+ MOJO_CHECK(g_shell_client_request.is_pending()); |
MOJO_CHECK(g_shell); |
// New applications are constructed for each test to avoid persisting state. |
@@ -157,7 +156,7 @@ void ApplicationTestBase::SetUp() { |
} |
void ApplicationTestBase::TearDown() { |
- MOJO_CHECK(!g_application_request.is_pending()); |
+ MOJO_CHECK(!g_shell_client_request.is_pending()); |
MOJO_CHECK(!g_shell); |
test_helper_.reset(); |