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

Unified Diff: base/process/memory_unittest.cc

Issue 69953025: Support use_glib==0 on Linux in base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: bring back EXPECT_EQ as it suppresses unused result warning Created 7 years, 1 month 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 | « base/file_util_posix.cc ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/memory_unittest.cc
diff --git a/base/process/memory_unittest.cc b/base/process/memory_unittest.cc
index a1f30526aa35536b46435c0dbd133e6b40a42efc..e5c759d5711cfe8c145b829ef678b9fe54c74b06 100644
--- a/base/process/memory_unittest.cc
+++ b/base/process/memory_unittest.cc
@@ -10,6 +10,7 @@
#include "base/compiler_specific.h"
#include "base/debug/alias.h"
+#include "base/strings/stringprintf.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_WIN)
@@ -23,7 +24,6 @@
#include "base/process/memory_unittest_mac.h"
#endif
#if defined(OS_LINUX)
-#include <glib.h>
#include <malloc.h>
#endif
@@ -260,14 +260,13 @@ TEST_F(OutOfMemoryDeathTest, Memalign) {
}
TEST_F(OutOfMemoryDeathTest, ViaSharedLibraries) {
- // g_try_malloc is documented to return NULL on failure. (g_malloc is the
- // 'safe' default that crashes if allocation fails). However, since we have
- // hopefully overridden malloc, even g_try_malloc should fail. This tests
- // that the run-time symbol resolution is overriding malloc for shared
- // libraries as well as for our code.
+ // This tests that the run-time symbol resolution is overriding malloc for
+ // shared libraries (including libc itself) as well as for our code.
+ std::string format = base::StringPrintf("%%%zud", test_size_);
+ char *value = NULL;
ASSERT_DEATH({
SetUpInDeathAssert();
- value_ = g_try_malloc(test_size_);
+ EXPECT_EQ(-1, asprintf(&value, format.c_str(), 0));
}, "");
}
#endif // OS_LINUX
« no previous file with comments | « base/file_util_posix.cc ('k') | base/process/process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698