summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/render_process_unittest.cc
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 01:30:17 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-28 01:30:17 +0000
commit7497c1e3754bc85a0fa2b2a453b536872933e180 (patch)
treea33783cf132cf6ba46c93329f00842152b7e7892 /chrome/renderer/render_process_unittest.cc
parentd8bc79bfb604f3c10c3cd0bc0e35e0b8ec7b8d7d (diff)
downloadchromium_src-7497c1e3754bc85a0fa2b2a453b536872933e180.zip
chromium_src-7497c1e3754bc85a0fa2b2a453b536872933e180.tar.gz
chromium_src-7497c1e3754bc85a0fa2b2a453b536872933e180.tar.bz2
Unit test addition, cleanup for render_process/thread.
Review URL: http://codereview.chromium.org/19606 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8782 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/render_process_unittest.cc')
-rw-r--r--chrome/renderer/render_process_unittest.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/renderer/render_process_unittest.cc b/chrome/renderer/render_process_unittest.cc
new file mode 100644
index 0000000..d1a3255
--- /dev/null
+++ b/chrome/renderer/render_process_unittest.cc
@@ -0,0 +1,35 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/sys_info.h"
+#include "base/string_util.h"
+#include "chrome/renderer/render_process.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+
+class RenderProcessTest : public testing::Test {
+ public:
+ virtual void SetUp() {
+ // Must have a message loop to create a RenderThread()
+ message_loop_ = new MessageLoop(MessageLoop::TYPE_DEFAULT);
+ }
+
+ virtual void TearDown() {
+ delete message_loop_;
+ }
+
+ private:
+ MessageLoop *message_loop_;
+};
+
+
+TEST_F(RenderProcessTest, TestSharedMemoryAllocOne) {
+ RenderProcess::GlobalInit(ASCIIToWide("hi mom"));
+ size_t size = base::SysInfo::VMAllocationGranularity();
+ base::SharedMemory* mem = RenderProcess::AllocSharedMemory(size);
+ ASSERT_TRUE(mem);
+ RenderProcess::FreeSharedMemory(mem);
+ RenderProcess::GlobalCleanup();
+}
+