Index: mojo/services/network/udp_socket_apptest.cc |
diff --git a/mojo/services/network/udp_socket_unittest.cc b/mojo/services/network/udp_socket_apptest.cc |
similarity index 94% |
copy from mojo/services/network/udp_socket_unittest.cc |
copy to mojo/services/network/udp_socket_apptest.cc |
index ae6f512e7d7a4f4ad79dfbf31b163053161a0cc9..079ed8fd40c3e5ba72dc8e2cddebde88c55de5ac 100644 |
--- a/mojo/services/network/udp_socket_unittest.cc |
+++ b/mojo/services/network/udp_socket_apptest.cc |
@@ -2,17 +2,18 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "base/at_exit.h" |
#include "base/macros.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/run_loop.h" |
+#include "mojo/public/cpp/application/application_connection.h" |
+#include "mojo/public/cpp/application/application_impl.h" |
+#include "mojo/public/cpp/application/application_test_base.h" |
#include "mojo/public/cpp/bindings/callback.h" |
#include "mojo/services/network/public/cpp/udp_socket_wrapper.h" |
#include "mojo/services/network/public/interfaces/network_service.mojom.h" |
#include "mojo/services/network/public/interfaces/udp_socket.mojom.h" |
-#include "mojo/shell/shell_test_helper.h" |
#include "net/base/net_errors.h" |
#include "testing/gtest/include/gtest/gtest.h" |
-#include "url/gurl.h" |
namespace mojo { |
namespace service { |
@@ -63,7 +64,7 @@ class TestCallbackBase { |
protected: |
struct StateBase : public CallbackType::Runnable { |
StateBase() : test_callback_(nullptr) {} |
- virtual ~StateBase() {} |
+ ~StateBase() override {} |
void set_test_callback(TestCallbackBase* test_callback) { |
test_callback_ = test_callback; |
@@ -221,16 +222,17 @@ class TestReceiveCallback |
Array<uint8_t> data_; |
}; |
-class UDPSocketTest : public testing::Test { |
+class UDPSocketAppTest : public test::ApplicationTestBase { |
public: |
- UDPSocketTest() {} |
- virtual ~UDPSocketTest() {} |
+ UDPSocketAppTest() {} |
+ ~UDPSocketAppTest() override {} |
- virtual void SetUp() override { |
- test_helper_.Init(); |
+ void SetUp() override { |
+ ApplicationTestBase::SetUp(); |
- test_helper_.application_manager()->ConnectToService( |
- GURL("mojo:network_service"), &network_service_); |
+ ApplicationConnection* connection = |
+ application_impl()->ConnectToApplication("mojo:network_service"); |
+ connection->ConnectToService(&network_service_); |
network_service_->CreateUDPSocket(GetProxy(&udp_socket_)); |
udp_socket_.set_client(&udp_socket_client_); |
@@ -293,19 +295,16 @@ class UDPSocketTest : public testing::Test { |
udp_socket_client_.run_loop_ = nullptr; |
} |
- base::ShadowingAtExitManager at_exit_; |
- shell::ShellTestHelper test_helper_; |
- |
NetworkServicePtr network_service_; |
UDPSocketPtr udp_socket_; |
UDPSocketClientImpl udp_socket_client_; |
- DISALLOW_COPY_AND_ASSIGN(UDPSocketTest); |
+ DISALLOW_COPY_AND_ASSIGN(UDPSocketAppTest); |
}; |
} // namespace |
-TEST_F(UDPSocketTest, Settings) { |
+TEST_F(UDPSocketAppTest, Settings) { |
TestCallback callback1; |
udp_socket_->AllowAddressReuse(callback1.callback()); |
callback1.WaitForResult(); |
@@ -356,7 +355,7 @@ TEST_F(UDPSocketTest, Settings) { |
EXPECT_GT(callback9.result(), 0u); |
} |
-TEST_F(UDPSocketTest, TestReadWrite) { |
+TEST_F(UDPSocketAppTest, TestReadWrite) { |
TestCallbackWithAddress callback1; |
udp_socket_->Bind(GetLocalHostWithAnyPort(), callback1.callback()); |
callback1.WaitForResult(); |
@@ -402,7 +401,7 @@ TEST_F(UDPSocketTest, TestReadWrite) { |
} |
} |
-TEST_F(UDPSocketTest, TestUDPSocketWrapper) { |
+TEST_F(UDPSocketAppTest, TestUDPSocketWrapper) { |
UDPSocketWrapper udp_socket(udp_socket_.Pass(), 4, 4); |
TestCallbackWithAddress callback1; |