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

Unified Diff: chrome/browser/extensions/api/socket/socket_api_controller_unittest.cc

Issue 8857004: Delete UDPClientSocket on same thread as creation. Also refactor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: aa-inspired deltas. Created 9 years 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: chrome/browser/extensions/api/socket/socket_api_controller_unittest.cc
diff --git a/chrome/browser/extensions/api/socket/socket_api_controller_unittest.cc b/chrome/browser/extensions/api/socket/socket_api_controller_unittest.cc
index 97961e43eaa532ec33275af9837be4a4f11e1e13..376b66db12bd75b646b61ee295e0f742fe03f475 100644
--- a/chrome/browser/extensions/api/socket/socket_api_controller_unittest.cc
+++ b/chrome/browser/extensions/api/socket/socket_api_controller_unittest.cc
@@ -4,6 +4,7 @@
#include "testing/gtest/include/gtest/gtest.h"
+#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/socket/socket_api.h"
#include "chrome/browser/extensions/api/socket/socket_api_controller.h"
@@ -16,7 +17,7 @@ class SocketApiControllerTest : public testing::Test {
TEST_F(SocketApiControllerTest, TestSocketControllerLifetime) {
// We want to make sure that killing the controller while a bunch of
// sockets are alive doesn't crash.
- SocketController* controller = SocketController::GetInstance();
+ scoped_ptr<SocketController> controller(new SocketController());
// Create some sockets but don't do anything with them.
Profile* profile = NULL;
@@ -36,16 +37,6 @@ TEST_F(SocketApiControllerTest, TestSocketControllerLifetime) {
ASSERT_TRUE(socket_id != 0);
ASSERT_TRUE(controller->ConnectUdp(socket_id, address, kPort));
}
-
- // At this point, we're done, and we're relying on the RAE mechanism
- // of the Singleton class to delete the controller at process exit.
- // We'd have to jump through some icky hoops to turn off RAE and
- // manually delete in this test method, so we'll instead take it on
- // faith that the singleton will indeed delete itself, and that if
- // we had any heap management problems in the controller, they'd
- // show up later in this test process. I (miket) hereby confirm that
- // I manually added a temporary double-free in the controller
- // destructor and verified that the unit_tests process segfaulted.
}
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698