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

Unified Diff: mojo/services/network/udp_socket_apptest.cc

Issue 858093002: Update the network service from the Mojo repo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/services/network/tcp_connected_socket_impl.cc ('k') | mojo/services/network/url_loader_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « mojo/services/network/tcp_connected_socket_impl.cc ('k') | mojo/services/network/url_loader_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698