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

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

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.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
Index: mojo/services/network/udp_socket_unittest.cc
diff --git a/mojo/services/network/udp_socket_apptest.cc b/mojo/services/network/udp_socket_unittest.cc
similarity index 94%
copy from mojo/services/network/udp_socket_apptest.cc
copy to mojo/services/network/udp_socket_unittest.cc
index 079ed8fd40c3e5ba72dc8e2cddebde88c55de5ac..ae6f512e7d7a4f4ad79dfbf31b163053161a0cc9 100644
--- a/mojo/services/network/udp_socket_apptest.cc
+++ b/mojo/services/network/udp_socket_unittest.cc
@@ -2,18 +2,17 @@
// 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 {
@@ -64,7 +63,7 @@ class TestCallbackBase {
protected:
struct StateBase : public CallbackType::Runnable {
StateBase() : test_callback_(nullptr) {}
- ~StateBase() override {}
+ virtual ~StateBase() {}
void set_test_callback(TestCallbackBase* test_callback) {
test_callback_ = test_callback;
@@ -222,17 +221,16 @@ class TestReceiveCallback
Array<uint8_t> data_;
};
-class UDPSocketAppTest : public test::ApplicationTestBase {
+class UDPSocketTest : public testing::Test {
public:
- UDPSocketAppTest() {}
- ~UDPSocketAppTest() override {}
+ UDPSocketTest() {}
+ virtual ~UDPSocketTest() {}
- void SetUp() override {
- ApplicationTestBase::SetUp();
+ virtual void SetUp() override {
+ test_helper_.Init();
- ApplicationConnection* connection =
- application_impl()->ConnectToApplication("mojo:network_service");
- connection->ConnectToService(&network_service_);
+ test_helper_.application_manager()->ConnectToService(
+ GURL("mojo:network_service"), &network_service_);
network_service_->CreateUDPSocket(GetProxy(&udp_socket_));
udp_socket_.set_client(&udp_socket_client_);
@@ -295,16 +293,19 @@ class UDPSocketAppTest : public test::ApplicationTestBase {
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(UDPSocketAppTest);
+ DISALLOW_COPY_AND_ASSIGN(UDPSocketTest);
};
} // namespace
-TEST_F(UDPSocketAppTest, Settings) {
+TEST_F(UDPSocketTest, Settings) {
TestCallback callback1;
udp_socket_->AllowAddressReuse(callback1.callback());
callback1.WaitForResult();
@@ -355,7 +356,7 @@ TEST_F(UDPSocketAppTest, Settings) {
EXPECT_GT(callback9.result(), 0u);
}
-TEST_F(UDPSocketAppTest, TestReadWrite) {
+TEST_F(UDPSocketTest, TestReadWrite) {
TestCallbackWithAddress callback1;
udp_socket_->Bind(GetLocalHostWithAnyPort(), callback1.callback());
callback1.WaitForResult();
@@ -401,7 +402,7 @@ TEST_F(UDPSocketAppTest, TestReadWrite) {
}
}
-TEST_F(UDPSocketAppTest, TestUDPSocketWrapper) {
+TEST_F(UDPSocketTest, TestUDPSocketWrapper) {
UDPSocketWrapper udp_socket(udp_socket_.Pass(), 4, 4);
TestCallbackWithAddress callback1;

Powered by Google App Engine
This is Rietveld 408576698