Bug 1824634 hold GtkIMContext reference a little longer than preedit-changed r=masayuki
[gecko.git] / storage / test / gtest / test_deadlock_detector.cpp
blob2679cf26f1ecaf21557ec7756dee974ac1a01f5a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: sw=2 ts=4 et :
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 // Note: This file is essentially a copy of
8 // xpcom/tests/gtest/TestDeadlockDetector.cpp, but all mutexes were turned into
9 // SQLiteMutexes. We use #include and some macros to avoid actual source code
10 // duplication.
12 #include "mozilla/CondVar.h"
13 #include "mozilla/RecursiveMutex.h"
14 #include "mozilla/ReentrantMonitor.h"
15 #include "SQLiteMutex.h"
17 // We need this one so _gdb_sleep_duration is also in "storage" namespace
18 #include "mozilla/gtest/MozHelpers.h"
20 #include "gtest/gtest.h"
22 using namespace mozilla;
24 /**
25 * Helper class to allocate a sqlite3_mutex for our SQLiteMutex.
27 class TestMutex : public mozilla::storage::SQLiteMutex {
28 public:
29 explicit TestMutex(const char* aName)
30 : mozilla::storage::SQLiteMutex(aName),
31 mInner(sqlite3_mutex_alloc(SQLITE_MUTEX_FAST)) {
32 NS_ASSERTION(mInner, "could not allocate a sqlite3_mutex");
33 initWithMutex(mInner);
36 ~TestMutex() { sqlite3_mutex_free(mInner); }
38 void Lock() { lock(); }
40 void Unlock() { unlock(); }
42 private:
43 sqlite3_mutex* mInner;
46 // These are the two macros that differentiate this file from the XPCOM one.
47 #define MUTEX TestMutex
48 #define TESTNAME(name) storage_##name
50 // Bug 1473531: the test storage_DeadlockDetectorTest.storage_Sanity5DeathTest
51 // times out on macosx ccov builds
52 #if defined(XP_MACOSX) && defined(MOZ_CODE_COVERAGE)
53 # define DISABLE_STORAGE_SANITY5_DEATH_TEST
54 #endif
56 #include "../../../xpcom/tests/gtest/TestDeadlockDetector.cpp"