Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* -*- Mode: C++; tab-width: 2; 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"
8 #include "gfxPrefs.h"
9 #ifdef GFX_DECL_PREF
10 #error "This is not supposed to be defined outside of gfxPrefs.h"
11 #endif
13 // If the default values for any of these preferences change,
14 // just modify the test to match. We are only testing against
15 // a particular value to make sure we receive the correct
16 // result through this API.
18 TEST(GfxPrefs, Singleton) {
19 ASSERT_FALSE(gfxPrefs::SingletonExists());
20 gfxPrefs::GetSingleton();
21 ASSERT_TRUE(gfxPrefs::SingletonExists());
22 gfxPrefs::DestroySingleton();
23 ASSERT_FALSE(gfxPrefs::SingletonExists());
24 }
26 TEST(GfxPrefs, LiveValues) {
27 ASSERT_FALSE(gfxPrefs::SingletonExists());
28 gfxPrefs::GetSingleton();
29 ASSERT_TRUE(gfxPrefs::SingletonExists());
31 // Live boolean, default false
32 ASSERT_FALSE(gfxPrefs::CanvasAzureAccelerated());
34 // Live int32_t, default 23456
35 ASSERT_TRUE(gfxPrefs::LayerScopePort() == 23456);
37 // Live uint32_t, default 2
38 ASSERT_TRUE(gfxPrefs::MSAALevel() == 2);
40 gfxPrefs::DestroySingleton();
41 ASSERT_FALSE(gfxPrefs::SingletonExists());
42 }
44 TEST(GfxPrefs, OnceValues) {
45 ASSERT_FALSE(gfxPrefs::SingletonExists());
46 gfxPrefs::GetSingleton();
47 ASSERT_TRUE(gfxPrefs::SingletonExists());
49 // Once boolean, default true
50 ASSERT_TRUE(gfxPrefs::WorkAroundDriverBugs());
52 // Once boolean, default false
53 ASSERT_FALSE(gfxPrefs::LayersDump());
55 // Once int32_t, default 95
56 ASSERT_TRUE(gfxPrefs::CanvasSkiaGLCacheSize() == 96);
58 // Once uint32_t, default 5
59 ASSERT_TRUE(gfxPrefs::APZMaxVelocityQueueSize() == 5);
61 // Once float, default -1 (should be OK with ==)
62 ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
64 gfxPrefs::DestroySingleton();
65 ASSERT_FALSE(gfxPrefs::SingletonExists());
66 }