зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1030090 - tests shouldn't destroy gfxPrefs, r=bjacob
This commit is contained in:
Родитель
15c6e24190
Коммит
793f6d8a10
|
@ -36,9 +36,6 @@ protected:
|
|||
gfxPrefs::GetSingleton();
|
||||
AsyncPanZoomController::SetThreadAssertionsEnabled(false);
|
||||
}
|
||||
virtual void TearDown() {
|
||||
gfxPrefs::DestroySingleton();
|
||||
}
|
||||
};
|
||||
|
||||
class APZCTreeManagerTester : public ::testing::Test {
|
||||
|
@ -47,9 +44,6 @@ protected:
|
|||
gfxPrefs::GetSingleton();
|
||||
AsyncPanZoomController::SetThreadAssertionsEnabled(false);
|
||||
}
|
||||
virtual void TearDown() {
|
||||
gfxPrefs::DestroySingleton();
|
||||
}
|
||||
};
|
||||
|
||||
class MockContentController : public GeckoContentController {
|
||||
|
|
|
@ -16,15 +16,11 @@
|
|||
// result through this API.
|
||||
|
||||
TEST(GfxPrefs, Singleton) {
|
||||
ASSERT_FALSE(gfxPrefs::SingletonExists());
|
||||
gfxPrefs::GetSingleton();
|
||||
ASSERT_TRUE(gfxPrefs::SingletonExists());
|
||||
gfxPrefs::DestroySingleton();
|
||||
ASSERT_FALSE(gfxPrefs::SingletonExists());
|
||||
}
|
||||
|
||||
TEST(GfxPrefs, LiveValues) {
|
||||
ASSERT_FALSE(gfxPrefs::SingletonExists());
|
||||
gfxPrefs::GetSingleton();
|
||||
ASSERT_TRUE(gfxPrefs::SingletonExists());
|
||||
|
||||
|
@ -36,13 +32,9 @@ TEST(GfxPrefs, LiveValues) {
|
|||
|
||||
// Live uint32_t, default 2
|
||||
ASSERT_TRUE(gfxPrefs::MSAALevel() == 2);
|
||||
|
||||
gfxPrefs::DestroySingleton();
|
||||
ASSERT_FALSE(gfxPrefs::SingletonExists());
|
||||
}
|
||||
|
||||
TEST(GfxPrefs, OnceValues) {
|
||||
ASSERT_FALSE(gfxPrefs::SingletonExists());
|
||||
gfxPrefs::GetSingleton();
|
||||
ASSERT_TRUE(gfxPrefs::SingletonExists());
|
||||
|
||||
|
@ -60,8 +52,5 @@ TEST(GfxPrefs, OnceValues) {
|
|||
|
||||
// Once float, default -1 (should be OK with ==)
|
||||
ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
|
||||
|
||||
gfxPrefs::DestroySingleton();
|
||||
ASSERT_FALSE(gfxPrefs::SingletonExists());
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
using namespace mozilla;
|
||||
|
||||
gfxPrefs* gfxPrefs::sInstance = nullptr;
|
||||
bool gfxPrefs::sInstanceHasBeenDestroyed = false;
|
||||
|
||||
void
|
||||
gfxPrefs::DestroySingleton()
|
||||
|
@ -18,7 +19,9 @@ gfxPrefs::DestroySingleton()
|
|||
if (sInstance) {
|
||||
delete sInstance;
|
||||
sInstance = nullptr;
|
||||
sInstanceHasBeenDestroyed = true;
|
||||
}
|
||||
MOZ_ASSERT(!SingletonExists());
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -234,9 +234,11 @@ public:
|
|||
// Manage the singleton:
|
||||
static gfxPrefs& GetSingleton()
|
||||
{
|
||||
MOZ_ASSERT(!sInstanceHasBeenDestroyed, "Should never recreate a gfxPrefs instance!");
|
||||
if (!sInstance) {
|
||||
sInstance = new gfxPrefs;
|
||||
}
|
||||
MOZ_ASSERT(SingletonExists());
|
||||
return *sInstance;
|
||||
}
|
||||
static void DestroySingleton();
|
||||
|
@ -244,6 +246,7 @@ public:
|
|||
|
||||
private:
|
||||
static gfxPrefs* sInstance;
|
||||
static bool sInstanceHasBeenDestroyed;
|
||||
|
||||
private:
|
||||
// Creating these to avoid having to include Preferences.h in the .h
|
||||
|
|
Загрузка…
Ссылка в новой задаче