Skip to content

Commit

Permalink
fix clang-format, r=me
Browse files Browse the repository at this point in the history
  • Loading branch information
franziskuskiefer committed Aug 2, 2017
1 parent 2c66d71 commit 9274957
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions gtests/softoken_gtest/softoken_gtest.cc
Expand Up @@ -24,26 +24,23 @@ namespace nss_test {
// directory name, but this is extremely unlikely given the expected workload of
// this implementation.
class ScopedUniqueDirectory {
public:
public:
explicit ScopedUniqueDirectory(const std::string& prefix);

// NB: the directory must be empty upon destruction
~ScopedUniqueDirectory() {
assert(rmdir(mPath.c_str()) == 0);
}
~ScopedUniqueDirectory() { assert(rmdir(mPath.c_str()) == 0); }

const std::string& GetPath() { return mPath; }

private:
private:
static const int RETRY_LIMIT = 5;
static void GenerateRandomName(/*in/out*/ std::string& prefix);
static bool TryMakingDirectory(/*in/out*/ std::string& prefix);

std::string mPath;
};

ScopedUniqueDirectory::ScopedUniqueDirectory(const std::string& prefix)
{
ScopedUniqueDirectory::ScopedUniqueDirectory(const std::string& prefix) {
std::string path;
const char* workingDirectory = PR_GetEnvSecure("NSS_GTEST_WORKDIR");
if (workingDirectory) {
Expand All @@ -62,9 +59,7 @@ ScopedUniqueDirectory::ScopedUniqueDirectory(const std::string& prefix)
assert(mPath.length() > 0);
}

void
ScopedUniqueDirectory::GenerateRandomName(std::string& prefix)
{
void ScopedUniqueDirectory::GenerateRandomName(std::string& prefix) {
std::stringstream ss;
ss << prefix;
// RAND_MAX is at least 32767.
Expand All @@ -74,9 +69,7 @@ ScopedUniqueDirectory::GenerateRandomName(std::string& prefix)
ss >> prefix;
}

bool
ScopedUniqueDirectory::TryMakingDirectory(std::string& prefix)
{
bool ScopedUniqueDirectory::TryMakingDirectory(std::string& prefix) {
GenerateRandomName(prefix);
#if defined(_WIN32)
return _mkdir(prefix.c_str()) == 0;
Expand All @@ -86,8 +79,8 @@ ScopedUniqueDirectory::TryMakingDirectory(std::string& prefix)
}

class SoftokenTest : public ::testing::Test {
protected:
SoftokenTest() : mNSSDBDir("SoftokenTest.d-") { }
protected:
SoftokenTest() : mNSSDBDir("SoftokenTest.d-") {}

virtual void SetUp() {
std::string nssInitArg("sql:");
Expand Down Expand Up @@ -125,7 +118,7 @@ TEST_F(SoftokenTest, ResetSoftokenNonEmptyPassword) {

} // namespace nss_test

int main(int argc, char **argv) {
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);

return RUN_ALL_TESTS();
Expand Down

0 comments on commit 9274957

Please sign in to comment.