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

Unified Diff: content/common/sandbox_mac_system_access_unittest.mm

Issue 16748002: Add the MacSandboxTest.NSSAccess test to content_unittests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 6 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
« content/common/common.sb ('K') | « content/common/common.sb ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/sandbox_mac_system_access_unittest.mm
===================================================================
--- content/common/sandbox_mac_system_access_unittest.mm (revision 204987)
+++ content/common/sandbox_mac_system_access_unittest.mm (working copy)
@@ -9,6 +9,7 @@
#include "base/strings/sys_string_conversions.h"
#include "content/common/sandbox_mac.h"
#include "content/common/sandbox_mac_unittest_helper.h"
+#include "crypto/nss_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace content {
@@ -120,4 +121,25 @@
EXPECT_TRUE(RunTestInAllSandboxTypes("MacSandboxedUrandomTestCase", NULL));
}
+//--------------------- NSS Sandboxing ----------------------
+// Test case for checking sandboxing of NSS initialization.
+class MacSandboxedNSSTestCase : public MacSandboxTestCase {
+ public:
+ virtual bool SandboxedTest() OVERRIDE;
+};
+
+REGISTER_SANDBOX_TEST_CASE(MacSandboxedNSSTestCase);
+
+bool MacSandboxedNSSTestCase::SandboxedTest() {
+ // If NSS cannot read from /dev/urandom, NSS initialization will call abort(),
+ // which will cause this test case to fail.
+ crypto::ForceNSSNoDBInit();
+ crypto::EnsureNSSInit();
+ return true;
+}
+
+TEST_F(MacSandboxTest, NSSAccess) {
+ EXPECT_TRUE(RunTestInAllSandboxTypes("MacSandboxedNSSTestCase", NULL));
+}
+
} // namespace content
« content/common/common.sb ('K') | « content/common/common.sb ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698