1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "gtest/gtest.h"
10 #include "nsProfileLock.h"
12 #include "nsDirectoryServiceDefs.h"
14 TEST(ProfileLock
, BasicLock
)
16 char tmpExt
[] = "profilebasiclocktest";
21 nsCOMPtr
<nsIFile
> tmpDir
;
22 rv
= NS_GetSpecialDirectory(NS_OS_TEMP_DIR
, getter_AddRefs(tmpDir
));
23 ASSERT_EQ(NS_SUCCEEDED(rv
), true);
25 rv
= tmpDir
->AppendNative(nsCString(tmpExt
));
26 ASSERT_EQ(NS_SUCCEEDED(rv
), true);
28 rv
= tmpDir
->CreateUnique(nsIFile::DIRECTORY_TYPE
, 0700);
29 ASSERT_EQ(NS_SUCCEEDED(rv
), true);
31 rv
= myLock
.Lock(tmpDir
, nullptr);
32 EXPECT_EQ(NS_SUCCEEDED(rv
), true);