=== modified file 'compizconfig/CMakeLists.txt'
--- compizconfig/CMakeLists.txt	2012-08-22 06:15:40 +0000
+++ compizconfig/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -21,6 +21,7 @@
 
 if (COMPIZ_BUILD_TESTING)
     add_subdirectory (mocks)
+    add_subdirectory (tests)
 endif (COMPIZ_BUILD_TESTING)
 
 add_custom_target (pyclean)

=== modified file 'compizconfig/gsettings/CMakeLists.txt'
--- compizconfig/gsettings/CMakeLists.txt	2012-08-15 06:45:13 +0000
+++ compizconfig/gsettings/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -14,6 +14,7 @@
     add_definitions (-DUSE_GCONF)
 endif (USE_GCONF)
 
+add_subdirectory (mocks)
 add_subdirectory (gsettings_backend_shared)
 
 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/gsettings_backend_shared

=== modified file 'compizconfig/gsettings/gsettings_backend_shared/CMakeLists.txt'
--- compizconfig/gsettings/gsettings_backend_shared/CMakeLists.txt	2012-08-19 10:02:23 +0000
+++ compizconfig/gsettings/gsettings_backend_shared/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -41,7 +41,6 @@
                            compizconfig_gsettings_backend_interface
                            compizconfig_gsettings_wrapper_interface
                            compizconfig
-                           compizconfig
                            ${GSETTINGS_UTIL_LIBRARIES})
 
     add_library (compizconfig_gsettings_backend SHARED

=== modified file 'compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c'
--- compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c	2012-08-17 23:50:08 +0000
+++ compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c	2012-09-25 08:42:23 +0000
@@ -223,29 +223,6 @@
     }
 }
 
-CCSContext *
-ccsGSettingsBackendGetContext (CCSBackend *backend)
-{
-    return (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendGetContext) (backend);
-}
-
-
-void
-ccsGSettingsBackendConnectToChangedSignal (CCSBackend *backend,
-					   CCSGSettingsWrapper *object)
-{
-     (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendConnectToChangedSignal) (backend, object);
-}
-
-CCSGSettingsWrapper *
-ccsGSettingsGetSettingsObjectForPluginWithPath (CCSBackend *backend,
-						const char *plugin,
-						const char *path,
-						CCSContext *context)
-{
-    return (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendGetSettingsObjectForPluginWithPath) (backend, plugin, path, context);
-}
-
 static CCSContext *
 ccsGSettingsBackendGetContextDefault (CCSBackend *backend)
 {

=== modified file 'compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend_interface.c'
--- compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend_interface.c	2012-08-13 14:41:20 +0000
+++ compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend_interface.c	2012-09-25 08:42:23 +0000
@@ -3,6 +3,29 @@
 
 INTERFACE_TYPE (CCSGSettingsBackendInterface);
 
+CCSContext *
+ccsGSettingsBackendGetContext (CCSBackend *backend)
+{
+    return (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendGetContext) (backend);
+}
+
+
+void
+ccsGSettingsBackendConnectToChangedSignal (CCSBackend *backend,
+					   CCSGSettingsWrapper *object)
+{
+     (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendConnectToChangedSignal) (backend, object);
+}
+
+CCSGSettingsWrapper *
+ccsGSettingsGetSettingsObjectForPluginWithPath (CCSBackend *backend,
+						const char *plugin,
+						const char *path,
+						CCSContext *context)
+{
+    return (*(GET_INTERFACE (CCSGSettingsBackendInterface, backend))->gsettingsBackendGetSettingsObjectForPluginWithPath) (backend, plugin, path, context);
+}
+
 const char *
 ccsGSettingsBackendGetCurrentProfile (CCSBackend *backend)
 {

=== added directory 'compizconfig/gsettings/mocks'
=== added file 'compizconfig/gsettings/mocks/CMakeLists.txt'
--- compizconfig/gsettings/mocks/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ compizconfig/gsettings/mocks/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -0,0 +1,21 @@
+pkg_check_modules (GLIB glib-2.0)
+
+if (GLIB_FOUND)
+
+    include_directories (${CMAKE_CURRENT_SOURCE_DIR}
+			 ${CMAKE_CURRENT_BINARY_DIR}
+			 ${CMAKE_CURRENT_SOURCE_DIR}/../../libcompizconfig/include
+			 ${CMAKE_CURRENT_SOURCE_DIR}/../gsettings_backend_shared
+			 ${GLIB_INCLUDE_DIRS})
+
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+
+    add_library (compizconfig_ccs_gsettings_wrapper_mock STATIC
+	         ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_wrapper_mock.cpp
+	         ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_wrapper_mock.h)
+
+    add_library (compizconfig_ccs_gsettings_backend_mock STATIC
+	         ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_backend_mock.cpp
+	         ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_backend_mock.h)
+
+endif (GLIB_FOUND)

=== renamed file 'compizconfig/gsettings/tests/ccs_gsettings_backend_mock.cpp' => 'compizconfig/gsettings/mocks/ccs_gsettings_backend_mock.cpp'
=== renamed file 'compizconfig/gsettings/tests/ccs_gsettings_backend_mock.h' => 'compizconfig/gsettings/mocks/ccs_gsettings_backend_mock.h'
=== renamed file 'compizconfig/gsettings/tests/ccs_gsettings_wrapper_mock.cpp' => 'compizconfig/gsettings/mocks/ccs_gsettings_wrapper_mock.cpp'
=== renamed file 'compizconfig/gsettings/tests/ccs_gsettings_wrapper_mock.h' => 'compizconfig/gsettings/mocks/ccs_gsettings_wrapper_mock.h'
=== modified file 'compizconfig/gsettings/tests/CMakeLists.txt'
--- compizconfig/gsettings/tests/CMakeLists.txt	2012-08-16 10:22:05 +0000
+++ compizconfig/gsettings/tests/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -2,25 +2,25 @@
 
 include_directories (${CMAKE_CURRENT_SOURCE_DIR}
 		     ${CMAKE_CURRENT_BINARY_DIR}
+		     ${CMAKE_CURRENT_SOURCE_DIR}/../mocks
+		     ${CMAKE_CURRENT_SOURCE_DIR}/../testenvironments
 		     ${CMAKE_CURRENT_SOURCE_DIR}/../src
 		     ${CMAKE_CURRENT_SOURCE_DIR}/../../libcompizconfig/tests
 		     ${CMAKE_CURRENT_SOURCE_DIR}/../../mocks/libcompizconfig
 		     ${CMAKE_CURRENT_SOURCE_DIR}/../../tests
-		     ${CMAKE_SOURCE_DIR}/tests/shared)
+                     ${CMAKE_SOURCE_DIR}/tests/shared
+                     ${CMAKE_SOURCE_DIR}/tests/shared/glib)
 
-pkg_check_modules (COMPIZCONFIG_TEST_GSETTINGS libcompizconfig)
+pkg_check_modules (COMPIZCONFIG_TEST_GSETTINGS libcompizconfig_internal)
 
 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
 
 link_directories (${CMAKE_CURRENT_BINARY_DIR}/../../libcompizconfig/tests)
-
-add_library (compizconfig_ccs_gsettings_wrapper_mock STATIC
-	     ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_wrapper_mock.cpp
-	     ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_wrapper_mock.h)
-
-add_library (compizconfig_ccs_gsettings_backend_mock STATIC
-	     ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_backend_mock.cpp
-	     ${CMAKE_CURRENT_SOURCE_DIR}/ccs_gsettings_backend_mock.h)
+link_directories (${CMAKE_CURRENT_BINARY_DIR}/../testenvironments)
+link_directories (${CMAKE_CURRENT_BINARY_DIR}/../mocks)
+
+add_library (compizconfig_gsettings_settings_test_env STATIC
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_gsettings_settings_env_test.cpp)
 
 add_executable (compizconfig_test_gsettings
 		${CMAKE_CURRENT_SOURCE_DIR}/test_gsettings_tests.cpp
@@ -38,6 +38,7 @@
                        compizconfig_ccs_context_mock
 		       compizconfig_ccs_gsettings_backend_mock
 		       compizconfig_ccs_gsettings_wrapper_mock
+                       compizconfig_ccs_test_value_combinations
 		       ${COMPIZCONFIG_TEST_GSETTINGS_LIBRARIES}
 		       ${GTEST_BOTH_LIBRARIES}
 		       ${GMOCK_MAIN_LIBRARY})
@@ -59,10 +60,18 @@
 		${CMAKE_CURRENT_BINARY_DIR}/backend-conformance-config.h)
 
 target_link_libraries (compizconfig_test_gsettings_conformance
+		       compizconfig_gsettings_settings_test_env
                        compizconfig_gsettings_backend
 		       compizconfig_ccs_setting_mock
 		       compizconfig_ccs_plugin_mock
 		       compizconfig_ccs_context_mock
+                       compizconfig_ccs_item_in_list_matcher
+                       compizconfig_ccs_list_equality
+                       compizconfig_ccs_list_wrapper
+                       compizconfig_ccs_backend_conformance_test
+                       compizconfig_ccs_setting_value_operators
+                       compizconfig_ccs_test_value_combinations
+		       compizconfig_ccs_integration_mock
 		       ${COMPIZCONFIG_TEST_GSETTINGS_LIBRARIES}
 		       ${GTEST_BOTH_LIBRARIES}
 		       ${GMOCK_MAIN_LIBRARY})

=== added file 'compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.cpp'
--- compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,364 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <gio/gio.h>
+#include <gsettings_util.h>
+#include <ccs_gsettings_backend_interface.h>
+
+#include <gtest_shared_autodestroy.h>
+#include <gtest_shared_characterwrapper.h>
+#include "test_gsettings_tests.h"
+
+#include <glib_gslice_off_env.h>
+#include <glib_gsettings_memory_backend_env.h>
+
+#include "compizconfig_ccs_gsettings_settings_env_test.h"
+
+#include "backend-conformance-config.h"
+#include "gsettings-mock-schemas-config.h"
+
+namespace cci = compiz::config::impl;
+namespace cct = compizconfig::test;
+
+class PrivateCCSGSettingsStorageEnv
+{
+    public:
+
+	PrivateCCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
+				       const std::string   &profileName);
+
+	CCSGSettingsWrapper                        *mSettings;
+	std::string	                           profileName;
+	CompizGLibGSettingsMemoryBackendTestingEnv gsettingsEnv;
+	CompizGLibGSliceOffEnv			   gsliceEnv;
+};
+
+void
+CCSGSettingsStorageEnv::WriteBoolAtKey (const std::string  &plugin,
+					const std::string  &key,
+					const VariantTypes &value)
+{
+    GVariant *variant = NULL;
+    if (writeBoolToVariant (cct::boolToBool (boost::get <bool> (value)), &variant))
+	writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
+    else
+	throw std::exception ();
+}
+
+void
+CCSGSettingsStorageEnv::WriteIntegerAtKey (const std::string  &plugin,
+					   const std::string  &key,
+					   const VariantTypes &value)
+{
+    GVariant *variant = NULL;
+    if (writeIntToVariant (boost::get <int> (value), &variant))
+	writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
+    else
+	throw std::exception ();
+}
+
+void
+CCSGSettingsStorageEnv::WriteFloatAtKey (const std::string  &plugin,
+					 const std::string  &key,
+					 const VariantTypes &value)
+{
+    GVariant *variant = NULL;
+    if (writeFloatToVariant (boost::get <float> (value), &variant))
+	writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
+    else
+	throw std::exception ();
+}
+
+void
+CCSGSettingsStorageEnv::WriteStringAtKey (const std::string  &plugin,
+					  const std::string  &key,
+					  const VariantTypes &value)
+{
+    GVariant *variant = NULL;
+    if (writeStringToVariant (boost::get <const char *> (value), &variant))
+	writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
+    else
+	throw std::exception ();
+}
+
+void
+CCSGSettingsStorageEnv::WriteColorAtKey (const std::string  &plugin,
+					 const std::string  &key,
+					 const VariantTypes &value)
+{
+    GVariant *variant = NULL;
+    if (writeColorToVariant (boost::get <CCSSettingColorValue> (value), &variant))
+	writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
+    else
+	throw std::exception ();
+}
+
+void
+CCSGSettingsStorageEnv::WriteKeyAtKey (const std::string  &plugin,
+				       const std::string  &key,
+				       const VariantTypes &value)
+{
+    GVariant *variant = NULL;
+    if (writeKeyToVariant (boost::get <CCSSettingKeyValue> (value), &variant))
+	writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
+    else
+	throw std::exception ();
+}
+
+void
+CCSGSettingsStorageEnv::WriteButtonAtKey (const std::string  &plugin,
+					  const std::string  &key,
+					  const VariantTypes &value)
+{
+    GVariant *variant = NULL;
+    if (writeButtonToVariant (boost::get <CCSSettingButtonValue> (value), &variant))
+	writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
+    else
+	throw std::exception ();
+}
+
+void
+CCSGSettingsStorageEnv::WriteEdgeAtKey (const std::string  &plugin,
+					const std::string  &key,
+					const VariantTypes &value)
+{
+    GVariant *variant = NULL;
+    if (writeEdgeToVariant (boost::get <unsigned int> (value), &variant))
+	writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
+    else
+	throw std::exception ();
+}
+
+void
+CCSGSettingsStorageEnv::WriteMatchAtKey (const std::string  &plugin,
+					const std::string  &key,
+					const VariantTypes &value)
+{
+    GVariant *variant = NULL;
+    if (writeStringToVariant (boost::get <const char *> (value), &variant))
+	writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
+    else
+	throw std::exception ();
+}
+
+void
+CCSGSettingsStorageEnv::WriteBellAtKey (const std::string  &plugin,
+					const std::string  &key,
+					const VariantTypes &value)
+{
+    GVariant *variant = NULL;
+    if (writeBoolToVariant (cct::boolToBool (boost::get <bool> (value)), &variant))
+	writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
+    else
+	throw std::exception ();
+}
+
+void
+CCSGSettingsStorageEnv::WriteListAtKey (const std::string  &plugin,
+					const std::string  &key,
+					const VariantTypes &value)
+{
+    GVariant *variant = NULL;
+
+    const cci::SettingValueListWrapper::Ptr &lw (boost::get <cci::SettingValueListWrapper::Ptr> (value));
+
+    if (writeListValue (*lw, lw->type (), &variant))
+	writeVariantToKey (priv->mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
+    else
+	throw std::exception ();
+}
+
+Bool
+CCSGSettingsStorageEnv::ReadBoolAtKey (const std::string &plugin,
+				       const std::string &key)
+{
+    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
+						      key,
+						      TypeBool));
+    return readBoolFromVariant (variant.get ());
+}
+
+
+int
+CCSGSettingsStorageEnv::ReadIntegerAtKey (const std::string &plugin,
+					  const std::string &key)
+{
+    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
+						      key,
+						      TypeInt));
+    return readIntFromVariant (variant.get ());
+}
+
+float
+CCSGSettingsStorageEnv::ReadFloatAtKey (const std::string &plugin,
+					const std::string &key)
+{
+    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
+						      key,
+						      TypeFloat));
+    return readFloatFromVariant (variant.get ());
+}
+
+const char *
+CCSGSettingsStorageEnv::ReadStringAtKey (const std::string &plugin,
+					 const std::string &key)
+{
+    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
+						      key,
+						      TypeString));
+    return readStringFromVariant (variant.get ());
+}
+
+CCSSettingColorValue
+CCSGSettingsStorageEnv::ReadColorAtKey (const std::string &plugin,
+					const std::string &key)
+{
+    Bool success = FALSE;
+    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
+						      key,
+						      TypeColor));
+    CCSSettingColorValue value = readColorFromVariant (variant.get (), &success);
+    EXPECT_TRUE (success);
+    return value;
+}
+
+CCSSettingKeyValue
+CCSGSettingsStorageEnv::ReadKeyAtKey (const std::string &plugin,
+				      const std::string &key)
+{
+    Bool success = FALSE;
+    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
+						      key,
+						      TypeKey));
+    CCSSettingKeyValue value = readKeyFromVariant (variant.get (), &success);
+    EXPECT_TRUE (success);
+    return value;
+}
+
+CCSSettingButtonValue
+CCSGSettingsStorageEnv::ReadButtonAtKey (const std::string &plugin,
+					  const std::string &key)
+{
+    Bool success = FALSE;
+    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
+						      key,
+						      TypeButton));
+    CCSSettingButtonValue value = readButtonFromVariant (variant.get (), &success);
+    EXPECT_TRUE (success);
+    return value;
+}
+
+unsigned int
+CCSGSettingsStorageEnv::ReadEdgeAtKey (const std::string &plugin,
+					  const std::string &key)
+{
+    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
+						      key,
+						      TypeEdge));
+    return readEdgeFromVariant (variant.get ());
+}
+
+const char *
+CCSGSettingsStorageEnv::ReadMatchAtKey (const std::string &plugin,
+					const std::string &key)
+{
+    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
+						      key,
+						      TypeMatch));
+    return readStringFromVariant (variant.get ());
+}
+
+Bool
+CCSGSettingsStorageEnv::ReadBellAtKey (const std::string &plugin,
+				       const std::string &key)
+{
+    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
+						      key,
+						      TypeBell));
+    return readBoolFromVariant (variant.get ());
+}
+
+CCSSettingValueList
+CCSGSettingsStorageEnv::ReadListAtKey (const std::string &plugin,
+				       const std::string &key,
+				       CCSSetting        *setting)
+{
+    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
+						      key,
+						      TypeList));
+    return readListValue (variant.get (), setting, &ccsDefaultObjectAllocator);
+}
+
+GVariantShared
+CCSGSettingsStorageEnv::ReadVariantAtKeyToShared (const std::string &plugin,
+						  const std::string &key,
+						  CCSSettingType    type)
+{
+    CharacterWrapper translatedKey (translateKeyForGSettings (key.c_str ()));
+    CharacterWrapper pluginPath (makeCompizPluginPath (priv->profileName.c_str (),
+						       plugin.c_str ()));
+
+    GVariant *rawVariant = getVariantAtKey (priv->mSettings,
+					    translatedKey,
+					    pluginPath,
+					    type);
+
+    GVariantShared shared (AutoDestroy (rawVariant, g_variant_unref));
+
+
+
+    return shared;
+}
+
+void
+CCSGSettingsStorageEnv::SetUp ()
+{
+    g_type_init ();
+    priv->gsliceEnv.SetUpEnv ();
+    priv->gsettingsEnv.SetUpEnv (MOCK_PATH);
+}
+
+void
+CCSGSettingsStorageEnv::TearDown ()
+{
+    priv->gsettingsEnv.TearDownEnv ();
+    priv->gsliceEnv.TearDownEnv ();
+}
+
+PrivateCCSGSettingsStorageEnv::PrivateCCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
+							      const std::string   &profileName) :
+    mSettings (settings),
+    profileName (profileName)
+
+{
+}
+
+CCSGSettingsStorageEnv::CCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
+						const std::string   &profileName) :
+    priv (new PrivateCCSGSettingsStorageEnv (settings,
+					     profileName))
+{
+}

=== added file 'compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.h'
--- compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.h	1970-01-01 00:00:00 +0000
+++ compizconfig/gsettings/tests/compizconfig_ccs_gsettings_settings_env_test.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,134 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_CCS_GSETTINGS_SETTINGS_ENV_TEST_H
+#define _COMPIZCONFIG_CCS_GSETTINGS_SETTINGS_ENV_TEST_H
+
+#include <memory>
+#include <boost/shared_ptr.hpp>
+
+#include "compizconfig_ccs_settings_test_fixture.h"
+
+typedef boost::shared_ptr <GVariant> GVariantShared;
+typedef struct _CCSSetting CCSSetting;
+typedef struct _CCSGSettingsWrapper CCSGSettingsWrapper;
+typedef enum   _CCSSettingType CCSSettingType;
+
+class PrivateCCSGSettingsStorageEnv;
+
+class CCSGSettingsStorageEnv :
+    public CCSSettingsConceptTestEnvironmentInterface
+{
+    public:
+
+	virtual void SetUp ();
+	virtual void TearDown ();
+
+	CCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
+				const std::string   &profileName);
+
+	void WriteBoolAtKey (const std::string  &plugin,
+			     const std::string  &key,
+			     const VariantTypes &value);
+	void WriteIntegerAtKey (const std::string  &plugin,
+				const std::string  &key,
+				const VariantTypes &value);
+
+	void WriteFloatAtKey (const std::string &plugin,
+			      const std::string  &key,
+			      const VariantTypes  &value);
+
+	void WriteStringAtKey (const std::string &plugin,
+			       const std::string  &key,
+			       const VariantTypes  &value);
+
+	void WriteColorAtKey (const std::string  &plugin,
+			      const std::string  &key,
+			      const VariantTypes &value);
+
+	void WriteKeyAtKey (const std::string  &plugin,
+			    const std::string  &key,
+			    const VariantTypes &value);
+
+	void WriteButtonAtKey (const std::string &plugin,
+			       const std::string &key,
+			       const VariantTypes &value);
+
+	void WriteEdgeAtKey (const std::string  &plugin,
+			     const std::string  &key,
+			     const VariantTypes &value);
+
+	void WriteMatchAtKey (const std::string  &plugin,
+			      const std::string  &key,
+			      const VariantTypes &value);
+
+	void WriteBellAtKey (const std::string  &plugin,
+			     const std::string  &key,
+			     const VariantTypes &value);
+
+	void WriteListAtKey (const std::string  &plugin,
+			     const std::string  &key,
+			     const VariantTypes &value);
+
+	Bool ReadBoolAtKey (const std::string &plugin,
+			    const std::string &key);
+
+	int ReadIntegerAtKey (const std::string &plugin,
+			      const std::string &key);
+
+	float ReadFloatAtKey (const std::string &plugin,
+			      const std::string &key);
+
+	const char * ReadStringAtKey (const std::string &plugin,
+				      const std::string &key);
+
+	CCSSettingColorValue ReadColorAtKey (const std::string &plugin,
+					     const std::string &key);
+
+	CCSSettingKeyValue ReadKeyAtKey (const std::string &plugin,
+					 const std::string &key);
+	CCSSettingButtonValue ReadButtonAtKey (const std::string &plugin,
+					       const std::string &key);
+
+	unsigned int ReadEdgeAtKey (const std::string &plugin,
+				    const std::string &key);
+
+	const char * ReadMatchAtKey (const std::string &plugin,
+				     const std::string &key);
+	Bool ReadBellAtKey (const std::string &plugin,
+			    const std::string &key);
+
+	CCSSettingValueList ReadListAtKey (const std::string &plugin,
+					   const std::string &key,
+					   CCSSetting        *setting);
+
+    private:
+
+	GVariantShared
+	ReadVariantAtKeyToShared (const std::string &plugin,
+				  const std::string &key,
+				  CCSSettingType    type);
+
+	std::auto_ptr <PrivateCCSGSettingsStorageEnv> priv;
+};
+
+#endif

=== modified file 'compizconfig/gsettings/tests/gsettings-mock-schemas-config.h.in'
--- compizconfig/gsettings/tests/gsettings-mock-schemas-config.h.in	2012-08-11 11:05:13 +0000
+++ compizconfig/gsettings/tests/gsettings-mock-schemas-config.h.in	2012-09-25 08:42:23 +0000
@@ -3,6 +3,8 @@
 
 #define MOCK_SCHEMA_PATH "@CMAKE_BINARY_DIR@/generated/glib-2.0/schemas"
 
+#include <string>
+
 namespace
 {
 const std::string MOCK_SCHEMA ("org.compiz.mock");

=== added file 'compizconfig/gsettings/tests/gsettings_settings_test_fixture.h'
--- compizconfig/gsettings/tests/gsettings_settings_test_fixture.h	1970-01-01 00:00:00 +0000
+++ compizconfig/gsettings/tests/gsettings_settings_test_fixture.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,29 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_GSETTINGS_SETTINGS_TEST_FIXTURE_H
+#define _COMPIZCONFIG_GSETTINGS_SETTINGS_TEST_FIXTURE_H
+
+#include <gtest/gtest.h>
+#include <glib_gsettings_memory_backend_env.h>
+
+#endif

=== modified file 'compizconfig/gsettings/tests/test_gsettings_conformance.cpp'
--- compizconfig/gsettings/tests/test_gsettings_conformance.cpp	2012-09-18 23:56:02 +0000
+++ compizconfig/gsettings/tests/test_gsettings_conformance.cpp	2012-09-25 08:42:23 +0000
@@ -1,3 +1,25 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
@@ -15,441 +37,15 @@
 #include "gtest_shared_autodestroy.h"
 #include "test_gsettings_tests.h"
 
+#include "compizconfig_ccs_gsettings_settings_env_test.h"
+#include "compizconfig_ccs_integration_mock.h"
+
 using ::testing::AtLeast;
 using ::testing::Pointee;
 using ::testing::ReturnNull;
 
 namespace cci = compiz::config::impl;
 
-CCSIntegration *
-ccsMockIntegrationBackendNew (CCSObjectAllocationInterface *ai);
-
-void
-ccsMockIntegrationBackendFree (CCSIntegration *integration);
-
-class CCSIntegrationGMockInterface
-{
-    public:
-
-	virtual ~CCSIntegrationGMockInterface () {}
-
-	virtual CCSIntegratedSetting * getIntegratedOptionIndex (const char *pluginName, const char *settingName) = 0;
-	virtual Bool readOptionIntoSetting (CCSContext *context, CCSSetting *setting, CCSIntegratedSetting *) = 0;
-	virtual void writeOptionFromSetting (CCSContext *context, CCSSetting *setting, CCSIntegratedSetting *) = 0;
-	virtual void updateIntegratedSettings (CCSContext *context, CCSIntegratedSettingList settingList) = 0;
-	virtual void disallowIntegratedWrites () = 0;
-	virtual void allowIntegratedWrites () = 0;
-};
-
-class CCSIntegrationGMock :
-    public CCSIntegrationGMockInterface
-{
-    public:
-
-	MOCK_METHOD2 (getIntegratedOptionIndex, CCSIntegratedSetting * (const char *, const char *));
-	MOCK_METHOD3 (readOptionIntoSetting, Bool (CCSContext *, CCSSetting *, CCSIntegratedSetting *));
-	MOCK_METHOD3 (writeOptionFromSetting, void (CCSContext *, CCSSetting *, CCSIntegratedSetting *));
-	MOCK_METHOD2 (updateIntegratedSettings, void (CCSContext *, CCSIntegratedSettingList));
-	MOCK_METHOD0 (disallowIntegratedWrites, void ());
-	MOCK_METHOD0 (allowIntegratedWrites, void ());
-
-
-	CCSIntegrationGMock (CCSIntegration *integration) :
-	    mIntegration (integration)
-	{
-	}
-
-	CCSIntegration *
-	getIntegrationBackend ()
-	{
-	    return mIntegration;
-	}
-
-    public:
-
-	static
-	CCSIntegratedSetting * CCSIntegrationGetIntegratedOptionIndex (CCSIntegration *integration,
-								       const char *pluginName,
-								       const char *settingName)
-	{
-	    return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->getIntegratedOptionIndex (pluginName, settingName);
-	}
-
-	static
-	Bool CCSIntegrationReadOptionIntoSetting (CCSIntegration *integration,
-						  CCSContext		  *context,
-						  CCSSetting		  *setting,
-						  CCSIntegratedSetting *integrated)
-	{
-	    return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->readOptionIntoSetting (context, setting, integrated);
-	}
-
-	static
-	void CCSIntegrationWriteSettingIntoOption  (CCSIntegration *integration,
-						    CCSContext		   *context,
-						    CCSSetting		   *setting,
-						    CCSIntegratedSetting *integrated)
-	{
-	    return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->writeOptionFromSetting (context, setting, integrated);
-	}
-
-	static void CCSIntegrationUpdateIntegratedSettings (CCSIntegration *integration,
-							    CCSContext	   *context,
-							    CCSIntegratedSettingList settingList)
-	{
-	    return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->updateIntegratedSettings (context, settingList);
-	}
-
-	static
-	void ccsFreeIntegration (CCSIntegration *integration)
-	{
-	    ccsMockIntegrationBackendFree (integration);
-	}
-
-	static void ccsIntegrationDisallowIntegratedWrites (CCSIntegration *integration)
-	{
-	    reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->disallowIntegratedWrites ();
-	}
-
-	static void ccsIntegrationAllowIntegratedWrites (CCSIntegration *integration)
-	{
-	    reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->allowIntegratedWrites ();
-	}
-
-    private:
-
-	CCSIntegration *mIntegration;
-};
-
-const CCSIntegrationInterface mockIntegrationBackendInterface =
-{
-    CCSIntegrationGMock::CCSIntegrationGetIntegratedOptionIndex,
-    CCSIntegrationGMock::CCSIntegrationReadOptionIntoSetting,
-    CCSIntegrationGMock::CCSIntegrationWriteSettingIntoOption,
-    CCSIntegrationGMock::CCSIntegrationUpdateIntegratedSettings,
-    CCSIntegrationGMock::ccsIntegrationDisallowIntegratedWrites,
-    CCSIntegrationGMock::ccsIntegrationAllowIntegratedWrites,
-    CCSIntegrationGMock::ccsFreeIntegration
-};
-
-CCSIntegration *
-ccsMockIntegrationBackendNew (CCSObjectAllocationInterface *ai)
-{
-    CCSIntegration *integration = reinterpret_cast <CCSIntegration *> ((*ai->calloc_) (ai->allocator, 1, sizeof (CCSIntegration)));
-
-    if (!integration)
-	return NULL;
-
-    CCSIntegrationGMock *gmockBackend = new CCSIntegrationGMock (integration);
-
-    ccsObjectInit (integration, ai);
-    ccsObjectSetPrivate (integration, (CCSPrivate *) gmockBackend);
-    ccsObjectAddInterface (integration, (const CCSInterface *) &mockIntegrationBackendInterface, GET_INTERFACE_TYPE (CCSIntegrationInterface));
-
-    ccsObjectRef (integration);
-
-    return integration;
-}
-
-void
-ccsMockIntegrationBackendFree (CCSIntegration *integration)
-{
-    CCSIntegrationGMock *gmockBackend = reinterpret_cast <CCSIntegrationGMock *> (ccsObjectGetPrivate (integration));
-
-    delete gmockBackend;
-
-    ccsObjectSetPrivate (integration, NULL);
-    ccsObjectFinalize (integration);
-    (*integration->object.object_allocation->free_) (integration->object.object_allocation->allocator, integration);
-}
-
-class CCSGSettingsStorageEnv :
-    public CCSSettingsConceptTestEnvironmentInterface,
-    public CCSGSettingsMemoryBackendTestingEnv
-{
-    public:
-
-	typedef boost::shared_ptr <GVariant> GVariantShared;
-
-	virtual void SetUp ()
-	{
-	    SetUpEnv ();
-	}
-
-	virtual void TearDown ()
-	{
-	    TearDownEnv ();
-	}
-
-	CCSGSettingsStorageEnv (CCSGSettingsWrapper *settings,
-				const std::string   &profileName) :
-	    mSettings (settings),
-	    profileName (profileName)
-	{
-	}
-
-	void WriteBoolAtKey (const std::string &plugin,
-			     const std::string &key,
-			     const VariantTypes &value)
-	{
-	    GVariant *variant = NULL;
-	    if (writeBoolToVariant (boolToBool (boost::get <bool> (value)), &variant))
-		writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
-	    else
-		throw std::exception ();
-	}
-
-	void WriteIntegerAtKey (const std::string &plugin,
-				const std::string &key,
-				const VariantTypes &value)
-	{
-	    GVariant *variant = NULL;
-	    if (writeIntToVariant (boost::get <int> (value), &variant))
-		writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
-	    else
-		throw std::exception ();
-	}
-
-	void WriteFloatAtKey (const std::string &plugin,
-				      const std::string &key,
-				      const VariantTypes &value)
-	{
-	    GVariant *variant = NULL;
-	    if (writeFloatToVariant (boost::get <float> (value), &variant))
-		writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
-	    else
-		throw std::exception ();
-	}
-
-	void WriteStringAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value)
-	{
-	    GVariant *variant = NULL;
-	    if (writeStringToVariant (boost::get <const char *> (value), &variant))
-		writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
-	    else
-		throw std::exception ();
-	}
-
-	void WriteColorAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value)
-	{
-	    GVariant *variant = NULL;
-	    if (writeColorToVariant (boost::get <CCSSettingColorValue> (value), &variant))
-		writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
-	    else
-		throw std::exception ();
-	}
-
-	void WriteKeyAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value)
-	{
-	    GVariant *variant = NULL;
-	    if (writeKeyToVariant (boost::get <CCSSettingKeyValue> (value), &variant))
-		writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
-	    else
-		throw std::exception ();
-	}
-
-	void WriteButtonAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value)
-	{
-	    GVariant *variant = NULL;
-	    if (writeButtonToVariant (boost::get <CCSSettingButtonValue> (value), &variant))
-		writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
-	    else
-		throw std::exception ();
-	}
-
-	void WriteEdgeAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value)
-	{
-	    GVariant *variant = NULL;
-	    if (writeEdgeToVariant (boost::get <unsigned int> (value), &variant))
-		writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
-	    else
-		throw std::exception ();
-	}
-
-	void WriteMatchAtKey (const std::string &plugin,
-				      const std::string &key,
-				      const VariantTypes &value)
-	{
-	    GVariant *variant = NULL;
-	    if (writeStringToVariant (boost::get <const char *> (value), &variant))
-		writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
-	    else
-		throw std::exception ();
-	}
-
-	void WriteBellAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value)
-	{
-	    GVariant *variant = NULL;
-	    if (writeBoolToVariant (boolToBool (boost::get <bool> (value)), &variant))
-		writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
-	    else
-		throw std::exception ();
-	}
-
-	void WriteListAtKey (const std::string &plugin,
-				     const std::string &key,
-				     const VariantTypes &value)
-	{
-	    GVariant *variant = NULL;
-
-	    const cci::SettingValueListWrapper::Ptr &lw (boost::get <cci::SettingValueListWrapper::Ptr> (value));
-
-	    if (writeListValue (*lw, lw->type (), &variant))
-		writeVariantToKey (mSettings, CharacterWrapper (translateKeyForGSettings (key.c_str ())), variant);
-	    else
-		throw std::exception ();
-	}
-
-	Bool ReadBoolAtKey (const std::string &plugin,
-			    const std::string &key)
-	{
-	    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
-							      key,
-							      TypeBool));
-	    return readBoolFromVariant (variant.get ());
-	}
-
-	int ReadIntegerAtKey (const std::string &plugin,
-					const std::string &key)
-	{
-	    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
-							      key,
-							      TypeInt));
-	    return readIntFromVariant (variant.get ());
-	}
-
-	float ReadFloatAtKey (const std::string &plugin,
-				      const std::string &key)
-	{
-	    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
-							      key,
-							      TypeFloat));
-	    return readFloatFromVariant (variant.get ());
-	}
-
-	const char * ReadStringAtKey (const std::string &plugin,
-				      const std::string &key)
-	{
-	    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
-							      key,
-							      TypeString));
-	    return readStringFromVariant (variant.get ());
-	}
-
-	CCSSettingColorValue ReadColorAtKey (const std::string &plugin,
-				       const std::string &key)
-	{
-	    Bool success = FALSE;
-	    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
-							      key,
-							      TypeColor));
-	    CCSSettingColorValue value = readColorFromVariant (variant.get (), &success);
-	    EXPECT_TRUE (success);
-	    return value;
-	}
-
-	CCSSettingKeyValue ReadKeyAtKey (const std::string &plugin,
-				       const std::string &key)
-	{
-	    Bool success = FALSE;
-	    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
-							      key,
-							      TypeKey));
-	    CCSSettingKeyValue value = readKeyFromVariant (variant.get (), &success);
-	    EXPECT_TRUE (success);
-	    return value;
-	}
-
-	CCSSettingButtonValue ReadButtonAtKey (const std::string &plugin,
-				       const std::string &key)
-	{
-	    Bool success = FALSE;
-	    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
-							      key,
-							      TypeButton));
-	    CCSSettingButtonValue value = readButtonFromVariant (variant.get (), &success);
-	    EXPECT_TRUE (success);
-	    return value;
-	}
-
-	unsigned int ReadEdgeAtKey (const std::string &plugin,
-				       const std::string &key)
-	{
-	    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
-							      key,
-							      TypeEdge));
-	    return readEdgeFromVariant (variant.get ());
-	}
-
-	const char * ReadMatchAtKey (const std::string &plugin,
-				     const std::string &key)
-	{
-	    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
-							      key,
-							      TypeMatch));
-	    return readStringFromVariant (variant.get ());
-	}
-
-	Bool ReadBellAtKey (const std::string &plugin,
-				       const std::string &key)
-	{
-	    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
-							      key,
-							      TypeBell));
-	    return readBoolFromVariant (variant.get ());
-	}
-
-	CCSSettingValueList ReadListAtKey (const std::string &plugin,
-					   const std::string &key,
-					   CCSSetting        *setting)
-	{
-	    GVariantShared variant (ReadVariantAtKeyToShared (plugin,
-							      key,
-							      TypeList));
-	    return readListValue (variant.get (), setting, &ccsDefaultObjectAllocator);
-	}
-
-    private:
-
-	GVariantShared
-	ReadVariantAtKeyToShared (const std::string   &plugin,
-				  const std::string   &key,
-				  CCSSettingType	  type)
-	{
-	    CharacterWrapper translatedKey (translateKeyForGSettings (key.c_str ()));
-	    CharacterWrapper pluginPath (makeCompizPluginPath (profileName.c_str (),
-							       plugin.c_str ()));
-
-	    GVariant *rawVariant = getVariantAtKey (mSettings,
-						    translatedKey,
-						    pluginPath,
-						    type);
-
-	    GVariantShared shared (AutoDestroy (rawVariant, g_variant_unref));
-
-
-
-	    return shared;
-	}
-
-	CCSGSettingsWrapper  *mSettings;
-	std::string	     profileName;
-
-
-};
-
 class CCSGSettingsBackendEnv :
     public CCSBackendConceptTestEnvironmentInterface,
     public CCSGSettingsMemoryBackendTestingEnv
@@ -551,7 +147,6 @@
 
 	    ccsFreeDynamicBackend (mBackend);
 
-	    ccsGSettingsWrapperUnref (mSettings);
 	    mStorage.reset ();
 
 	    g_variant_unref (pluginKeys);

=== modified file 'compizconfig/gsettings/tests/test_gsettings_tests.h'
--- compizconfig/gsettings/tests/test_gsettings_tests.h	2012-08-17 14:59:52 +0000
+++ compizconfig/gsettings/tests/test_gsettings_tests.h	2012-09-25 08:42:23 +0000
@@ -1,9 +1,33 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
 #ifndef _COMPIZCONFIG_TEST_GSETTINGS_TESTS_H
 #define _COMPIZCONFIG_TEST_GSETTINGS_TESTS_H
 
 #include <gtest/gtest.h>
 #include <glib.h>
 #include <glib-object.h>
+#include <glib_gslice_off_env.h>
+#include <glib_gsettings_memory_backend_env.h>
 #include <gsettings-mock-schemas-config.h>
 
 using ::testing::TestWithParam;
@@ -52,9 +76,29 @@
 	}
 };
 
+class CCSGSettingsTestCommon :
+    public ::testing::Test
+{
+    public:
+
+	virtual void SetUp ()
+	{
+	    env.SetUpEnv ();
+	}
+
+	virtual void TearDown ()
+	{
+	    env.TearDownEnv ();
+	}
+
+    private:
+
+	CompizGLibGSliceOffEnv env;
+};
+
 class CCSGSettingsTest :
-    public CCSGSettingsTestingEnv,
-    public ::testing::TestWithParam <CCSGSettingsTeardownSetupInterface *>
+    public CCSGSettingsTestCommon,
+    public ::testing::WithParamInterface <CCSGSettingsTeardownSetupInterface *>
 {
     public:
 
@@ -65,13 +109,13 @@
 
 	virtual void SetUp ()
 	{
-	    CCSGSettingsTestingEnv::SetUpEnv ();
+	    CCSGSettingsTestCommon::SetUp ();
 	    mFuncs->SetUp ();
 	}
 
 	virtual void TearDown ()
 	{
-	    CCSGSettingsTestingEnv::TearDownEnv ();
+	    CCSGSettingsTestCommon::TearDown ();
 	    mFuncs->TearDown ();
 	}
 
@@ -81,41 +125,40 @@
 };
 
 class CCSGSettingsTestIndependent :
-    public CCSGSettingsTestingEnv,
-    public ::testing::Test
+    public CCSGSettingsTestCommon
 {
     public:
 
 	virtual void SetUp ()
 	{
+	    CCSGSettingsTestCommon::SetUp ();
 	    g_type_init ();
-
-	    CCSGSettingsTestingEnv::SetUpEnv ();
 	}
 
 	virtual void TearDown ()
 	{
-	    CCSGSettingsTestingEnv::TearDownEnv ();
+	    CCSGSettingsTestCommon::TearDown ();
 	}
 };
 
 class CCSGSettingsTestWithMemoryBackend :
-    public CCSGSettingsTestIndependent,
-    public CCSGSettingsMemoryBackendTestingEnv
+    public CCSGSettingsTestIndependent
 {
     public:
 
 	virtual void SetUp ()
 	{
 	    CCSGSettingsTestIndependent::SetUp ();
-	    CCSGSettingsMemoryBackendTestingEnv::SetUpEnv ();
+	    env.SetUpEnv (MOCK_PATH);
 	}
 
 	virtual void TearDown ()
 	{
-	    CCSGSettingsMemoryBackendTestingEnv::TearDownEnv ();
-	    CCSGSettingsTestIndependent::TearDown ();
+	    env.TearDownEnv ();
 	}
+    private:
+
+	CompizGLibGSettingsMemoryBackendTestingEnv env;
 };
 
 #endif

=== modified file 'compizconfig/integration/gnome/CMakeLists.txt'
--- compizconfig/integration/gnome/CMakeLists.txt	2012-08-18 13:15:30 +0000
+++ compizconfig/integration/gnome/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -38,4 +38,8 @@
 			   compizconfig
 			${COMPIZCONFIG_GNOME_INTEGRATION_LIBRARIES})
 
+    if (COMPIZ_BUILD_TESTING)
+	add_subdirectory (tests)
+    endif (COMPIZ_BUILD_TESTING)
+
 endif (COMPIZCONFIG_GNOME_INTEGRATION_FOUND)

=== modified file 'compizconfig/integration/gnome/gconf/src/ccs_gnome_integration_gconf_integrated_setting.c'
--- compizconfig/integration/gnome/gconf/src/ccs_gnome_integration_gconf_integrated_setting.c	2012-08-17 07:33:02 +0000
+++ compizconfig/integration/gnome/gconf/src/ccs_gnome_integration_gconf_integrated_setting.c	2012-09-25 08:42:23 +0000
@@ -63,7 +63,8 @@
     {
 	ccsError ("NULL encountered while reading GConf setting");
 	free (gnomeKeyPath);
-	return v;
+	free (v);
+	return NULL;
     }
 
     if (err)
@@ -71,7 +72,8 @@
 	ccsError ("%s", err->message);
 	g_error_free (err);
 	free (gnomeKeyPath);
-	return v;
+	free (v);
+	return NULL;
     }
 
     switch (type)
@@ -80,6 +82,8 @@
 	    if (gconfValue->type != GCONF_VALUE_INT)
 	    {
 		ccsError ("Expected integer value");
+		free (v);
+		v = NULL;
 		break;
 	    }
 
@@ -89,6 +93,8 @@
 	    if (gconfValue->type != GCONF_VALUE_BOOL)
 	    {
 		ccsError ("Expected boolean value");
+		free (v);
+		v = NULL;
 		break;
 	    }
 
@@ -99,6 +105,8 @@
 	    if (gconfValue->type != GCONF_VALUE_STRING)
 	    {
 		ccsError ("Expected string value");
+		free (v);
+		v = NULL;
 		break;
 	    }
 
@@ -220,10 +228,17 @@
     ccsGConfIntegratedSettingFree ((CCSIntegratedSetting *) info);
 }
 
+void
+ccsGConfGNOMEIntegratedSettingInfoFree (CCSGNOMEIntegratedSettingInfo *info)
+{
+    ccsGConfIntegratedSettingFree ((CCSIntegratedSetting *) info);
+}
+
 const CCSGNOMEIntegratedSettingInfoInterface ccsGConfGNOMEIntegratedSettingInfoInterface =
 {
     ccsGConfIntegratedSettingGetSpecialOptionType,
-    ccsGConfIntegratedSettingGetGNOMEName
+    ccsGConfIntegratedSettingGetGNOMEName,
+    ccsGConfGNOMEIntegratedSettingInfoFree
 };
 
 const CCSIntegratedSettingInterface ccsGConfIntegratedSettingInterface =

=== modified file 'compizconfig/integration/gnome/gsettings/CMakeLists.txt'
--- compizconfig/integration/gnome/gsettings/CMakeLists.txt	2012-08-18 13:15:30 +0000
+++ compizconfig/integration/gnome/gsettings/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -71,6 +71,10 @@
 
 	endif (GLIB_COMPILE_SCHEMAS)
 
+	if (COMPIZ_BUILD_TESTING)
+	    add_subdirectory (tests)
+	endif (COMPIZ_BUILD_TESTING)
+
     endif (COMPIZCONFIG_GNOME_GSETTINGS_INTEGRATION_FOUND)
 
 endif (USE_GSETTINGS)

=== modified file 'compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting.c'
--- compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting.c	2012-08-17 07:33:02 +0000
+++ compizconfig/integration/gnome/gsettings/src/ccs_gnome_integration_gsettings_integrated_setting.c	2012-09-25 08:42:23 +0000
@@ -55,7 +55,11 @@
     GVariant *variant = ccsGSettingsWrapperGetValue (priv->wrapper, gsettingsTranslatedName);
 
     if (!variant)
+    {
 	free (gsettingsTranslatedName);
+	free (v);
+	return NULL;
+    }
 
     const GVariantType *variantType = G_VARIANT_TYPE (g_variant_get_type_string (variant));
 
@@ -65,6 +69,8 @@
 	    if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_INT32))
 	    {
 		ccsError ("Expected integer value");
+		free (v);
+		v = NULL;
 		break;
 	    }
 
@@ -74,6 +80,8 @@
 	    if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_BOOLEAN))
 	    {
 		ccsError ("Expected boolean value");
+		free (v);
+		v = NULL;
 		break;
 	    }
 
@@ -84,6 +92,8 @@
 	    if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_STRING))
 	    {
 		ccsError ("Expected string value");
+		free (v);
+		v = NULL;
 		break;
 	    }
 
@@ -96,6 +106,8 @@
 	    if (!g_variant_type_equal (variantType, G_VARIANT_TYPE ("as")))
 	    {
 		ccsError ("Expected array-of-string value");
+		free (v);
+		v = NULL;
 		break;
 	    }
 
@@ -127,8 +139,9 @@
     const char			     *gnomeKeyName = ccsGNOMEIntegratedSettingInfoGetGNOMEName ((CCSGNOMEIntegratedSettingInfo *) setting);
     char			     *gsettingsTranslatedName = translateKeyForGSettings (gnomeKeyName);
 
-    GVariant *variant = ccsGSettingsWrapperGetValue (priv->wrapper, gsettingsTranslatedName);
-    GVariant *newVariant = NULL;
+    GVariant           *variant = ccsGSettingsWrapperGetValue (priv->wrapper, gsettingsTranslatedName);
+    const GVariantType *variantType = g_variant_get_type (variant);
+    GVariant           *newVariant = NULL;
 
     if (!variant)
     {
@@ -141,42 +154,62 @@
     {
 	case TypeInt:
 	    {
-		int currentValue = readIntFromVariant (variant);
+		if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_INT32))
+		    ccsError ("Expected integer value");
+		else
+		{
+		    int currentValue = readIntFromVariant (variant);
 
-		if ((currentValue != v->value.asInt))
-		    writeIntToVariant (v->value.asInt, &newVariant);
+		    if ((currentValue != v->value.asInt))
+			writeIntToVariant (v->value.asInt, &newVariant);
+		}
 	    }
 	    break;
 	case TypeBool:
 	    {
-		gboolean currentValue = readBoolFromVariant (variant);
+		if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_BOOLEAN))
+		    ccsError ("Expected boolean value");
+		else
+		{
+		    gboolean currentValue = readBoolFromVariant (variant);
 
-		if ((currentValue != v->value.asBool))
-		    writeBoolToVariant (v->value.asBool, &newVariant);
+		    if ((currentValue != v->value.asBool))
+			writeBoolToVariant (v->value.asBool, &newVariant);
+		}
 	    }
 	    break;
 	case TypeString:
 	    {
-		const char  *defaultValue = "";
-		const char  *newValue = v->value.asString ? v->value.asString : defaultValue;
-		gsize len = 0;
-		const gchar *currentValue = g_variant_get_string (variant, &len);
+		if (!g_variant_type_equal (variantType, G_VARIANT_TYPE_STRING))
+		    ccsError ("Expected string value");
+		else
+		{
+		    const char  *defaultValue = "";
+		    const char  *newValue = v->value.asString ? v->value.asString : defaultValue;
+		    gsize len = 0;
+		    const gchar *currentValue = g_variant_get_string (variant, &len);
 
-		if (currentValue)
-		{
-		    if (strcmp (currentValue, newValue) != 0)
-			writeStringToVariant (currentValue, &newVariant);
+		    if (currentValue)
+		    {
+			if (strcmp (currentValue, newValue) != 0)
+			    writeStringToVariant (currentValue, &newVariant);
+		    }
 		}
 	    }
 	    break;
 	case TypeKey:
 	    {
-		const char  *defaultValue = "";
-		GVariantBuilder strvBuilder;
+		if (!g_variant_type_equal (variantType, G_VARIANT_TYPE ("as")))
+		    ccsError ("Expected array-of-string value");
+		else
+		{
+		    const char  *defaultValue = "";
+		    GVariantBuilder strvBuilder;
 
-		g_variant_builder_init (&strvBuilder, G_VARIANT_TYPE ("as"));
-		g_variant_builder_add (&strvBuilder, "s", v->value.asString ? v->value.asString :  defaultValue);
-		newVariant = g_variant_builder_end (&strvBuilder);
+		    g_variant_builder_init (&strvBuilder, G_VARIANT_TYPE ("as"));
+		    g_variant_builder_add (&strvBuilder, "s", v->value.asString ? v->value.asString :  defaultValue);
+		    newVariant = g_variant_builder_end (&strvBuilder);
+		}
 	    }
 	    break;
 	default:
@@ -238,10 +271,17 @@
     return ccsGSettingsIntegratedSettingFree ((CCSIntegratedSetting *) info);
 }
 
+void
+ccsGSettingsGNOMEIntegratedSettingInfoFree (CCSGNOMEIntegratedSettingInfo *info)
+{
+    return ccsGSettingsIntegratedSettingFree ((CCSIntegratedSetting *) info);
+}
+
 const CCSGNOMEIntegratedSettingInfoInterface ccsGSettingsGNOMEIntegratedSettingInterface =
 {
     ccsGSettingsIntegratedSettingGetSpecialOptionType,
-    ccsGSettingsIntegratedSettingGetGNOMEName
+    ccsGSettingsIntegratedSettingGetGNOMEName,
+    ccsGSettingsGNOMEIntegratedSettingInfoFree
 };
 
 const CCSIntegratedSettingInterface ccsGSettingsIntegratedSettingInterface =

=== added directory 'compizconfig/integration/gnome/gsettings/tests'
=== added file 'compizconfig/integration/gnome/gsettings/tests/CMakeLists.txt'
--- compizconfig/integration/gnome/gsettings/tests/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ compizconfig/integration/gnome/gsettings/tests/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -0,0 +1,31 @@
+include_directories (${GTEST_INCLUDE_DIRS})
+include_directories (${CMAKE_SOURCE_DIR}/include)
+include_directories (${CMAKE_SOURCE_DIR}/tests/shared)
+include_directories (${CMAKE_SOURCE_DIR}/tests/shared/glib)
+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/libcompizconfig)
+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../../gsettings/tests)
+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../../gsettings/mocks)
+include_directories (${CMAKE_SOURCE_DIR}/compizconfig/tests)
+link_directories (${CMAKE_INSTALL_PREFIX}/lib)
+link_directories (${CMAKE_CURRENT_BINARY_DIR}/../../mocks/libcompizconfig)
+link_directories (${CMAKE_CURRENT_BINARY_DIR}/../../tests/)
+link_directories (${CMAKE_CURRENT_BINARY_DIR}/../src/)
+
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+
+add_executable (compizconfig_test_ccs_gnome_gsettings_integrated_setting
+		${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp)
+
+target_link_libraries (compizconfig_test_ccs_gnome_gsettings_integrated_setting
+		       ${GTEST_BOTH_LIBRARIES}
+		       ${GMOCK_LIBRARY}
+		       ${GMOCK_MAIN_LIBRARY}
+		       ${CMAKE_THREAD_LIBS_INIT}
+		       ${LIBCOMPIZCONFIG_LIBRARIES}
+		       compizconfig
+		       compizconfig_gsettings_settings_test_env
+		       compizconfig_ccs_gsettings_wrapper_mock
+                       compizconfig_gnome_integration_gsettings_integrated_setting
+                       compizconfig_gsettings_backend_interface)
+
+compiz_discover_tests (compizconfig_test_ccs_gnome_gsettings_integrated_setting COVERAGE compizconfig_gnome_gsettings_integrated_setting)

=== added file 'compizconfig/integration/gnome/gsettings/tests/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp'
--- compizconfig/integration/gnome/gsettings/tests/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/integration/gnome/gsettings/tests/compizconfig_test_ccs_gnome_gsettings_integrated_setting.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,388 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <map>
+#include <memory>
+#include <tr1/tuple>
+#include <boost/shared_ptr.hpp>
+
+#include <glib_gslice_off_env.h>
+#include <gtest_shared_autodestroy.h>
+
+#include <ccs.h>
+#include <ccs-backend.h>
+#include <ccs_gnome_integrated_setting.h>
+#include <ccs_gnome_integration_gsettings_integrated_setting.h>
+#include <ccs_gsettings_wrapper_mock.h>
+
+using ::testing::Combine;
+using ::testing::Return;
+using ::testing::IsNull;
+using ::testing::ValuesIn;
+using ::testing::Values;
+using ::testing::Eq;
+using ::testing::_;
+
+namespace compiz
+{
+    namespace config
+    {
+	namespace integration
+	{
+	    namespace test
+	    {
+		const std::string KEYBINDING_ONE = "keybinding_one";
+		const std::string KEYBINDING_TWO = "keybinding_two";
+		const std::string STRING = "string";
+		const Bool        BOOLEAN = TRUE;
+		const int         INTEGER = 2;
+
+		const std::string STRING_ALT = "string_alt";
+		const Bool        BOOLEAN_ALT = FALSE;
+		const int         INTEGER_ALT = 1;
+
+		namespace variant_generators
+		{
+		    GVariant * i ();
+		    GVariant * s ();
+		    GVariant * b ();
+		    GVariant * as ();
+		}
+
+		namespace value_generators
+		{
+		    CCSSettingValue * integer ();
+		    CCSSettingValue * string ();
+		    CCSSettingValue * key ();
+		    CCSSettingValue * boolean ();
+		}
+
+		namespace expectations
+		{
+		    void integer (CCSSettingValue *);
+		    void string  (CCSSettingValue *);
+		    void boolean (CCSSettingValue *);
+		    void key     (CCSSettingValue *);
+
+		    void integerVariant (GVariant *, int);
+		    void stringVariant (GVariant *, const std::string &);
+		    void booleanVariant (GVariant *, bool);
+		    void keyVariant (GVariant *, const std::string &);
+		}
+
+		typedef GVariant * (*VariantGenerator) ();
+		typedef CCSSettingValue * (*ValueGenerator) ();
+		typedef void (*Expectation) (CCSSettingValue *);
+
+		struct GSettingsIntegratedSettingInfo
+		{
+		    VariantGenerator variantGenerator;
+		    ValueGenerator   valueGenerator;
+		    Expectation      expectation;
+		    CCSSettingType   settingType;
+		};
+
+		namespace impl
+		{
+		    namespace ccit = compiz::config::integration::test;
+		    namespace vg = compiz::config::integration::test::variant_generators;
+		    namespace cvg = compiz::config::integration::test::value_generators;
+		    namespace ex = compiz::config::integration::test::expectations;
+
+		    ccit::GSettingsIntegratedSettingInfo settingsInfo[] =
+		    {
+			{ vg::i, cvg::integer, ex::integer, TypeInt },
+			{ vg::b, cvg::boolean, ex::boolean, TypeBool },
+			{ vg::s, cvg::string, ex::string, TypeString },
+			{ vg::as, cvg::key, ex::key, TypeKey }
+		    };
+		}
+	    }
+	}
+    }
+}
+
+namespace
+{
+    std::map <CCSSettingType, SpecialOptionType> &
+    ccsTypeToSpecialType ()
+    {
+	static std::map <CCSSettingType, SpecialOptionType> types;
+	static bool initialized = false;
+
+	if (!initialized)
+	{
+	    types[TypeInt] = OptionInt;
+	    types[TypeBool] = OptionBool;
+	    types[TypeString] = OptionString;
+	    types[TypeKey] = OptionKey;
+	}
+
+	return types;
+    }
+}
+
+namespace ccit = compiz::config::integration::test;
+namespace cciti = compiz::config::integration::test::impl;
+namespace ccvg = compiz::config::integration::test::variant_generators;
+namespace ccvalg = compiz::config::integration::test::value_generators;
+namespace ccex = compiz::config::integration::test::expectations;
+
+typedef std::tr1::tuple <CCSSettingType,
+			 ccit::GSettingsIntegratedSettingInfo> CCSGSettingsIntegratedSettingTestInfo;
+
+class CCSGSettingsIntegratedSettingTest :
+    public ::testing::TestWithParam <CCSGSettingsIntegratedSettingTestInfo>
+{
+    public:
+
+	virtual void SetUp ();
+	virtual void TearDown ();
+
+    protected:
+
+	CompizGLibGSliceOffEnv                  env;
+	boost::shared_ptr <CCSGSettingsWrapper> mWrapper;
+	CCSGSettingsWrapperGMock                *mWrapperMock;
+};
+
+GVariant *
+ccvg::as ()
+{
+    GVariantBuilder builder;
+    g_variant_builder_init (&builder, G_VARIANT_TYPE ("as"));
+    g_variant_builder_add (&builder, "s", ccit::KEYBINDING_ONE.c_str ());
+    g_variant_builder_add (&builder, "s", ccit::KEYBINDING_TWO.c_str ());
+
+    return g_variant_builder_end (&builder);
+}
+
+GVariant *
+ccvg::i ()
+{
+    return g_variant_new ("i", ccit::INTEGER);
+}
+
+GVariant *
+ccvg::b ()
+{
+    return g_variant_new ("b", ccit::BOOLEAN);
+}
+
+GVariant *
+ccvg::s ()
+{
+    return g_variant_new ("s", ccit::STRING.c_str ());
+}
+
+namespace
+{
+    CCSSettingValue * createSettingValue ()
+    {
+	CCSSettingValue *v = reinterpret_cast <CCSSettingValue *> (calloc (1, sizeof (CCSSettingValue)));
+
+	v->isListChild = FALSE;
+	v->parent = NULL;
+	v->refCount = 1;
+
+	return v;
+    }
+}
+
+CCSSettingValue *
+ccvalg::integer ()
+{
+    CCSSettingValue *v = createSettingValue ();
+    v->value.asInt = ccit::INTEGER_ALT;
+    return v;
+}
+
+CCSSettingValue *
+ccvalg::string ()
+{
+    CCSSettingValue *v = createSettingValue ();
+    v->value.asString = strdup (ccit::STRING_ALT.c_str ());
+    return v;
+}
+
+CCSSettingValue *
+ccvalg::key ()
+{
+    CCSSettingValue *v = createSettingValue ();
+    v->value.asString = strdup (ccit::KEYBINDING_TWO.c_str ());
+    return v;
+}
+
+CCSSettingValue *
+ccvalg::boolean ()
+{
+    CCSSettingValue *v = createSettingValue ();
+    v->value.asBool = ccit::BOOLEAN_ALT;
+    return v;
+}
+
+void
+ccex::boolean (CCSSettingValue *v)
+{
+    EXPECT_EQ (v->value.asBool, ccit::BOOLEAN);
+}
+
+void
+ccex::integer (CCSSettingValue *v)
+{
+    EXPECT_EQ (v->value.asInt, ccit::INTEGER);
+}
+
+void
+ccex::string (CCSSettingValue *v)
+{
+    EXPECT_EQ (v->value.asString, ccit::STRING);
+}
+
+void
+ccex::key (CCSSettingValue *v)
+{
+    EXPECT_EQ (v->value.asString, ccit::KEYBINDING_ONE);
+}
+
+void
+ccex::integerVariant (GVariant *v , int i)
+{
+    EXPECT_EQ (g_variant_get_int32 (v), i);
+}
+
+void
+ccex::stringVariant (GVariant *v, const std::string &s)
+{
+    gsize len;
+    EXPECT_EQ (g_variant_get_string (v, &len), s);
+}
+
+void
+ccex::booleanVariant (GVariant *v, bool b)
+{
+    EXPECT_EQ (g_variant_get_boolean (v), b);
+}
+
+void
+ccex::keyVariant (GVariant *v, const std::string &s)
+{
+    gsize len;
+    const gchar * const *strv = g_variant_get_strv (v, &len);
+    EXPECT_EQ (strv[0], s);
+}
+
+void
+CCSGSettingsIntegratedSettingTest::SetUp ()
+{
+    env.SetUpEnv ();
+    mWrapper.reset (ccsMockGSettingsWrapperNew (),
+		    boost::bind (ccsMockGSettingsWrapperFree, _1));
+    mWrapperMock = reinterpret_cast <CCSGSettingsWrapperGMock *> (
+		       ccsObjectGetPrivate (mWrapper.get ()));
+}
+
+void
+CCSGSettingsIntegratedSettingTest::TearDown ()
+{
+    mWrapper.reset ();
+    mWrapperMock = NULL;
+    env.TearDownEnv ();
+}
+
+TEST_P (CCSGSettingsIntegratedSettingTest, MatchedTypesReturnValueMismatchedTypesReturnNull)
+{
+    const std::string keyName ("mock");
+    const ccit::GSettingsIntegratedSettingInfo &integratedSettingInfo =
+	    std::tr1::get <1> (GetParam ());
+    const CCSSettingType                       createSettingType =
+	    std::tr1::get <0> (GetParam ());
+
+    CCSIntegratedSettingInfo *integratedSetting = ccsSharedIntegratedSettingInfoNew (keyName.c_str (),
+										     keyName.c_str (),
+										     integratedSettingInfo.settingType,
+										     &ccsDefaultObjectAllocator);
+    SpecialOptionType             specialType = ccsTypeToSpecialType ()[integratedSettingInfo.settingType];
+    CCSGNOMEIntegratedSettingInfo *gnomeIntegratedSetting = ccsGNOMEIntegratedSettingInfoNew (integratedSetting,
+											      specialType,
+											      keyName.c_str (),
+											      &ccsDefaultObjectAllocator);
+    CCSIntegratedSetting *gsettingsIntegrated =  ccsGSettingsIntegratedSettingNew (gnomeIntegratedSetting,
+										   mWrapper.get (),
+										   &ccsDefaultObjectAllocator);
+
+    GVariant *variant = (*integratedSettingInfo.variantGenerator) ();
+    EXPECT_CALL (*mWrapperMock, getValue (Eq (keyName))).WillOnce (Return (variant));
+
+    CCSSettingValue *value = ccsIntegratedSettingReadValue (gsettingsIntegrated, createSettingType);
+
+    if (createSettingType == integratedSettingInfo.settingType)
+	(*integratedSettingInfo.expectation) (value);
+    else
+	EXPECT_THAT (value, IsNull ());
+
+    if (value)
+	ccsFreeSettingValueWithType (value, integratedSettingInfo.settingType);
+}
+
+TEST_P (CCSGSettingsIntegratedSettingTest, MatchedTypesReturnValueMismatchedTypesResetOrWrite)
+{
+    const std::string keyName ("mock");
+    const ccit::GSettingsIntegratedSettingInfo &integratedSettingInfo =
+	    std::tr1::get <1> (GetParam ());
+    const CCSSettingType                       createSettingType =
+	    std::tr1::get <0> (GetParam ());
+
+    CCSIntegratedSettingInfo *integratedSetting = ccsSharedIntegratedSettingInfoNew (keyName.c_str (),
+										     keyName.c_str (),
+										     integratedSettingInfo.settingType,
+										     &ccsDefaultObjectAllocator);
+    SpecialOptionType             specialType = ccsTypeToSpecialType ()[integratedSettingInfo.settingType];
+    CCSGNOMEIntegratedSettingInfo *gnomeIntegratedSetting = ccsGNOMEIntegratedSettingInfoNew (integratedSetting,
+											      specialType,
+											      keyName.c_str (),
+											      &ccsDefaultObjectAllocator);
+    CCSIntegratedSetting *gsettingsIntegrated =  ccsGSettingsIntegratedSettingNew (gnomeIntegratedSetting,
+										   mWrapper.get (),
+										   &ccsDefaultObjectAllocator);
+
+    CCSSettingValue *value = (*integratedSettingInfo.valueGenerator) ();
+    GVariant        *variant = (*integratedSettingInfo.variantGenerator) ();
+    EXPECT_CALL (*mWrapperMock, getValue (Eq (keyName))).WillOnce (Return (variant));
+
+    if (createSettingType == integratedSettingInfo.settingType)
+	EXPECT_CALL (*mWrapperMock, setValue (Eq (keyName), _)); // can't verify this right yet
+    else
+	EXPECT_CALL (*mWrapperMock, resetKey (Eq (keyName)));
+
+    ccsIntegratedSettingWriteValue (gsettingsIntegrated, value, createSettingType);
+
+    if (value)
+	ccsFreeSettingValueWithType (value, integratedSettingInfo.settingType);
+}
+
+INSTANTIATE_TEST_CASE_P (CCSGSettingsIntegratedSettingTestMismatchedValues, CCSGSettingsIntegratedSettingTest,
+			 Combine (Values (TypeInt, TypeString, TypeBool, TypeKey),
+				  ValuesIn (cciti::settingsInfo)));

=== modified file 'compizconfig/integration/gnome/include/ccs_gnome_integrated_setting.h'
--- compizconfig/integration/gnome/include/ccs_gnome_integrated_setting.h	2012-08-17 07:33:02 +0000
+++ compizconfig/integration/gnome/include/ccs_gnome_integrated_setting.h	2012-09-25 08:42:23 +0000
@@ -15,11 +15,13 @@
 
 typedef SpecialOptionType (*CCSGNOMEIntegratedSettingInfoGetSpecialOptionType) (CCSGNOMEIntegratedSettingInfo *);
 typedef const char * (*CCSGNOMEIntegratedSettingInfoGetGNOMEName) (CCSGNOMEIntegratedSettingInfo *);
+typedef void (*CCSGNOMEIntegratedSettingInfoFree) (CCSGNOMEIntegratedSettingInfo *);
 
 struct _CCSGNOMEIntegratedSettingInfoInterface
 {
     CCSGNOMEIntegratedSettingInfoGetSpecialOptionType getSpecialOptionType;
-    CCSGNOMEIntegratedSettingInfoGetGNOMEName getGNOMEName;
+    CCSGNOMEIntegratedSettingInfoGetGNOMEName         getGNOMEName;
+    CCSGNOMEIntegratedSettingInfoFree                 free;
 };
 
 /**
@@ -53,6 +55,12 @@
 				  const char	   *gnomeName,
 				  CCSObjectAllocationInterface *ai);
 
+void
+ccsFreeGNOMEIntegratedSettingInfo (CCSGNOMEIntegratedSettingInfo *);
+
+CCSREF_HDR (GNOMEIntegratedSettingInfo, CCSGNOMEIntegratedSettingInfo);
+CCSLIST_HDR (GNOMEIntegratedSettingInfo, CCSGNOMEIntegratedSettingInfo);
+
 COMPIZCONFIG_END_DECLS
 
 #endif

=== modified file 'compizconfig/integration/gnome/include/ccs_gnome_integration_constants.h'
--- compizconfig/integration/gnome/include/ccs_gnome_integration_constants.h	2012-09-05 09:02:56 +0000
+++ compizconfig/integration/gnome/include/ccs_gnome_integration_constants.h	2012-09-25 08:42:23 +0000
@@ -2,6 +2,7 @@
 #define _CCS_GNOME_INTEGRATION_CONSTANTS_H
 
 #include <ccs-defs.h>
+#include <glib.h>
 
 COMPIZCONFIG_BEGIN_DECLS
 

=== modified file 'compizconfig/integration/gnome/include/ccs_gnome_integration_types.h'
--- compizconfig/integration/gnome/include/ccs_gnome_integration_types.h	2012-08-14 04:46:41 +0000
+++ compizconfig/integration/gnome/include/ccs_gnome_integration_types.h	2012-09-25 08:42:23 +0000
@@ -22,5 +22,7 @@
     OptionSpecial,
 } SpecialOptionType;
 
+COMPIZCONFIG_END_DECLS
+
 #endif
 

=== removed file 'compizconfig/integration/gnome/include/ccs_gnome_integration_types.h~'
--- compizconfig/integration/gnome/include/ccs_gnome_integration_types.h~	2012-08-14 06:42:11 +0000
+++ compizconfig/integration/gnome/include/ccs_gnome_integration_types.h~	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-#ifndef _CCS_GNOME_INTEGRATION_TYPES_H
-#define _CCS_GNOME_INTEGRATION_TYPES_H
-
-#include <ccs-defs.h>
-
-COMPIZCONFIG_BEGIN_DECLS
-
-typedef struct _CCSBackend CCSBackend;
-typedef struct _CCSContext CCSContext;
-typedef struct _CCSObjectAllocationInterface CCSObjectAllocationInterface;
-typedef struct _CCSIntegration CCSIntegration;
-typedef struct _CCSIntegratedSetting CCSIntegratedSetting;
-typedef struct _CCSIntegratedSettingFactory CCSIntegratedSettingFactory;
-typedef struct _CCSIntegratedSettingsStorage CCSIntegratedSettingsStorage;
-typedef struct _GConfClient GConfClient;
-
-typedef enum {
-    OptionInt,
-    OptionBool,
-    OptionKey,
-    OptionString,
-    OptionSpecial,
-} SpecialOptionType;
-
-#endif
-

=== modified file 'compizconfig/integration/gnome/src/ccs_gnome_integrated_setting.c'
--- compizconfig/integration/gnome/src/ccs_gnome_integrated_setting.c	2012-08-18 13:15:30 +0000
+++ compizconfig/integration/gnome/src/ccs_gnome_integrated_setting.c	2012-09-25 08:42:23 +0000
@@ -12,6 +12,8 @@
 
 INTERFACE_TYPE (CCSGNOMEIntegratedSettingInfoInterface);
 
+CCSREF_OBJ (GNOMEIntegratedSettingInfo, CCSGNOMEIntegratedSettingInfo);
+
 SpecialOptionType
 ccsGNOMEIntegratedSettingInfoGetSpecialOptionType (CCSGNOMEIntegratedSettingInfo *info)
 {
@@ -89,7 +91,7 @@
 }
 
 void
-ccsGNOMEIntegratedSettingInfoFree (CCSIntegratedSettingInfo *info)
+ccsGNOMESharedIntegratedSettingInfoFree (CCSIntegratedSettingInfo *info)
 {
     CCSGNOMEIntegratedSettingInfoDefaultImplPrivate *priv = (CCSGNOMEIntegratedSettingInfoDefaultImplPrivate *) ccsObjectGetPrivate (info);
 
@@ -99,10 +101,17 @@
     (*info->object.object_allocation->free_) (info->object.object_allocation->allocator, info);
 }
 
+static void
+ccsGNOMEIntegratedSettingInfoFree (CCSGNOMEIntegratedSettingInfo *info)
+{
+    ccsGNOMESharedIntegratedSettingInfoFree ((CCSIntegratedSettingInfo *) info);
+}
+
 CCSGNOMEIntegratedSettingInfoInterface ccsGNOMEIntegratedSettingInfoDefaultImplInterface =
 {
     ccsGNOMEIntegratedSettingGetSpecialOptionDefault,
-    ccsGNOMEIntegratedSettingGetGNOMENameDefault
+    ccsGNOMEIntegratedSettingGetGNOMENameDefault,
+    ccsGNOMEIntegratedSettingInfoFree
 };
 
 const CCSIntegratedSettingInfoInterface ccsGNOMEIntegratedSettingInfoInterface =
@@ -110,9 +119,15 @@
     ccsGNOMEIntegratedSettingInfoPluginName,
     ccsGNOMEIntegratedSettingInfoSettingName,
     ccsGNOMEIntegratedSettingInfoGetType,
-    ccsGNOMEIntegratedSettingInfoFree
+    ccsGNOMESharedIntegratedSettingInfoFree
 };
 
+void
+ccsFreeGNOMEIntegratedSettingInfo (CCSGNOMEIntegratedSettingInfo *info)
+{
+    (*(GET_INTERFACE (CCSGNOMEIntegratedSettingInfoInterface, info))->free) (info);
+}
+
 CCSGNOMEIntegratedSettingInfo *
 ccsGNOMEIntegratedSettingInfoNew (CCSIntegratedSettingInfo *base,
 				  SpecialOptionType    type,

=== modified file 'compizconfig/integration/gnome/src/ccs_gnome_integration.c'
--- compizconfig/integration/gnome/src/ccs_gnome_integration.c	2012-08-17 07:33:02 +0000
+++ compizconfig/integration/gnome/src/ccs_gnome_integration.c	2012-09-25 08:42:23 +0000
@@ -132,9 +132,12 @@
     CCSSettingType type = TypeString;
     CCSSettingValue *v = ccsIntegratedSettingReadValue (mouseButtonModifierSetting, type);
 
-    modMask = ccsStringToModifiers (v->value.asString);
+    if (v)
+    {
+	modMask = ccsStringToModifiers (v->value.asString);
 
-    ccsFreeSettingValueWithType (v, type);
+	ccsFreeSettingValueWithType (v, type);
+    }
 
     return modMask;
 }
@@ -445,7 +448,7 @@
 	    }
 	    else if (strcmp (settingName, "fullscreen_visual_bell") == 0)
 	    {
-		const char *newValueString = v->value.asString ? "fullscreen" : "frame_flash";
+		const char *newValueString = v->value.asBool ? "fullscreen" : "frame_flash";
 		newValue->value.asString = strdup (newValueString);
 		type = TypeString;
 
@@ -453,7 +456,7 @@
 	    }
 	    else if (strcmp (settingName, "click_to_focus") == 0)
 	    {
-		const char *newValueString = v->value.asString ? "click" : "sloppy";
+		const char *newValueString = v->value.asBool ? "click" : "sloppy";
 		newValue->value.asString = strdup (newValueString);
 		type = TypeString;
 
@@ -468,9 +471,9 @@
 		unsigned int modMask;
 		Bool         resizeWithRightButton = FALSE;
 
-		if ((getButtonBindingForSetting (context, "resize",
+		if ((getButtonBindingForSetting (priv->context, "resize",
 						 "initiate_button") == 3) ||
-		    (getButtonBindingForSetting (context, "core",
+		    (getButtonBindingForSetting (priv->context, "core",
 						 "window_menu_button") == 2))
 		{
 		     resizeWithRightButton = TRUE;
@@ -489,16 +492,16 @@
 														ccsGNOMEIntegratedPluginNames.SPECIAL,
 														ccsGNOMEIntegratedSettingNames.NULL_MOUSE_BUTTON_MODIFIER.compizName);
 
-		modMask = ccsSettingGetValue (setting)->value.asButton.buttonModMask;
+		modMask = v->value.asButton.buttonModMask;
 		if (setGnomeMouseButtonModifier (integratedSettingsMBM->data, modMask))
 		{
-		    setButtonBindingForSetting (context, "move",
+		    setButtonBindingForSetting (priv->context, "move",
 						"initiate_button", 1, modMask);
-		    setButtonBindingForSetting (context, "resize",
+		    setButtonBindingForSetting (priv->context, "resize",
 						"initiate_button", 
 						resizeWithRightButton ? 3 : 2,
 						modMask);
-		    setButtonBindingForSetting (context, "core",
+		    setButtonBindingForSetting (priv->context, "core",
 						"window_menu_button",
 						resizeWithRightButton ? 2 : 3,
 						modMask);

=== added directory 'compizconfig/integration/gnome/tests'
=== added file 'compizconfig/integration/gnome/tests/CMakeLists.txt'
--- compizconfig/integration/gnome/tests/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ compizconfig/integration/gnome/tests/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -0,0 +1,47 @@
+include_directories (${GTEST_INCLUDE_DIRS})
+include_directories (${CMAKE_SOURCE_DIR}/include)
+include_directories (${CMAKE_SOURCE_DIR}/tests/shared)
+include_directories (${CMAKE_SOURCE_DIR}/tests/shared/glib)
+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/libcompizconfig)
+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../gsettings/tests)
+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../../gsettings/mocks)
+include_directories (${CMAKE_SOURCE_DIR}/compizconfig/tests)
+link_directories (${CMAKE_INSTALL_PREFIX}/lib)
+
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+
+add_library (compizconfig_ccs_mock_gnome_integrated_setting_composition
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_mock_gnome_integrated_setting_composition.c)
+
+target_link_libraries (compizconfig_ccs_mock_gnome_integrated_setting_composition
+		       compizconfig_ccs_integrated_setting_mock
+		       compizconfig_gnome_integrated_setting
+		       compizconfig)
+
+add_executable (compizconfig_test_ccs_gnome_integration
+		${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_test_ccs_gnome_integration.cpp)
+
+target_link_libraries (compizconfig_test_ccs_gnome_integration
+		       ${GTEST_BOTH_LIBRARIES}
+		       ${GMOCK_LIBRARY}
+		       ${GMOCK_MAIN_LIBRARY}
+		       ${CMAKE_THREAD_LIBS_INIT}
+		       ${LIBCOMPIZCONFIG_LIBRARIES}
+		       compizconfig
+		       compizconfig_ccs_context_mock
+		       compizconfig_ccs_backend_mock
+		       compizconfig_ccs_setting_mock
+		       compizconfig_ccs_plugin_mock
+		       compizconfig_ccs_list_wrapper
+		       compizconfig_ccs_setting_value_operators
+		       compizconfig_ccs_setting_value_matcher
+		       compizconfig_ccs_integrated_setting_mock
+		       compizconfig_ccs_integrated_setting_factory_mock
+		       compizconfig_ccs_integrated_setting_storage_mock
+		       compizconfig_ccs_mock_gnome_integrated_setting_composition
+		       compizconfig_gnome_integration)
+
+compiz_discover_tests (compizconfig_test_ccs_gnome_integration
+		       COVERAGE
+		       compizconfig_gnome_integration
+		       compizconfig_gnome_integration_constants)

=== added file 'compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.c'
--- compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.c	1970-01-01 00:00:00 +0000
+++ compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.c	2012-09-25 08:42:23 +0000
@@ -0,0 +1,222 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+
+#include <ccs.h>
+#include <ccs-backend.h>
+#include <ccs_gnome_integrated_setting.h>
+#include "compizconfig_ccs_mock_gnome_integrated_setting_composition.h"
+
+typedef struct _CCSMockGNOMEIntegratedSettingCompositionPrivate
+{
+    CCSIntegratedSetting          *integratedSetting;
+    CCSGNOMEIntegratedSettingInfo *gnomeIntegratedSettingInfo;
+    CCSIntegratedSettingInfo      *integratedSettingInfo;
+} CCSMockGNOMEIntegratedSettingCompositionPrivate;
+
+static CCSIntegratedSetting *
+allocateCCSIntegratedSetting (CCSObjectAllocationInterface *allocator)
+{
+    CCSIntegratedSetting *setting =
+	    (*allocator->calloc_) (allocator->allocator,
+				   1,
+				   sizeof (CCSIntegratedSetting));
+
+    ccsObjectInit (setting, allocator);
+
+    return setting;
+}
+
+static CCSMockGNOMEIntegratedSettingCompositionPrivate *
+allocatePrivate (CCSIntegratedSetting         *integratedSetting,
+		 CCSObjectAllocationInterface *allocator)
+{
+    CCSMockGNOMEIntegratedSettingCompositionPrivate *priv =
+	    (*allocator->calloc_) (allocator->allocator,
+				   1,
+				   sizeof (CCSMockGNOMEIntegratedSettingCompositionPrivate));
+
+    if (!priv)
+    {
+	ccsObjectFinalize (integratedSetting);
+	(*allocator->free_) (allocator->allocator, integratedSetting);
+	return NULL;
+    }
+
+    return priv;
+}
+
+static SpecialOptionType
+ccsMockCompositionIntegratedSettingGetSpecialOptionType (CCSGNOMEIntegratedSettingInfo *setting)
+{
+    CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
+
+    return ccsGNOMEIntegratedSettingInfoGetSpecialOptionType (priv->gnomeIntegratedSettingInfo);
+}
+
+static const char *
+ccsMockCompositionIntegratedSettingGetGNOMEName (CCSGNOMEIntegratedSettingInfo *setting)
+{
+    CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
+
+    return ccsGNOMEIntegratedSettingInfoGetGNOMEName (priv->gnomeIntegratedSettingInfo);
+}
+
+static CCSSettingValue *
+ccsMockCompositionIntegratedSettingReadValue (CCSIntegratedSetting *setting, CCSSettingType type)
+{
+    CCSMockGNOMEIntegratedSettingCompositionPrivate *priv =
+	    GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
+
+    return ccsIntegratedSettingReadValue (priv->integratedSetting, type);
+}
+
+static void
+ccsMockCompositionIntegratedSettingWriteValue (CCSIntegratedSetting *setting, CCSSettingValue *v, CCSSettingType type)
+{
+    CCSMockGNOMEIntegratedSettingCompositionPrivate *priv =
+	    GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
+
+    ccsIntegratedSettingWriteValue (priv->integratedSetting, v, type);
+}
+
+static const char *
+ccsMockCompositionIntegratedSettingInfoPluginName (CCSIntegratedSettingInfo *setting)
+{
+    CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
+
+    return ccsIntegratedSettingInfoPluginName (priv->integratedSettingInfo);
+}
+
+static const char *
+ccsMockCompositionIntegratedSettingInfoSettingName (CCSIntegratedSettingInfo *setting)
+{
+    CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
+
+    return ccsIntegratedSettingInfoSettingName (priv->integratedSettingInfo);
+}
+
+static CCSSettingType
+ccsMockCompositionIntegratedSettingInfoGetType (CCSIntegratedSettingInfo *setting)
+{
+    CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, setting);
+
+    return ccsIntegratedSettingInfoGetType (priv->integratedSettingInfo);
+}
+
+static void
+ccsMockCompositionIntegratedSettingFree (CCSIntegratedSetting        *integratedSetting)
+{
+    CCSMockGNOMEIntegratedSettingCompositionPrivate *priv =
+	    GET_PRIVATE (CCSMockGNOMEIntegratedSettingCompositionPrivate, integratedSetting);
+
+    ccsIntegratedSettingUnref (priv->integratedSetting);
+    ccsGNOMEIntegratedSettingInfoUnref (priv->gnomeIntegratedSettingInfo);
+    ccsIntegratedSettingInfoUnref (priv->integratedSettingInfo);
+
+    ccsObjectFinalize (integratedSetting);
+    (*integratedSetting->object.object_allocation->free_)
+	    (integratedSetting->object.object_allocation->allocator, integratedSetting);
+}
+
+static void
+ccsMockCompositionIntegratedSettingInfoFree (CCSIntegratedSettingInfo *info)
+{
+    return ccsMockCompositionIntegratedSettingFree ((CCSIntegratedSetting *) info);
+}
+
+static void
+ccsMockCompositionGNOMEIntegratedSettingInfoFree (CCSGNOMEIntegratedSettingInfo *info)
+{
+    return ccsMockCompositionIntegratedSettingFree ((CCSIntegratedSetting *) info);
+}
+
+const CCSGNOMEIntegratedSettingInfoInterface ccsMockCompositionGNOMEIntegratedSettingInfo =
+{
+    ccsMockCompositionIntegratedSettingGetSpecialOptionType,
+    ccsMockCompositionIntegratedSettingGetGNOMEName,
+    ccsMockCompositionGNOMEIntegratedSettingInfoFree
+};
+
+const CCSIntegratedSettingInterface ccsMockCompositionIntegratedSetting =
+{
+    ccsMockCompositionIntegratedSettingReadValue,
+    ccsMockCompositionIntegratedSettingWriteValue,
+    ccsMockCompositionIntegratedSettingFree
+};
+
+const CCSIntegratedSettingInfoInterface ccsMockCompositionIntegratedSettingInfo =
+{
+    ccsMockCompositionIntegratedSettingInfoPluginName,
+    ccsMockCompositionIntegratedSettingInfoSettingName,
+    ccsMockCompositionIntegratedSettingInfoGetType,
+    ccsMockCompositionIntegratedSettingInfoFree
+};
+
+CCSIntegratedSetting *
+ccsMockCompositionIntegratedSettingNew (CCSIntegratedSetting          *integratedSetting,
+					CCSGNOMEIntegratedSettingInfo *gnomeInfo,
+					CCSIntegratedSettingInfo      *settingInfo,
+					CCSObjectAllocationInterface  *allocator)
+{
+    CCSIntegratedSetting *composition = allocateCCSIntegratedSetting (allocator);
+
+    if (!composition)
+	return NULL;
+
+    CCSMockGNOMEIntegratedSettingCompositionPrivate *priv = allocatePrivate (composition,
+									     allocator);
+
+    if (!priv)
+	return NULL;
+
+    const CCSInterface *integratedSettingImpl =
+	    (const CCSInterface *) (&ccsMockCompositionIntegratedSetting);
+    const CCSInterface *integratedSettingInfoImpl =
+	    (const CCSInterface *) (&ccsMockCompositionIntegratedSettingInfo);
+    const CCSInterface *gnomeSettingImpl =
+	    (const CCSInterface *) (&ccsMockCompositionGNOMEIntegratedSettingInfo);
+
+    priv->integratedSetting          = integratedSetting;
+    priv->gnomeIntegratedSettingInfo = gnomeInfo;
+    priv->integratedSettingInfo      = settingInfo;
+
+    ccsIntegratedSettingRef (priv->integratedSetting);
+    ccsGNOMEIntegratedSettingInfoRef (priv->gnomeIntegratedSettingInfo);
+    ccsIntegratedSettingInfoRef (priv->integratedSettingInfo);
+
+    ccsObjectSetPrivate (composition, (CCSPrivate *) (priv));
+    ccsObjectAddInterface (composition,
+			   integratedSettingImpl,
+			   GET_INTERFACE_TYPE (CCSIntegratedSettingInterface));
+    ccsObjectAddInterface (composition,
+			   integratedSettingInfoImpl,
+			   GET_INTERFACE_TYPE (CCSIntegratedSettingInfoInterface));
+    ccsObjectAddInterface (composition,
+			   gnomeSettingImpl,
+			   GET_INTERFACE_TYPE (CCSGNOMEIntegratedSettingInfoInterface));
+
+    ccsObjectRef (composition);
+
+    return composition;
+}
+

=== added file 'compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.h'
--- compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.h	1970-01-01 00:00:00 +0000
+++ compizconfig/integration/gnome/tests/compizconfig_ccs_mock_gnome_integrated_setting_composition.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,42 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_CCS_MOCK_GNOME_INTEGRATED_SETTING_COMPOSITION_H
+#define _COMPIZCONFIG_CCS_MOCK_GNOME_INTEGRATED_SETTING_COMPOSITION_H
+
+COMPIZCONFIG_BEGIN_DECLS
+
+typedef struct _CCSIntegratedSetting CCSIntegratedSetting;
+typedef struct _CCSGNOMEIntegratedSettingInfo CCSGNOMEIntegratedSettingInfo;
+typedef struct _CCSIntegratedSettingInfo CCSIntegratedSettingInfo;
+typedef struct _CCSObjectAllocationInterface CCSObjectAllocationInterface;
+
+CCSIntegratedSetting *
+ccsMockCompositionIntegratedSettingNew (CCSIntegratedSetting          *integratedSetting,
+					CCSGNOMEIntegratedSettingInfo *gnomeInfo,
+					CCSIntegratedSettingInfo      *settingInfo,
+					CCSObjectAllocationInterface  *allocator);
+
+COMPIZCONFIG_END_DECLS
+
+#endif
+

=== added file 'compizconfig/integration/gnome/tests/compizconfig_test_ccs_gnome_integration.cpp'
--- compizconfig/integration/gnome/tests/compizconfig_test_ccs_gnome_integration.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/integration/gnome/tests/compizconfig_test_ccs_gnome_integration.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,813 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#include <tr1/tuple>
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/make_shared.hpp>
+
+#include <gtest_shared_autodestroy.h>
+#include <gtest_unspecified_bool_type_matcher.h>
+
+#include <compizconfig_ccs_list_wrapper.h>
+#include <compizconfig_ccs_setting_value_operators.h>
+
+#include <ccs.h>
+#include <ccs-backend.h>
+#include <ccs_gnome_integrated_setting.h>
+#include <ccs_gnome_integration.h>
+#include <ccs_gnome_integration_constants.h>
+#include <compizconfig_ccs_context_mock.h>
+#include <compizconfig_ccs_setting_mock.h>
+#include <compizconfig_ccs_plugin_mock.h>
+#include <compizconfig_ccs_backend_mock.h>
+#include <compizconfig_ccs_integrated_setting_factory_mock.h>
+#include <compizconfig_ccs_integrated_setting_storage_mock.h>
+#include <compizconfig_ccs_integrated_setting_mock.h>
+#include "compizconfig_ccs_mock_gnome_integrated_setting_composition.h"
+#include "compizconfig_ccs_setting_value_matcher.h"
+
+namespace cc  = compiz::config;
+namespace cci = compiz::config::impl;
+
+using ::testing::Pointee;
+using ::testing::Eq;
+using ::testing::Return;
+using ::testing::ReturnNull;
+using ::testing::SetArgPointee;
+using ::testing::DoAll;
+using ::testing::_;
+
+namespace
+{
+    typedef std::tr1::tuple <CCSIntegratedSettingGMock                &,
+			     boost::shared_ptr <CCSIntegratedSetting>   > IntegratedSettingWithMock;
+
+    typedef boost::shared_ptr <IntegratedSettingWithMock> IntegratedSettingWithMockPtr;
+
+    IntegratedSettingWithMockPtr
+    createIntegratedSettingCompositionFromMock (const std::string            &plugin,
+						const std::string            &setting,
+						CCSSettingType               type,
+						SpecialOptionType            gnomeType,
+						const std::string            &gnomeName,
+						CCSObjectAllocationInterface *allocator)
+    {
+	CCSIntegratedSettingInfo *integratedSettingInfo =
+		ccsSharedIntegratedSettingInfoNew (plugin.c_str (),
+						   setting.c_str (),
+						   type,
+						   allocator);
+	CCSGNOMEIntegratedSettingInfo *gnomeIntegratedSettingInfo =
+		ccsGNOMEIntegratedSettingInfoNew (integratedSettingInfo,
+						  gnomeType,
+						  gnomeName.c_str (),
+						  allocator);
+	CCSIntegratedSetting          *integratedSetting =
+		ccsMockIntegratedSettingNew (allocator);
+
+	CCSIntegratedSettingGMock *mockPtr = GET_PRIVATE (CCSIntegratedSettingGMock, integratedSetting)
+	CCSIntegratedSettingGMock &mock (*mockPtr);
+
+	boost::shared_ptr <CCSIntegratedSetting> composition =
+		AutoDestroy (ccsMockCompositionIntegratedSettingNew (integratedSetting,
+								     gnomeIntegratedSettingInfo,
+								     integratedSettingInfo,
+								     allocator),
+			     ccsIntegratedSettingUnref);
+
+	/* We want the composition to take ownership here, so unref the
+	 * original members of the composition */
+	ccsIntegratedSettingInfoUnref (integratedSettingInfo);
+	ccsGNOMEIntegratedSettingInfoUnref (gnomeIntegratedSettingInfo);
+	ccsIntegratedSettingUnref (integratedSetting);
+
+	return boost::make_shared <IntegratedSettingWithMock> (mock, composition);
+    }
+
+    CCSIntegratedSettingGMock &
+    Mock (IntegratedSettingWithMock &integratedSettingWithMocks)
+    {
+	return std::tr1::get <0> (integratedSettingWithMocks);
+    }
+
+    CCSIntegratedSetting *
+    Real (IntegratedSettingWithMock &integratedSettingWithMocks)
+    {
+	return std::tr1::get <1> (integratedSettingWithMocks).get ();
+    }
+
+    typedef std::tr1::tuple <CCSContextGMock                                  &,
+			     CCSBackendGMock                                  &,
+			     CCSIntegratedSettingsStorageGMock                &,
+			     CCSIntegratedSettingFactoryGMock                 &,
+			     boost::shared_ptr <CCSContext>                    ,
+			     boost::shared_ptr <CCSBackend>                    ,
+			     boost::shared_ptr <CCSIntegratedSettingsStorage>  ,
+			     boost::shared_ptr <CCSIntegratedSettingFactory>   ,
+			     boost::shared_ptr <CCSIntegration>                 > CCSGNOMEIntegrationWithMocks;
+
+    CCSGNOMEIntegrationWithMocks
+    createIntegrationWithMocks (CCSObjectAllocationInterface *ai)
+    {
+	boost::shared_ptr <CCSContext>                   context (AutoDestroy (ccsMockContextNew (),
+									       ccsFreeContext));
+	boost::shared_ptr <CCSBackend>                   backend (AutoDestroy (ccsMockBackendNew (),
+									       ccsBackendUnref));
+	boost::shared_ptr <CCSIntegratedSettingsStorage> storage (AutoDestroy (ccsMockIntegratedSettingsStorageNew (ai),
+									       ccsIntegratedSettingsStorageUnref));
+	boost::shared_ptr <CCSIntegratedSettingFactory>  factory (AutoDestroy (ccsMockIntegratedSettingFactoryNew (ai),
+									       ccsIntegratedSettingFactoryUnref));
+	boost::shared_ptr <CCSIntegration>               integration (AutoDestroy (ccsGNOMEIntegrationBackendNew (backend.get (),
+														  context.get (),
+														  factory.get (),
+														  storage.get (),
+														  ai),
+										   ccsIntegrationUnref));
+
+	CCSContextGMock                   &gmockContext = *(reinterpret_cast <CCSContextGMock *> (ccsObjectGetPrivate (context.get ())));
+	CCSBackendGMock                   &gmockBackend = *(reinterpret_cast <CCSBackendGMock *> (ccsObjectGetPrivate (backend.get ())));
+	CCSIntegratedSettingsStorageGMock &gmockStorage = *(reinterpret_cast <CCSIntegratedSettingsStorageGMock *> (ccsObjectGetPrivate (storage.get ())));
+	CCSIntegratedSettingFactoryGMock  &gmockFactory = *(reinterpret_cast <CCSIntegratedSettingFactoryGMock *> (ccsObjectGetPrivate (factory.get ())));
+
+	return CCSGNOMEIntegrationWithMocks (gmockContext,
+					     gmockBackend,
+					     gmockStorage,
+					     gmockFactory,
+					     context,
+					     backend,
+					     storage,
+					     factory,
+					     integration);
+    }
+
+    CCSIntegration *
+    Real (CCSGNOMEIntegrationWithMocks &integrationWithMocks)
+    {
+	return std::tr1::get <8> (integrationWithMocks).get ();
+    }
+
+    CCSContextGMock &
+    MockContext (CCSGNOMEIntegrationWithMocks &integrationWithMocks)
+    {
+	return std::tr1::get <0> (integrationWithMocks);
+    }
+
+    CCSBackendGMock &
+    MockBackend (CCSGNOMEIntegrationWithMocks &integrationWithMocks)
+    {
+	return std::tr1::get <1> (integrationWithMocks);
+    }
+
+    CCSIntegratedSettingsStorageGMock &
+    MockStorage (CCSGNOMEIntegrationWithMocks &integrationWithMocks)
+    {
+	return std::tr1::get <2> (integrationWithMocks);
+    }
+
+    CCSIntegratedSettingFactoryGMock &
+    MockFactory (CCSGNOMEIntegrationWithMocks &integrationWithMocks)
+    {
+	return std::tr1::get <3> (integrationWithMocks);
+    }
+
+    void
+    IgnoreRegistration (CCSIntegratedSettingsStorageGMock &storage)
+    {
+	EXPECT_CALL (storage, empty ()).WillOnce (Return (FALSE));
+    }
+
+    void
+    AllowReadability (CCSSettingGMock &setting)
+    {
+	EXPECT_CALL (setting, isReadableByBackend ()).WillOnce (Return (TRUE));
+    }
+
+    void
+    ExpectWriteSettings (CCSContextGMock &context)
+    {
+	EXPECT_CALL (context, writeChangedSettings ());
+    }
+
+    void
+    SetNames (CCSSettingGMock   &setting,
+	      CCSPluginGMock    &plugin,
+	      const std::string &settingName,
+	      const std::string &pluginName)
+    {
+	EXPECT_CALL (setting, getName ()).WillOnce (Return (settingName.c_str ()));
+	EXPECT_CALL (setting, getParent ());
+	EXPECT_CALL (plugin, getName ()).WillOnce (Return (pluginName.c_str ()));
+    }
+
+    CCSSettingValue *
+    MakeSettingValue ()
+    {
+	CCSSettingValue *v = new CCSSettingValue;
+	v->parent = NULL;
+	v->isListChild = FALSE;
+	v->refCount = 1;
+
+	return v;
+    }
+
+    boost::shared_ptr <CCSSettingValue>
+    MakeAutoDestroySettingValue (CCSSettingType type)
+    {
+	CCSSettingValue *v = new CCSSettingValue;
+	v->parent = NULL;
+	v->isListChild = FALSE;
+	v->refCount = 1;
+
+	return boost::shared_ptr <CCSSettingValue> (v,
+						    boost::bind (ccsFreeSettingValueWithType, _1, type));
+    }
+
+    const std::string MOCK_PLUGIN ("mock");
+    const std::string MOCK_SETTING ("mock");
+    const std::string MOCK_GNOME_NAME ("mock");
+    const CCSSettingType MOCK_SETTING_TYPE = TypeInt;
+    const SpecialOptionType MOCK_GNOME_SETTING_TYPE = OptionInt;
+}
+
+TEST (CCSGNOMEIntegrationTest, TestConstructComposition)
+{
+    IntegratedSettingWithMockPtr settingWithMock (
+	createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
+						    MOCK_SETTING,
+						    MOCK_SETTING_TYPE,
+						    MOCK_GNOME_SETTING_TYPE,
+						    MOCK_GNOME_NAME,
+						    &ccsDefaultObjectAllocator));
+}
+
+class CCSGNOMEIntegrationTestWithMocks :
+    public ::testing::Test
+{
+    public:
+
+	CCSGNOMEIntegrationTestWithMocks () :
+	    mIntegration (createIntegrationWithMocks (&ccsDefaultObjectAllocator)),
+	    mSetting (AutoDestroy (ccsMockSettingNew (),
+				   ccsSettingUnref)),
+	    mSettingMock ((*(reinterpret_cast <CCSSettingGMock *> (ccsObjectGetPrivate (mSetting.get ()))))),
+	    mIntegratedSetting (),
+	    mPlugin (AutoDestroy (ccsMockPluginNew (),
+				  ccsPluginUnref)),
+	    mPluginMock ((*(reinterpret_cast <CCSPluginGMock *> (ccsObjectGetPrivate (mPlugin.get ())))))
+	{
+	    ON_CALL (mSettingMock, getParent ()).WillByDefault (Return (mPlugin.get ()));
+	}
+
+    protected:
+
+	CCSGNOMEIntegrationWithMocks   mIntegration;
+	boost::shared_ptr <CCSSetting> mSetting;
+	CCSSettingGMock                &mSettingMock;
+	IntegratedSettingWithMockPtr   mIntegratedSetting;
+	boost::shared_ptr <CCSPlugin>  mPlugin;
+	CCSPluginGMock                 &mPluginMock;
+};
+
+class CCSGNOMEIntegrationTestReadIntegrated :
+    public CCSGNOMEIntegrationTestWithMocks
+{
+    public:
+
+	virtual void SetUp ()
+	{
+	    IgnoreRegistration (MockStorage (mIntegration));
+	    AllowReadability (mSettingMock);
+	}
+};
+
+class CCSGNOMEIntegrationTestWriteIntegrated :
+    public CCSGNOMEIntegrationTestWithMocks
+{
+    public:
+
+	virtual void SetUp ()
+	{
+	    IgnoreRegistration (MockStorage (mIntegration));
+	    ExpectWriteSettings (MockContext (mIntegration));
+	}
+};
+
+TEST_F (CCSGNOMEIntegrationTestWithMocks, TestConstructGNOMEIntegration)
+{
+}
+
+TEST_F (CCSGNOMEIntegrationTestReadIntegrated, TestReadInSpecialOptionCurrentViewport)
+{
+    const std::string settingName ("current_viewport");
+    CCSSettingValue   *v = MakeSettingValue ();
+    v->value.asBool = FALSE;
+
+    mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
+								     settingName,
+								     TypeBool,
+								     OptionSpecial,
+								     MOCK_GNOME_NAME,
+								     &ccsDefaultObjectAllocator);
+    SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
+    EXPECT_CALL (Mock (*mIntegratedSetting), readValue (TypeBool)).WillOnce (Return (v));
+    EXPECT_CALL (mSettingMock, setBool (IsTrue (), IsTrue ()));
+
+    EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
+						      NULL,
+						      mSetting.get (),
+						      Real (*mIntegratedSetting)), IsTrue ());
+}
+
+TEST_F (CCSGNOMEIntegrationTestReadIntegrated, TestReadInSpecialOptionFullscreenVisualBell)
+{
+    const std::string settingName ("fullscreen_visual_bell");
+    CCSSettingValue   *v = MakeSettingValue ();
+    v->value.asString = strdup ("fullscreen");
+
+    mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
+								     settingName,
+								     TypeString,
+								     OptionSpecial,
+								     MOCK_GNOME_NAME,
+								     &ccsDefaultObjectAllocator);
+    SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
+    EXPECT_CALL (Mock (*mIntegratedSetting), readValue (TypeString)).WillOnce (Return (v));
+    EXPECT_CALL (mSettingMock, setBool (IsTrue (), IsTrue ()));
+
+    EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
+						      NULL,
+						      mSetting.get (),
+						      Real (*mIntegratedSetting)), IsTrue ());
+}
+
+TEST_F (CCSGNOMEIntegrationTestReadIntegrated, TestReadInSpecialOptionClickToFocus)
+{
+    const std::string settingName ("click_to_focus");
+    CCSSettingValue   *v = MakeSettingValue ();
+    v->value.asString = strdup ("click");
+
+    mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
+								     settingName,
+								     TypeString,
+								     OptionSpecial,
+								     MOCK_GNOME_NAME,
+								     &ccsDefaultObjectAllocator);
+    SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
+    EXPECT_CALL (Mock (*mIntegratedSetting), readValue (TypeString)).WillOnce (Return (v));
+    EXPECT_CALL (mSettingMock, setBool (IsTrue (), IsTrue ()));
+
+    EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
+						      NULL,
+						      mSetting.get (),
+						      Real (*mIntegratedSetting)), IsTrue ());
+}
+
+namespace
+{
+    const std::string DEFAULT_MOUSE_BUTTON_MODIFIERS_STRING ("<Alt>");
+    const std::string GNOME_MOUSE_BUTTON_MODIFIERS_STRING ("<Super>");
+    const unsigned int DEFAULT_MOUSE_BUTTON_MODIFIERS =
+	ccsStringToModifiers (DEFAULT_MOUSE_BUTTON_MODIFIERS_STRING.c_str ());
+    const unsigned int GNOME_MOUSE_BUTTON_MODIFIERS =
+	ccsStringToModifiers (GNOME_MOUSE_BUTTON_MODIFIERS_STRING.c_str ());
+
+    const unsigned int LEFT_BUTTON = 1;
+    const unsigned int MIDDLE_BUTTON = 2;
+    const unsigned int RIGHT_BUTTON = 3;
+
+    typedef cci::ListWrapper <CCSIntegratedSettingList, CCSIntegratedSetting *> CCSIntegratedSettingListWrapper;
+    typedef boost::shared_ptr <CCSIntegratedSettingListWrapper> CCSIntegratedSettingListWrapperPtr;
+
+    CCSIntegratedSettingListWrapperPtr
+    constructCCSIntegratedSettingListWrapper (CCSIntegratedSetting *setting)
+    {
+	return boost::make_shared <CCSIntegratedSettingListWrapper> (ccsIntegratedSettingListAppend (NULL, setting),
+								     ccsIntegratedSettingListFree,
+								     ccsIntegratedSettingListAppend,
+								     ccsIntegratedSettingListRemove,
+								     cci::Shallow);
+    }
+}
+
+class CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers
+{
+    public:
+
+	CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers () :
+	    mIntegratedSettingMBM (AutoDestroy (ccsMockIntegratedSettingNew (&ccsDefaultObjectAllocator),
+						ccsIntegratedSettingUnref)),
+	    mIntegratedSettingMBMMock (*(reinterpret_cast <CCSIntegratedSettingGMock *> (ccsObjectGetPrivate (mIntegratedSettingMBM.get ())))),
+	    mIntegratedSettingsMBM (constructCCSIntegratedSettingListWrapper (mIntegratedSettingMBM.get ())),
+	    mIntegratedSettingResizeWithRB (AutoDestroy (ccsMockIntegratedSettingNew (&ccsDefaultObjectAllocator),
+							 ccsIntegratedSettingUnref)),
+	    mIntegratedSettingResizeWithRBMock (*(reinterpret_cast <CCSIntegratedSettingGMock *> (ccsObjectGetPrivate (mIntegratedSettingResizeWithRB.get ())))),
+	    mIntegratedSettingsResizeWithRB (constructCCSIntegratedSettingListWrapper (mIntegratedSettingResizeWithRB.get ()))
+	{
+	    memset (&mButtonValue, 0, sizeof (CCSSettingButtonValue));
+
+	    mButtonValue.button        = MIDDLE_BUTTON;
+	    mButtonValue.buttonModMask = DEFAULT_MOUSE_BUTTON_MODIFIERS;
+	    mButtonValue.edgeMask      = 0;
+	}
+
+	virtual void SetUp (CCSGNOMEIntegrationWithMocks &integration)
+	{
+	    CCSIntegratedSettingList integratedSettingsMBM =
+		    *mIntegratedSettingsMBM;
+	    CCSIntegratedSettingList integratedSettingsResizeWithRB =
+		    *mIntegratedSettingsResizeWithRB;
+
+	    EXPECT_CALL (MockStorage (integration),
+			 findMatchingSettingsByPluginAndSettingName (Eq (std::string (ccsGNOMEIntegratedPluginNames.SPECIAL)),
+								     Eq (std::string (ccsGNOMEIntegratedSettingNames.NULL_MOUSE_BUTTON_MODIFIER.compizName))))
+		    .WillOnce (Return (integratedSettingsMBM));
+	    EXPECT_CALL (MockStorage (integration),
+			 findMatchingSettingsByPluginAndSettingName (Eq (std::string (ccsGNOMEIntegratedPluginNames.SPECIAL)),
+								     Eq (std::string (ccsGNOMEIntegratedSettingNames.NULL_RESIZE_WITH_RIGHT_BUTTON.compizName))))
+		    .WillOnce (Return (integratedSettingsResizeWithRB));
+	}
+
+
+    protected:
+
+	boost::shared_ptr <CCSIntegratedSetting> mIntegratedSettingMBM;
+	CCSIntegratedSettingGMock                &mIntegratedSettingMBMMock;
+	CCSIntegratedSettingListWrapperPtr       mIntegratedSettingsMBM;
+	boost::shared_ptr <CCSIntegratedSetting> mIntegratedSettingResizeWithRB;
+	CCSIntegratedSettingGMock                &mIntegratedSettingResizeWithRBMock;
+	CCSIntegratedSettingListWrapperPtr       mIntegratedSettingsResizeWithRB;
+	CCSSettingButtonValue                    mButtonValue;
+};
+
+class CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers :
+    public CCSGNOMEIntegrationTestReadIntegrated,
+    public CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers
+{
+    public:
+
+	virtual void SetUp ()
+	{
+	    CCSSettingValue   *vRB = MakeSettingValue ();
+	    CCSSettingValue   *vMBM = MakeSettingValue ();
+	    vRB->value.asBool = TRUE;
+	    vMBM->value.asString = strdup (GNOME_MOUSE_BUTTON_MODIFIERS_STRING.c_str ());
+
+	    CCSGNOMEIntegrationTestReadIntegrated::SetUp ();
+	    CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers::SetUp (mIntegration);
+
+	    EXPECT_CALL (mSettingMock, getButton (_))
+		    .WillOnce (DoAll (
+				SetArgPointee <0> (
+				  mButtonValue),
+				Return (TRUE)));
+
+	    /* Get the GNOME Mouse button modifier */
+	    EXPECT_CALL (mIntegratedSettingMBMMock, readValue (TypeString)).WillOnce (Return (vMBM));
+	    EXPECT_CALL (mIntegratedSettingResizeWithRBMock, readValue (TypeBool)).WillOnce (Return (vRB));
+	}
+};
+
+class CCSGNOMEIntegrationTestWithMocksWriteIntegratedMouseButtonModifiers :
+    public CCSGNOMEIntegrationTestWriteIntegrated,
+    public CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers
+{
+    public:
+
+	CCSGNOMEIntegrationTestWithMocksWriteIntegratedMouseButtonModifiers () :
+	    corePlugin (AutoDestroy (ccsMockPluginNew (),
+				     ccsPluginUnref)),
+	    corePluginMock (*(reinterpret_cast <CCSPluginGMock *> (ccsObjectGetPrivate (corePlugin.get ())))),
+	    resizePlugin (AutoDestroy (ccsMockPluginNew (),
+				       ccsPluginUnref)),
+	    resizePluginMock (*(reinterpret_cast <CCSPluginGMock *> (ccsObjectGetPrivate (resizePlugin.get ())))),
+	    movePlugin (AutoDestroy (ccsMockPluginNew (),
+				     ccsPluginUnref)),
+	    movePluginMock (*(reinterpret_cast <CCSPluginGMock *> (ccsObjectGetPrivate (movePlugin.get ())))),
+	    resizeInitiateButtonSetting (AutoDestroy (ccsMockSettingNew (),
+						      ccsSettingUnref)),
+	    resizeInitiateButtonSettingMock (*(reinterpret_cast <CCSSettingGMock *> (ccsObjectGetPrivate (resizeInitiateButtonSetting.get ())))),
+	    moveInitiateButtonSetting (AutoDestroy (ccsMockSettingNew (),
+						    ccsSettingUnref)),
+	    moveInitiateButtonSettingMock (*(reinterpret_cast <CCSSettingGMock *> (ccsObjectGetPrivate (moveInitiateButtonSetting.get ())))),
+	    coreWindowMenuSetting (AutoDestroy (ccsMockSettingNew (),
+						ccsSettingUnref)),
+	    coreWindowMenuSettingMock (*(reinterpret_cast <CCSSettingGMock *> (ccsObjectGetPrivate (coreWindowMenuSetting.get ())))),
+	    resizeInitiateButton (MakeAutoDestroySettingValue (TypeButton)),
+	    moveInitiateButton (MakeAutoDestroySettingValue (TypeButton)),
+	    coreWindowMenuButton (MakeAutoDestroySettingValue (TypeButton))
+	{
+	    resizeInitiateButton->value.asButton.button = LEFT_BUTTON;
+	    resizeInitiateButton->value.asButton.buttonModMask = 0;
+	    resizeInitiateButton->value.asButton.edgeMask = 0;
+	    moveInitiateButton->value.asButton.button = LEFT_BUTTON;
+	    moveInitiateButton->value.asButton.buttonModMask = DEFAULT_MOUSE_BUTTON_MODIFIERS;
+	    moveInitiateButton->value.asButton.edgeMask = 0;
+	    coreWindowMenuButton->value.asButton.button = MIDDLE_BUTTON;
+	    coreWindowMenuButton->value.asButton.buttonModMask = 0;
+	    coreWindowMenuButton->value.asButton.edgeMask = 0;
+	}
+
+	virtual void SetUp ()
+	{
+	    CCSGNOMEIntegrationTestWriteIntegrated::SetUp ();
+	    CCSGNOMEIntegrationTestWithMocksIntegratedMouseButtonModifiers::SetUp (mIntegration);
+	}
+
+    protected:
+
+	boost::shared_ptr <CCSPlugin> corePlugin;
+	CCSPluginGMock                &corePluginMock;
+	boost::shared_ptr <CCSPlugin> resizePlugin;
+	CCSPluginGMock                &resizePluginMock;
+	boost::shared_ptr <CCSPlugin> movePlugin;
+	CCSPluginGMock                &movePluginMock;
+
+	boost::shared_ptr <CCSSetting> resizeInitiateButtonSetting;
+	CCSSettingGMock                &resizeInitiateButtonSettingMock;
+	boost::shared_ptr <CCSSetting> moveInitiateButtonSetting;
+	CCSSettingGMock                &moveInitiateButtonSettingMock;
+	boost::shared_ptr <CCSSetting> coreWindowMenuSetting;
+	CCSSettingGMock                &coreWindowMenuSettingMock;
+
+	boost::shared_ptr <CCSSettingValue> resizeInitiateButton;
+	boost::shared_ptr <CCSSettingValue> moveInitiateButton;
+	boost::shared_ptr <CCSSettingValue> coreWindowMenuButton;
+};
+
+TEST_F (CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers, TestReadInSpecialOptionMoveInitiateButton)
+{
+    const std::string settingName ("initiate_button");
+    const std::string pluginName ("move");
+
+    CCSSettingButtonValue newButtonValue = mButtonValue;
+    newButtonValue.button = LEFT_BUTTON;
+    newButtonValue.buttonModMask = GNOME_MOUSE_BUTTON_MODIFIERS;
+
+    mIntegratedSetting = createIntegratedSettingCompositionFromMock (pluginName,
+								     settingName,
+								     TypeBool,
+								     OptionSpecial,
+								     MOCK_GNOME_NAME,
+								     &ccsDefaultObjectAllocator);
+    SetNames (mSettingMock, mPluginMock, settingName, pluginName);
+
+    /* Set the new mouse button modifier */
+    EXPECT_CALL (mSettingMock, setButton (Eq (newButtonValue),
+					  IsTrue ()));
+
+    EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
+						      NULL,
+						      mSetting.get (),
+						      Real (*mIntegratedSetting)), IsTrue ());
+}
+
+TEST_F (CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers, TestReadInSpecialOptionResizeInitiateButton)
+{
+    const std::string settingName ("initiate_button");
+    const std::string pluginName ("resize");
+
+    CCSSettingButtonValue newButtonValue = mButtonValue;
+    newButtonValue.button = RIGHT_BUTTON;
+    newButtonValue.buttonModMask = GNOME_MOUSE_BUTTON_MODIFIERS;
+
+    mIntegratedSetting = createIntegratedSettingCompositionFromMock (pluginName,
+								     settingName,
+								     TypeBool,
+								     OptionSpecial,
+								     MOCK_GNOME_NAME,
+								     &ccsDefaultObjectAllocator);
+    SetNames (mSettingMock, mPluginMock, settingName, pluginName);
+
+    /* Set the new mouse button modifier */
+    EXPECT_CALL (mSettingMock, setButton (Eq (newButtonValue),
+					  IsTrue ()));
+
+    EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
+						      NULL,
+						      mSetting.get (),
+						      Real (*mIntegratedSetting)), IsTrue ());
+}
+
+TEST_F (CCSGNOMEIntegrationTestWithMocksReadIntegratedMouseButtonModifiers, TestReadInSpecialOptionWhereIntegratedOptionReturnsNull)
+{
+    const std::string settingName ("initiate_button");
+    const std::string pluginName ("move");
+
+    CCSSettingButtonValue newButtonValue = mButtonValue;
+    newButtonValue.button = LEFT_BUTTON;
+    /* Reading the gnome mouse button modifiers failed, so default to zero */
+    newButtonValue.buttonModMask = 0;
+
+    /* Clear the old expectation */
+    ccsIntegratedSettingReadValue (mIntegratedSettingMBM.get (), TypeString);
+    /* Now return null */
+    EXPECT_CALL (mIntegratedSettingMBMMock, readValue (TypeString)).WillOnce (ReturnNull ());
+
+    mIntegratedSetting = createIntegratedSettingCompositionFromMock (pluginName,
+								     settingName,
+								     TypeBool,
+								     OptionSpecial,
+								     MOCK_GNOME_NAME,
+								     &ccsDefaultObjectAllocator);
+    SetNames (mSettingMock, mPluginMock, settingName, pluginName);
+
+    /* Set the new mouse button modifier */
+    EXPECT_CALL (mSettingMock, setButton (Eq (newButtonValue),
+					  IsTrue ()));
+
+    EXPECT_THAT (ccsIntegrationReadOptionIntoSetting (Real (mIntegration),
+						      NULL,
+						      mSetting.get (),
+						      Real (*mIntegratedSetting)), IsTrue ());
+}
+
+TEST_F (CCSGNOMEIntegrationTestWriteIntegrated, TestWriteCurrentViewport)
+{
+    const std::string                   settingName ("current_viewport");
+    boost::shared_ptr <CCSSettingValue> compizValue (MakeAutoDestroySettingValue (TypeBool));
+    boost::shared_ptr <CCSSettingValue> gnomeValue (MakeAutoDestroySettingValue (TypeBool));
+    CCSSettingInfo                      info;
+
+    compizValue->value.asBool = TRUE;
+    gnomeValue->value.asBool = FALSE;
+
+    mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
+								     settingName,
+								     TypeBool,
+								     OptionSpecial,
+								     MOCK_GNOME_NAME,
+								     &ccsDefaultObjectAllocator);
+    SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
+
+    EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (compizValue.get ()));
+    EXPECT_CALL (Mock (*mIntegratedSetting), writeValue (Pointee (SettingValueMatch (*gnomeValue,
+										     TypeBool,
+										     &info)),
+							 TypeBool));
+    ccsIntegrationWriteSettingIntoOption (Real (mIntegration),
+					  NULL,
+					  mSetting.get (),
+					  Real (*mIntegratedSetting));
+}
+
+TEST_F (CCSGNOMEIntegrationTestWriteIntegrated, TestWriteFullscreenVisualBell)
+{
+    const std::string                   settingName ("fullscreen_visual_bell");
+    boost::shared_ptr <CCSSettingValue> compizValue (MakeAutoDestroySettingValue (TypeBool));
+    boost::shared_ptr <CCSSettingValue> gnomeValue (MakeAutoDestroySettingValue (TypeString));
+    CCSSettingInfo                      info;
+
+    compizValue->value.asBool = TRUE;
+    gnomeValue->value.asString = strdup ("fullscreen");
+
+    mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
+								     settingName,
+								     TypeBool,
+								     OptionSpecial,
+								     MOCK_GNOME_NAME,
+								     &ccsDefaultObjectAllocator);
+    SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
+
+    EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (compizValue.get ()));
+    EXPECT_CALL (Mock (*mIntegratedSetting), writeValue (Pointee (SettingValueMatch (*gnomeValue,
+										     TypeString,
+										     &info)),
+							 TypeString));
+    ccsIntegrationWriteSettingIntoOption (Real (mIntegration),
+					  NULL,
+					  mSetting.get (),
+					  Real (*mIntegratedSetting));
+}
+
+TEST_F (CCSGNOMEIntegrationTestWriteIntegrated, TestWriteClickToFocus)
+{
+    const std::string                   settingName ("click_to_focus");
+    boost::shared_ptr <CCSSettingValue> compizValue (MakeAutoDestroySettingValue (TypeBool));
+    boost::shared_ptr <CCSSettingValue> gnomeValue (MakeAutoDestroySettingValue (TypeString));
+    CCSSettingInfo                      info;
+
+    compizValue->value.asBool = TRUE;
+    gnomeValue->value.asString = strdup ("click");
+
+    mIntegratedSetting = createIntegratedSettingCompositionFromMock (MOCK_PLUGIN,
+								     settingName,
+								     TypeBool,
+								     OptionSpecial,
+								     MOCK_GNOME_NAME,
+								     &ccsDefaultObjectAllocator);
+    SetNames (mSettingMock, mPluginMock, settingName, MOCK_PLUGIN);
+
+    EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (compizValue.get ()));
+    EXPECT_CALL (Mock (*mIntegratedSetting), writeValue (Pointee (SettingValueMatch (*gnomeValue,
+										     TypeString,
+										     &info)),
+							 TypeString));
+    ccsIntegrationWriteSettingIntoOption (Real (mIntegration),
+					  NULL,
+					  mSetting.get (),
+					  Real (*mIntegratedSetting));
+}
+
+/*
+ * TODO: Break up the function that this test covers. Its way too complicated
+ */
+TEST_F (CCSGNOMEIntegrationTestWithMocksWriteIntegratedMouseButtonModifiers, TestWriteMouseButtonModifier)
+{
+    const std::string settingName ("initiate_button");
+    const std::string pluginName  ("move");
+    CCSSettingInfo info;
+
+    mIntegratedSetting = createIntegratedSettingCompositionFromMock (pluginName,
+								     settingName,
+								     TypeBool,
+								     OptionSpecial,
+								     MOCK_GNOME_NAME,
+								     &ccsDefaultObjectAllocator);
+    SetNames (mSettingMock, mPluginMock, settingName, pluginName);
+
+    EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq ("move"))).WillRepeatedly (Return (movePlugin.get ()));
+    EXPECT_CALL (movePluginMock, findSetting (Eq ("initiate_button"))).WillRepeatedly (Return (moveInitiateButtonSetting.get ()));
+    EXPECT_CALL (moveInitiateButtonSettingMock, getType ()).WillRepeatedly (Return (TypeButton));
+    EXPECT_CALL (moveInitiateButtonSettingMock, getValue ()).WillRepeatedly (Return (moveInitiateButton.get ()));
+
+    EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq ("resize"))).WillRepeatedly (Return (resizePlugin.get ()));
+    EXPECT_CALL (resizePluginMock, findSetting (Eq ("initiate_button"))).WillRepeatedly (Return (resizeInitiateButtonSetting.get ()));
+    EXPECT_CALL (resizeInitiateButtonSettingMock, getType ()).WillRepeatedly (Return (TypeButton));
+    EXPECT_CALL (resizeInitiateButtonSettingMock, getValue ()).WillRepeatedly (Return (resizeInitiateButton.get ()));
+
+    EXPECT_CALL (MockContext (mIntegration), findPlugin (Eq ("core"))).WillRepeatedly (Return (corePlugin.get ()));
+    EXPECT_CALL (corePluginMock, findSetting (Eq ("window_menu_button"))).WillRepeatedly (Return (coreWindowMenuSetting.get ()));
+    EXPECT_CALL (coreWindowMenuSettingMock, getType ()).WillRepeatedly (Return (TypeButton));
+    EXPECT_CALL (coreWindowMenuSettingMock, getValue ()).WillRepeatedly (Return (coreWindowMenuButton.get ()));
+
+    boost::shared_ptr <CCSSettingValue> newResizeWithRBValue (MakeAutoDestroySettingValue (TypeBool));
+    newResizeWithRBValue->value.asBool = TRUE;
+
+    EXPECT_CALL (mIntegratedSettingResizeWithRBMock, writeValue (Pointee (SettingValueMatch (*newResizeWithRBValue,
+											     TypeBool,
+											     &info)),
+								 TypeBool));
+
+    boost::shared_ptr <CCSSettingValue> newMBMValue (MakeAutoDestroySettingValue (TypeString));
+    newMBMValue->value.asString = strdup (DEFAULT_MOUSE_BUTTON_MODIFIERS_STRING.c_str ());
+
+    EXPECT_CALL (mSettingMock, getValue ()).WillOnce (Return (moveInitiateButton.get ()));
+
+    EXPECT_CALL (mIntegratedSettingMBMMock, writeValue (Pointee (SettingValueMatch (*newMBMValue,
+										    TypeString,
+										    &info)),
+							TypeString));
+
+    unsigned int modifiers = moveInitiateButton->value.asButton.buttonModMask;
+
+    CCSSettingButtonValue newResizeInitiateButton;
+    CCSSettingButtonValue newMoveInitiateButton;
+    CCSSettingButtonValue newWindowMenuButton;
+
+    memset (&newResizeInitiateButton, 0, sizeof (CCSSettingButtonValue));
+    memset (&newMoveInitiateButton, 0, sizeof (CCSSettingButtonValue));
+    memset (&newWindowMenuButton, 0, sizeof (CCSSettingButtonValue));
+
+    newResizeInitiateButton.button = RIGHT_BUTTON;
+    newResizeInitiateButton.buttonModMask = modifiers;
+    newMoveInitiateButton.button = LEFT_BUTTON;
+    newMoveInitiateButton.buttonModMask = modifiers;
+    newWindowMenuButton.button = MIDDLE_BUTTON;
+    newWindowMenuButton.buttonModMask = modifiers;
+
+    EXPECT_CALL (resizeInitiateButtonSettingMock, setButton (Eq (newResizeInitiateButton),
+							     IsTrue ()));
+    /* The move button is exactly the same, so it is not updated */
+    EXPECT_CALL (moveInitiateButtonSettingMock, setButton (Eq (newMoveInitiateButton),
+							   IsTrue ())).Times (0);
+    EXPECT_CALL (coreWindowMenuSettingMock, setButton (Eq (newWindowMenuButton),
+						       IsTrue ()));
+
+    ccsIntegrationWriteSettingIntoOption (Real (mIntegration),
+					  NULL,
+					  mSetting.get (),
+					  Real (*mIntegratedSetting));
+}

=== modified file 'compizconfig/libcompizconfig/src/main.c'
--- compizconfig/libcompizconfig/src/main.c	2012-09-25 06:58:42 +0000
+++ compizconfig/libcompizconfig/src/main.c	2012-09-25 08:42:23 +0000
@@ -1109,7 +1109,6 @@
 void
 ccsFreeBackend (CCSBackend *backend)
 {
-    ccsBackendFini (backend);
     ccsObjectFinalize (backend);
     free (backend);
 }
@@ -1119,6 +1118,7 @@
 {
     CCSDynamicBackendPrivate *dbPrivate = GET_PRIVATE (CCSDynamicBackendPrivate, backend);
 
+    ccsBackendFini (dbPrivate->backend);
     ccsBackendUnref (dbPrivate->backend);
 
     if (dbPrivate->dlhand)
@@ -5655,7 +5655,7 @@
 void
 ccsFreeIntegratedSettingsStorage (CCSIntegratedSettingsStorage *storage)
 {
-    (*(GET_INTERFACE (CCSIntegratedSettingsStorageInterface, storage))->empty) (storage);
+    (*(GET_INTERFACE (CCSIntegratedSettingsStorageInterface, storage))->free) (storage);
 }
 
 /* CCSIntegratedSettingsStorageDefault implementation */

=== modified file 'compizconfig/libcompizconfig/tests/CMakeLists.txt'
--- compizconfig/libcompizconfig/tests/CMakeLists.txt	2012-09-25 06:58:42 +0000
+++ compizconfig/libcompizconfig/tests/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -93,7 +93,13 @@
 		       compizconfig_ccs_context_mock
 		       compizconfig_ccs_plugin_mock
 		       compizconfig_ccs_setting_mock
-		       compizconfig_ccs_backend_mock)
+                       compizconfig_ccs_backend_mock
+                       compizconfig_ccs_backend_conformance_test
+                       compizconfig_ccs_item_in_list_matcher
+                       compizconfig_ccs_list_equality
+                       compizconfig_ccs_list_wrapper
+                       compizconfig_ccs_setting_value_operators
+                       compizconfig_ccs_test_value_combinations)
 
 target_link_libraries (compizconfig_test_ccs_setting
 		       ${GTEST_BOTH_LIBRARIES}
@@ -126,6 +132,8 @@
                        compizconfig_ccs_context_mock
                        compizconfig_ccs_plugin_mock
                        compizconfig_ccs_setting_mock
+                       compizconfig_ccs_item_in_list_matcher
+		       compizconfig_ccs_setting_value_matcher
 )
 
 compiz_discover_tests (compizconfig_test_ccs_object COVERAGE compizconfig)

=== modified file 'compizconfig/libcompizconfig/tests/compizconfig_test_ccs_mock_backend_conformance.cpp'
--- compizconfig/libcompizconfig/tests/compizconfig_test_ccs_mock_backend_conformance.cpp	2012-09-18 23:56:02 +0000
+++ compizconfig/libcompizconfig/tests/compizconfig_test_ccs_mock_backend_conformance.cpp	2012-09-25 08:42:23 +0000
@@ -151,61 +151,73 @@
 	virtual Bool ReadBoolAtKey (const std::string &plugin,
 				    const std::string &key)
 	{
-	    return boolToBool (ValueForKeyRetreival <bool> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues));
+            return compizconfig::test::boolToBool (
+                ValueForKeyRetreival <bool> ().GetValueForKey (
+                    keynameFromPluginKey (plugin, key), mValues));
 	}
 
 	virtual int ReadIntegerAtKey (const std::string &plugin,
 				      const std::string &key)
 	{
-	    return ValueForKeyRetreival <int> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
+            return ValueForKeyRetreival <int> ().GetValueForKey (
+                keynameFromPluginKey (plugin, key), mValues);
 	}
 
 	virtual float ReadFloatAtKey (const std::string &plugin,
 				      const std::string &key)
 	{
-	    return ValueForKeyRetreival <float> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
+            return ValueForKeyRetreival <float> ().GetValueForKey (
+                keynameFromPluginKey (plugin, key), mValues);
 	}
 
 	virtual const char * ReadStringAtKey (const std::string &plugin,
 					      const std::string &key)
 	{
-	    return ValueForKeyRetreival <const char *> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
+            return ValueForKeyRetreival <const char *> ().GetValueForKey (
+                keynameFromPluginKey (plugin, key), mValues);
 	}
 
 	virtual CCSSettingColorValue ReadColorAtKey (const std::string &plugin,
 						     const std::string &key)
 	{
-	    return ValueForKeyRetreival <CCSSettingColorValue> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
+            return ValueForKeyRetreival <CCSSettingColorValue> ().GetValueForKey (
+                keynameFromPluginKey (plugin, key), mValues);
 	}
 
 	virtual CCSSettingKeyValue ReadKeyAtKey (const std::string &plugin,
 						 const std::string &key)
 	{
-	    return ValueForKeyRetreival <CCSSettingKeyValue> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
+            return ValueForKeyRetreival <CCSSettingKeyValue> ().GetValueForKey (
+                keynameFromPluginKey (plugin, key), mValues);
 	}
 
 	virtual CCSSettingButtonValue ReadButtonAtKey (const std::string &plugin,
 						       const std::string &key)
 	{
-	    return ValueForKeyRetreival <CCSSettingButtonValue> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
+            return ValueForKeyRetreival <CCSSettingButtonValue> ().GetValueForKey (
+                keynameFromPluginKey (plugin, key), mValues);
 	}
 
 	virtual unsigned int ReadEdgeAtKey (const std::string &plugin,
 				       const std::string &key)
 	{
-	    return ValueForKeyRetreival <unsigned int> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
+            return ValueForKeyRetreival <unsigned int> ().GetValueForKey (
+                keynameFromPluginKey (plugin, key), mValues);
 	}
 
 	virtual const char * ReadMatchAtKey (const std::string &plugin,
 					     const std::string &key)
 	{
-	    return ValueForKeyRetreival <const char *> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues);
+            return ValueForKeyRetreival <const char *> ().GetValueForKey (
+                keynameFromPluginKey (plugin, key), mValues);
 	}
 
 	virtual Bool ReadBellAtKey (const std::string &plugin,
 				       const std::string &key)
 	{
-	    return boolToBool (ValueForKeyRetreival <bool> ().GetValueForKey (keynameFromPluginKey (plugin, key), mValues));
+            return compizconfig::test::boolToBool (
+                ValueForKeyRetreival <bool> ().GetValueForKey (
+                    keynameFromPluginKey (plugin, key), mValues));
 	}
 
 	virtual CCSSettingValueList ReadListAtKey (const std::string &plugin,

=== modified file 'compizconfig/libcompizconfig/tests/compizconfig_test_ccs_settings_upgrade_internal.cpp'
--- compizconfig/libcompizconfig/tests/compizconfig_test_ccs_settings_upgrade_internal.cpp	2012-09-18 23:56:02 +0000
+++ compizconfig/libcompizconfig/tests/compizconfig_test_ccs_settings_upgrade_internal.cpp	2012-09-25 08:42:23 +0000
@@ -38,10 +38,12 @@
 #include "ccs_settings_upgrade_internal.h"
 #include "gtest_shared_characterwrapper.h"
 #include "gtest_shared_autodestroy.h"
+#include "gtest_unspecified_bool_type_matcher.h"
 #include "compizconfig_ccs_list_equality.h"
 #include "compizconfig_ccs_item_in_list_matcher.h"
 #include "compizconfig_ccs_list_wrapper.h"
 #include "compizconfig_ccs_setting_value_operators.h"
+#include "compizconfig_ccs_setting_value_matcher.h"
 
 using ::testing::IsNull;
 using ::testing::Eq;
@@ -73,9 +75,6 @@
     static const unsigned int CCS_SETTINGS_UPGRADE_TEST_CORRECT_NUM = 1;
 }
 
-MATCHER(BoolTrue, "Bool True") { if (arg) return true; else return false; }
-MATCHER(BoolFalse, "Bool False") { if (!arg) return true; else return false; }
-
 TEST (CCSSettingsUpgradeInternalTest, TestDetokenizeAndSetValues)
 {
     char *profileName = NULL;
@@ -86,7 +85,7 @@
     EXPECT_THAT (ccsUpgradeGetDomainNumAndProfile (CCS_SETTINGS_UPGRADE_TEST_CORRECT_FILENAME.c_str (),
 						   &domainName,
 						   &num,
-						   &profileName), BoolTrue ());
+						   &profileName), IsTrue ());
 
     CharacterWrapper profileNameC (profileName);
     CharacterWrapper domainNameC (domainName);
@@ -106,7 +105,7 @@
     EXPECT_THAT (ccsUpgradeGetDomainNumAndProfile (CCS_SETTINGS_UPGRADE_TEST_INCORRECT_FILENAME.c_str (),
 						   &domainName,
 						   &num,
-						   &profileName), BoolFalse ());
+						   &profileName), IsFalse ());
 
     EXPECT_THAT (profileName, IsNull ());
     EXPECT_THAT (domainName, IsNull ());
@@ -114,7 +113,7 @@
     EXPECT_THAT (ccsUpgradeGetDomainNumAndProfile (CCS_SETTINGS_UPGRADE_TEST_VERY_INCORRECT_FILENAME.c_str (),
 						   &domainName,
 						   &num,
-						   &profileName), BoolFalse ());
+						   &profileName), IsFalse ());
 
     EXPECT_THAT (profileName, IsNull ());
     EXPECT_THAT (domainName, IsNull ());
@@ -122,13 +121,13 @@
 
 TEST (CCSSettingsUpgradeInternalTest, TestDetokenizeAndReturnTrueForUpgradeFileName)
 {
-    EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_CORRECT_FILENAME.c_str ()), BoolTrue ());
+    EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_CORRECT_FILENAME.c_str ()), IsTrue ());
 }
 
 TEST (CCSSettingsUpgradeInternalTest, TestDetokenizeAndReturnFalseForNoUpgradeFileName)
 {
-    EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_INCORRECT_FILENAME.c_str ()), BoolFalse ());
-    EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_VERY_INCORRECT_FILENAME.c_str ()), BoolFalse ());
+    EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_INCORRECT_FILENAME.c_str ()), IsFalse ());
+    EXPECT_THAT (ccsUpgradeNameFilter (CCS_SETTINGS_UPGRADE_TEST_VERY_INCORRECT_FILENAME.c_str ()), IsFalse ());
 }
 
 namespace
@@ -242,57 +241,6 @@
 
 namespace
 {
-    class CCSSettingValueMatcher :
-	public ::testing::MatcherInterface <CCSSettingValue>
-    {
-	public:
-
-	    CCSSettingValueMatcher (const CCSSettingValue &match,
-				    CCSSettingType        type,
-				    CCSSettingInfo        *info) :
-		mMatch (match),
-		mType  (type),
-		mInfo  (info)
-	    {
-	    }
-
-	    virtual bool MatchAndExplain (CCSSettingValue x, MatchResultListener *listener) const
-	    {
-		if (ccsCheckValueEq (&x,
-				     mType,
-				     mInfo,
-				     &mMatch,
-				     mType,
-				     mInfo))
-		    return true;
-		return false;
-	    }
-
-	    virtual void DescribeTo (std::ostream *os) const
-	    {
-		*os << "Value Matches";
-	    }
-
-	    virtual void DescribeNegationTo (std::ostream *os) const
-	    {
-		*os << "Value does not Match";
-	    }
-
-	private:
-
-	    const CCSSettingValue &mMatch;
-	    CCSSettingType	  mType;
-	    CCSSettingInfo	  *mInfo;
-    };
-
-    Matcher <CCSSettingValue>
-    SettingValueMatch (const CCSSettingValue &match,
-		       CCSSettingType	     type,
-		       CCSSettingInfo	     *info)
-    {
-	return MakeMatcher (new CCSSettingValueMatcher (match, type, info));
-    }
-
     typedef boost::shared_ptr <cc::ListWrapper <CCSSettingList, CCSSetting *> > CCSSettingListWrapperPtr;
 
     CCSSettingListWrapperPtr
@@ -362,7 +310,7 @@
     EXPECT_CALL (Mock (resetSettingIdentifier), getValue ()).WillOnce (Return (&valueResetIdentifier));
     EXPECT_CALL (Mock (settingToReset), getValue ()).WillOnce (Return (&valueToReset));
 
-    EXPECT_CALL (Mock (settingToReset), resetToDefault (BoolTrue ()));
+    EXPECT_CALL (Mock (settingToReset), resetToDefault (IsTrue ()));
 
     ccsUpgradeClearValues (*list);
 }
@@ -465,7 +413,7 @@
 
     EXPECT_CALL (Mock (settingToBeChanged), setValue (Pointee (SettingValueMatch (valueResetIdentifier,
 										  TypeInt,
-										  &info)), BoolTrue ()));
+										  &info)), IsTrue ()));
 
     ccsUpgradeAddValues (*list);
 }
@@ -547,7 +495,7 @@
 
     EXPECT_CALL (Mock (settingToBeChanged), setValue (Pointee (SettingValueMatch (toSettingIdentifierValue,
 										  TypeInt,
-										  &info)), BoolTrue ()));
+										  &info)), IsTrue ()));
 
     ccsUpgradeReplaceValues (*replaceFromValueSettings,
 			     *replaceToValueSettings);
@@ -712,7 +660,7 @@
 
     EXPECT_CALL (Mock (settingToAppendValuesTo), setList (
 		     IsSettingValueInSettingValueCCSList (
-			    SettingValueMatch (appendedStringInListValue, TypeString, &info)), BoolTrue ()));
+			    SettingValueMatch (appendedStringInListValue, TypeString, &info)), IsTrue ()));
 
     ccsUpgradeAddValues (*list);
 }
@@ -777,7 +725,7 @@
     EXPECT_CALL (Mock (settingToRemoveValuesFrom), setList (
 		     Not (
 			 IsSettingValueInSettingValueCCSList (
-			    SettingValueMatch (removedStringInListValue, TypeString, &info))), BoolTrue ()));
+			    SettingValueMatch (removedStringInListValue, TypeString, &info))), IsTrue ()));
 
     ccsUpgradeClearValues (*list);
 }

=== modified file 'compizconfig/mocks/libcompizconfig/CMakeLists.txt'
--- compizconfig/mocks/libcompizconfig/CMakeLists.txt	2012-09-10 01:06:55 +0000
+++ compizconfig/mocks/libcompizconfig/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -25,6 +25,18 @@
 add_library (compizconfig_ccs_text_file_mock
              ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_text_file_mock.cpp)
 
+add_library (compizconfig_ccs_integration_mock
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_integration_mock.cpp)
+
+add_library (compizconfig_ccs_integrated_setting_mock
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_integrated_setting_mock.cpp)
+
+add_library (compizconfig_ccs_integrated_setting_storage_mock
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_integrated_setting_storage_mock.cpp)
+
+add_library (compizconfig_ccs_integrated_setting_factory_mock
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_integrated_setting_factory_mock.cpp)
+
 target_link_libraries (compizconfig_ccs_context_mock
 		       ${GTEST_BOTH_LIBRARIES}
 		       ${GMOCK_LIBRARY}
@@ -62,3 +74,31 @@
                        ${GMOCK_LIBRARY}
                        ${GMOCK_MAIN_LIBRARY}
                        ${CMAKE_THREAD_LIBS_INIT})
+
+target_link_libraries (compizconfig_ccs_integration_mock
+                       ${GTEST_BOTH_LIBRARIES}
+                       ${GMOCK_LIBRARY}
+                       ${GMOCK_MAIN_LIBRARY}
+                       ${CMAKE_THREAD_LIBS_INIT}
+		       compizconfig)
+
+target_link_libraries (compizconfig_ccs_integrated_setting_mock
+                       ${GTEST_BOTH_LIBRARIES}
+                       ${GMOCK_LIBRARY}
+                       ${GMOCK_MAIN_LIBRARY}
+                       ${CMAKE_THREAD_LIBS_INIT}
+		       compizconfig)
+
+target_link_libraries (compizconfig_ccs_integrated_setting_factory_mock
+                       ${GTEST_BOTH_LIBRARIES}
+                       ${GMOCK_LIBRARY}
+                       ${GMOCK_MAIN_LIBRARY}
+                       ${CMAKE_THREAD_LIBS_INIT}
+		       compizconfig)
+
+target_link_libraries (compizconfig_ccs_integrated_setting_storage_mock
+                       ${GTEST_BOTH_LIBRARIES}
+                       ${GMOCK_LIBRARY}
+                       ${GMOCK_MAIN_LIBRARY}
+                       ${CMAKE_THREAD_LIBS_INIT}
+		       compizconfig)

=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.cpp'
--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,70 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <ccs.h>
+
+#include "compizconfig_ccs_integrated_setting_factory_mock.h"
+
+const CCSIntegratedSettingFactoryInterface mockIntegratedSettingFactoryInterface =
+{
+    CCSIntegratedSettingFactoryGMock::ccsIntegratedSettingFactoryCreateIntegratedSettingForCCSSettingNameAndType,
+    CCSIntegratedSettingFactoryGMock::ccsIntegratedSettingFactoryFree
+};
+
+CCSIntegratedSettingFactory *
+ccsMockIntegratedSettingFactoryNew (CCSObjectAllocationInterface *ai)
+{
+    CCSIntegratedSettingFactory *integratedSettingFactory =
+	    reinterpret_cast <CCSIntegratedSettingFactory *> ((*ai->calloc_) (ai->allocator, 1, sizeof (CCSIntegratedSettingFactory)));
+
+    if (!integratedSettingFactory)
+	return NULL;
+
+    CCSIntegratedSettingFactoryGMock *gmockFactory = new CCSIntegratedSettingFactoryGMock (integratedSettingFactory);
+
+    ccsObjectInit (integratedSettingFactory, ai);
+    ccsObjectSetPrivate (integratedSettingFactory, (CCSPrivate *) gmockFactory);
+    ccsObjectAddInterface (integratedSettingFactory,
+			   reinterpret_cast <const CCSInterface *> (&mockIntegratedSettingFactoryInterface),
+			   GET_INTERFACE_TYPE (CCSIntegratedSettingFactoryInterface));
+
+    ccsObjectRef (integratedSettingFactory);
+
+    return integratedSettingFactory;
+}
+
+void
+ccsMockIntegratedSettingFactoryFree (CCSIntegratedSettingFactory *integratedSettingFactory)
+{
+    CCSIntegratedSettingFactoryGMock *gmockFactory =
+	    GET_PRIVATE (CCSIntegratedSettingFactoryGMock, integratedSettingFactory);
+
+    delete gmockFactory;
+
+    ccsObjectSetPrivate (integratedSettingFactory, NULL);
+    ccsObjectFinalize (integratedSettingFactory);
+    (*integratedSettingFactory->object.object_allocation->free_)
+	    (integratedSettingFactory->object.object_allocation->allocator, integratedSettingFactory);
+}

=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.h'
--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.h	1970-01-01 00:00:00 +0000
+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_factory_mock.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,99 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_CCS_INTEGRATED_SETTING_FACTORY_MOCK_H
+#define _COMPIZCONFIG_CCS_INTEGRATED_SETTING_FACTORY_MOCK_H
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <ccs.h>
+#include <ccs-backend.h>
+
+CCSIntegratedSettingFactory *
+ccsMockIntegratedSettingFactoryNew (CCSObjectAllocationInterface *ai);
+
+void
+ccsMockIntegratedSettingFactoryFree (CCSIntegratedSettingFactory *);
+
+class CCSIntegratedSettingFactoryGMockInterface
+{
+    public:
+
+	virtual ~CCSIntegratedSettingFactoryGMockInterface () {}
+
+	virtual CCSIntegratedSetting * createIntegratedSettingForCCSNameAndType (CCSIntegration *integration,
+										 const char     *pluginName,
+										 const char     *settingName,
+										 CCSSettingType type) = 0;
+};
+
+class CCSIntegratedSettingFactoryGMock :
+    public CCSIntegratedSettingFactoryGMockInterface
+{
+    public:
+
+	MOCK_METHOD4 (createIntegratedSettingForCCSNameAndType, CCSIntegratedSetting * (CCSIntegration *,
+											const char     *,
+											const char     *,
+											CCSSettingType  ));
+
+	CCSIntegratedSettingFactoryGMock (CCSIntegratedSettingFactory *integratedSettingFactory) :
+	    mIntegratedSettingFactory (integratedSettingFactory)
+	{
+	}
+
+	CCSIntegratedSettingFactory *
+	getIntegratedSettingFactory ()
+	{
+	    return mIntegratedSettingFactory;
+	}
+
+    public:
+
+	static CCSIntegratedSetting *
+	ccsIntegratedSettingFactoryCreateIntegratedSettingForCCSSettingNameAndType (CCSIntegratedSettingFactory *factory,
+										    CCSIntegration              *integration,
+										    const char                  *pluginName,
+										    const char                  *settingName,
+										    CCSSettingType              type)
+	{
+	    return reinterpret_cast <CCSIntegratedSettingFactoryGMockInterface *> (factory)->createIntegratedSettingForCCSNameAndType (integration,
+																       pluginName,
+																       settingName,
+																       type);
+	}
+
+	static void
+	ccsIntegratedSettingFactoryFree (CCSIntegratedSettingFactory *integratedSettingFactory)
+	{
+	    ccsMockIntegratedSettingFactoryFree (integratedSettingFactory);
+	}
+
+    private:
+
+	CCSIntegratedSettingFactory *mIntegratedSettingFactory;
+};
+
+extern const CCSIntegratedSettingFactoryInterface mockIntegratedSettingFactoryInterface;
+
+#endif

=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.cpp'
--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,71 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <ccs.h>
+
+#include "compizconfig_ccs_integrated_setting_mock.h"
+
+const CCSIntegratedSettingInterface mockIntegratedSettingInterface =
+{
+    CCSIntegratedSettingGMock::ccsIntegratedSettingReadValue,
+    CCSIntegratedSettingGMock::ccsIntegratedSettingWriteValue,
+    CCSIntegratedSettingGMock::ccsIntegratedSettingFree
+};
+
+CCSIntegratedSetting *
+ccsMockIntegratedSettingNew (CCSObjectAllocationInterface *ai)
+{
+    CCSIntegratedSetting *integratedSetting =
+	    reinterpret_cast <CCSIntegratedSetting *> ((*ai->calloc_) (ai->allocator, 1, sizeof (CCSIntegratedSetting)));
+
+    if (!integratedSetting)
+	return NULL;
+
+    CCSIntegratedSettingGMock *gmockBackend = new CCSIntegratedSettingGMock (integratedSetting);
+
+    ccsObjectInit (integratedSetting, ai);
+    ccsObjectSetPrivate (integratedSetting, (CCSPrivate *) gmockBackend);
+    ccsObjectAddInterface (integratedSetting,
+			   reinterpret_cast <const CCSInterface *> (&mockIntegratedSettingInterface),
+			   GET_INTERFACE_TYPE (CCSIntegratedSettingInterface));
+
+    ccsObjectRef (integratedSetting);
+
+    return integratedSetting;
+}
+
+void
+ccsMockIntegratedSettingFree (CCSIntegratedSetting *integration)
+{
+    CCSIntegratedSettingGMock *gmockIntegration =
+	    GET_PRIVATE (CCSIntegratedSettingGMock, integration);
+
+    delete gmockIntegration;
+
+    ccsObjectSetPrivate (integration, NULL);
+    ccsObjectFinalize (integration);
+    (*integration->object.object_allocation->free_)
+	    (integration->object.object_allocation->allocator, integration);
+}

=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.h'
--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.h	1970-01-01 00:00:00 +0000
+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_mock.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,97 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_CCS_INTEGRATED_SETTING_MOCK_H
+#define _COMPIZCONFIG_CCS_INTEGRATED_SETTING_MOCK_H
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <ccs.h>
+#include <ccs-backend.h>
+
+CCSIntegratedSetting *
+ccsMockIntegratedSettingNew (CCSObjectAllocationInterface *ai);
+
+void
+ccsMockIntegratedSettingFree (CCSIntegratedSetting *);
+
+class CCSIntegratedSettingGMockInterface
+{
+    public:
+
+	virtual ~CCSIntegratedSettingGMockInterface () {}
+
+	virtual CCSSettingValue * readValue (CCSSettingType) = 0;
+	virtual void writeValue (CCSSettingValue *, CCSSettingType) = 0;
+};
+
+class CCSIntegratedSettingGMock :
+    public CCSIntegratedSettingGMockInterface
+{
+    public:
+
+	MOCK_METHOD1 (readValue, CCSSettingValue * (CCSSettingType));
+	MOCK_METHOD2 (writeValue, void (CCSSettingValue *, CCSSettingType));
+
+	CCSIntegratedSettingGMock (CCSIntegratedSetting *integratedSetting) :
+	    mIntegrationSetting (integratedSetting)
+	{
+	}
+
+	CCSIntegratedSetting *
+	getIntegratedSetting ()
+	{
+	    return mIntegrationSetting;
+	}
+
+    public:
+
+	static CCSSettingValue *
+	ccsIntegratedSettingReadValue (CCSIntegratedSetting *integratedSetting,
+				       CCSSettingType       type)
+	{
+	    return reinterpret_cast <CCSIntegratedSettingGMockInterface *> (ccsObjectGetPrivate (integratedSetting))->readValue (type);
+	}
+
+	static void
+	ccsIntegratedSettingWriteValue (CCSIntegratedSetting *integratedSetting,
+					CCSSettingValue      *value,
+					CCSSettingType       type)
+	{
+	    reinterpret_cast <CCSIntegratedSettingGMockInterface *> (ccsObjectGetPrivate (integratedSetting))->writeValue (value, type);
+	}
+
+	static void
+	ccsIntegratedSettingFree (CCSIntegratedSetting *integratedSetting)
+	{
+	    ccsMockIntegratedSettingFree (integratedSetting);
+	}
+
+    private:
+
+	CCSIntegratedSetting *mIntegrationSetting;
+};
+
+extern const CCSIntegratedSettingInterface mockIntegratedSettingInterface;
+
+#endif

=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.cpp'
--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,73 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <ccs.h>
+
+#include "compizconfig_ccs_integrated_setting_storage_mock.h"
+
+const CCSIntegratedSettingsStorageInterface mockIntegratedSettingsStorageInterface =
+{
+    CCSIntegratedSettingsStorageGMock::ccsIntegratedSettingsStorageFindMatchingSettingsByPredicate,
+    CCSIntegratedSettingsStorageGMock::ccsIntegratedSettingsStorageFindMatchingSettingsByPluginAndSettingName,
+    CCSIntegratedSettingsStorageGMock::ccsIntegratedSettingsStorageAddSetting,
+    CCSIntegratedSettingsStorageGMock::ccsIntegratedSettingsStorageEmpty,
+    CCSIntegratedSettingsStorageGMock::ccsIntegratedSettingsStorageFree
+};
+
+CCSIntegratedSettingsStorage *
+ccsMockIntegratedSettingsStorageNew (CCSObjectAllocationInterface *ai)
+{
+    CCSIntegratedSettingsStorage *storage =
+	    reinterpret_cast <CCSIntegratedSettingsStorage *> ((*ai->calloc_) (ai->allocator, 1, sizeof (CCSIntegratedSettingsStorage)));
+
+    if (!storage)
+	return NULL;
+
+    CCSIntegratedSettingsStorageGMock *gmockBackend = new CCSIntegratedSettingsStorageGMock (storage);
+
+    ccsObjectInit (storage, ai);
+    ccsObjectSetPrivate (storage, (CCSPrivate *) gmockBackend);
+    ccsObjectAddInterface (storage,
+			   reinterpret_cast <const CCSInterface *> (&mockIntegratedSettingsStorageInterface),
+			   GET_INTERFACE_TYPE (CCSIntegratedSettingsStorageInterface));
+
+    ccsObjectRef (storage);
+
+    return storage;
+}
+
+void
+ccsMockIntegratedSettingsStorageFree (CCSIntegratedSettingsStorage *storage)
+{
+    CCSIntegratedSettingsStorageGMock *gmockStorage =
+	    GET_PRIVATE (CCSIntegratedSettingsStorageGMock, storage);
+
+    delete gmockStorage;
+
+    ccsObjectSetPrivate (storage, NULL);
+    ccsObjectFinalize (storage);
+    (*storage->object.object_allocation->free_)
+	    (storage->object.object_allocation->allocator, storage);
+}

=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.h'
--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.h	1970-01-01 00:00:00 +0000
+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integrated_setting_storage_mock.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,119 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_CCS_INTEGRATED_SETTING_STORAGE_MOCK_H
+#define _COMPIZCONFIG_CCS_INTEGRATED_SETTING_STORAGE_MOCK_H
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <ccs.h>
+#include <ccs-backend.h>
+
+CCSIntegratedSettingsStorage *
+ccsMockIntegratedSettingsStorageNew (CCSObjectAllocationInterface *ai);
+
+void
+ccsMockIntegratedSettingsStorageFree (CCSIntegratedSettingsStorage *);
+
+class CCSIntegratedSettingsStorageGMockInterface
+{
+    public:
+
+	virtual ~CCSIntegratedSettingsStorageGMockInterface () {}
+
+	virtual CCSIntegratedSettingList findMatchingSettingsByPluginAndSettingName (const char *pluginName,
+										     const char *settingName) = 0;
+	virtual void addSetting (CCSIntegratedSetting *setting) = 0;
+	virtual CCSIntegratedSettingList findMatchingSettingsByPredicate (CCSIntegratedSettingsStorageFindPredicate pred,
+									  void                                      *data) = 0;
+	virtual Bool empty () = 0;
+};
+
+class CCSIntegratedSettingsStorageGMock :
+    public CCSIntegratedSettingsStorageGMockInterface
+{
+    public:
+
+	MOCK_METHOD2 (findMatchingSettingsByPluginAndSettingName, CCSIntegratedSettingList (const char *,
+											    const char *));
+	MOCK_METHOD1 (addSetting, void (CCSIntegratedSetting *));
+	MOCK_METHOD2 (findMatchingSettingsByPredicate, CCSIntegratedSettingList (CCSIntegratedSettingsStorageFindPredicate ,
+										 void                                      *));
+	MOCK_METHOD0 (empty, Bool ());
+
+	CCSIntegratedSettingsStorageGMock (CCSIntegratedSettingsStorage *integratedSetting) :
+	    mIntegrationSetting (integratedSetting)
+	{
+	}
+
+	CCSIntegratedSettingsStorage *
+	getIntegratedSettingsStorage ()
+	{
+	    return mIntegrationSetting;
+	}
+
+    public:
+
+	static CCSIntegratedSettingList
+	ccsIntegratedSettingsStorageFindMatchingSettingsByPredicate (CCSIntegratedSettingsStorage              *storage,
+								     CCSIntegratedSettingsStorageFindPredicate pred,
+								     void			               *data)
+	{
+	    return reinterpret_cast <CCSIntegratedSettingsStorageGMockInterface *> (ccsObjectGetPrivate (storage))->findMatchingSettingsByPredicate (pred, data);
+	}
+
+	static CCSIntegratedSettingList
+	ccsIntegratedSettingsStorageFindMatchingSettingsByPluginAndSettingName (CCSIntegratedSettingsStorage *storage,
+										const char                   *pluginName,
+										const char                   *settingName)
+	{
+	    return reinterpret_cast <CCSIntegratedSettingsStorageGMockInterface *> (ccsObjectGetPrivate (storage))->findMatchingSettingsByPluginAndSettingName (pluginName, settingName);
+	}
+
+	static void
+	ccsIntegratedSettingsStorageAddSetting (CCSIntegratedSettingsStorage *storage,
+						CCSIntegratedSetting	     *setting)
+	{
+	    return reinterpret_cast <CCSIntegratedSettingsStorageGMockInterface *> (ccsObjectGetPrivate (storage))->addSetting (setting);
+	}
+
+	static Bool
+	ccsIntegratedSettingsStorageEmpty (CCSIntegratedSettingsStorage *storage)
+	{
+	    return reinterpret_cast <CCSIntegratedSettingsStorageGMockInterface *> (ccsObjectGetPrivate (storage))->empty ();
+	}
+
+	static void
+	ccsIntegratedSettingsStorageFree (CCSIntegratedSettingsStorage *integratedSetting)
+	{
+	    ccsMockIntegratedSettingsStorageFree (integratedSetting);
+	}
+
+    private:
+
+	CCSIntegratedSettingsStorage *mIntegrationSetting;
+};
+
+extern const CCSIntegratedSettingsStorageInterface mockIntegratedSettingsStorageInterface;
+
+#endif

=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.cpp'
--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,70 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <ccs.h>
+
+#include "compizconfig_ccs_integration_mock.h"
+
+const CCSIntegrationInterface mockIntegrationBackendInterface =
+{
+    CCSIntegrationGMock::ccsIntegrationGetIntegratedOptionIndex,
+    CCSIntegrationGMock::ccsIntegrationReadOptionIntoSetting,
+    CCSIntegrationGMock::ccsIntegrationWriteSettingIntoOption,
+    CCSIntegrationGMock::ccsIntegrationUpdateIntegratedSettings,
+    CCSIntegrationGMock::ccsIntegrationDisallowIntegratedWrites,
+    CCSIntegrationGMock::ccsIntegrationAllowIntegratedWrites,
+    CCSIntegrationGMock::ccsFreeIntegration
+};
+
+CCSIntegration *
+ccsMockIntegrationBackendNew (CCSObjectAllocationInterface *ai)
+{
+    CCSIntegration *integration = reinterpret_cast <CCSIntegration *> ((*ai->calloc_) (ai->allocator, 1, sizeof (CCSIntegration)));
+
+    if (!integration)
+	return NULL;
+
+    CCSIntegrationGMock *gmockBackend = new CCSIntegrationGMock (integration);
+
+    ccsObjectInit (integration, ai);
+    ccsObjectSetPrivate (integration, (CCSPrivate *) gmockBackend);
+    ccsObjectAddInterface (integration, (const CCSInterface *) &mockIntegrationBackendInterface, GET_INTERFACE_TYPE (CCSIntegrationInterface));
+
+    ccsObjectRef (integration);
+
+    return integration;
+}
+
+void
+ccsMockIntegrationBackendFree (CCSIntegration *integration)
+{
+    CCSIntegrationGMock *gmockBackend = reinterpret_cast <CCSIntegrationGMock *> (ccsObjectGetPrivate (integration));
+
+    delete gmockBackend;
+
+    ccsObjectSetPrivate (integration, NULL);
+    ccsObjectFinalize (integration);
+    (*integration->object.object_allocation->free_) (integration->object.object_allocation->allocator, integration);
+}

=== added file 'compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.h'
--- compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.h	1970-01-01 00:00:00 +0000
+++ compizconfig/mocks/libcompizconfig/compizconfig_ccs_integration_mock.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,129 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_CCS_INTEGRATION_MOCK_H
+#define _COMPIZCONFIG_CCS_INTEGRATION_MOCK_H
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <ccs.h>
+
+CCSIntegration *
+ccsMockIntegrationBackendNew (CCSObjectAllocationInterface *ai);
+
+void
+ccsMockIntegrationBackendFree (CCSIntegration *integration);
+
+class CCSIntegrationGMockInterface
+{
+    public:
+
+	virtual ~CCSIntegrationGMockInterface () {}
+
+	virtual CCSIntegratedSetting * getIntegratedOptionIndex (const char *pluginName, const char *settingName) = 0;
+	virtual Bool readOptionIntoSetting (CCSContext *context, CCSSetting *setting, CCSIntegratedSetting *) = 0;
+	virtual void writeOptionFromSetting (CCSContext *context, CCSSetting *setting, CCSIntegratedSetting *) = 0;
+	virtual void updateIntegratedSettings (CCSContext *context, CCSIntegratedSettingList settingList) = 0;
+	virtual void disallowIntegratedWrites () = 0;
+	virtual void allowIntegratedWrites () = 0;
+};
+
+class CCSIntegrationGMock :
+    public CCSIntegrationGMockInterface
+{
+    public:
+
+	MOCK_METHOD2 (getIntegratedOptionIndex, CCSIntegratedSetting * (const char *, const char *));
+	MOCK_METHOD3 (readOptionIntoSetting, Bool (CCSContext *, CCSSetting *, CCSIntegratedSetting *));
+	MOCK_METHOD3 (writeOptionFromSetting, void (CCSContext *, CCSSetting *, CCSIntegratedSetting *));
+	MOCK_METHOD2 (updateIntegratedSettings, void (CCSContext *, CCSIntegratedSettingList));
+	MOCK_METHOD0 (disallowIntegratedWrites, void ());
+	MOCK_METHOD0 (allowIntegratedWrites, void ());
+
+
+	CCSIntegrationGMock (CCSIntegration *integration) :
+	    mIntegration (integration)
+	{
+	}
+
+	CCSIntegration *
+	getIntegrationBackend ()
+	{
+	    return mIntegration;
+	}
+
+    public:
+
+	static CCSIntegratedSetting * ccsIntegrationGetIntegratedOptionIndex (CCSIntegration *integration,
+									      const char     *pluginName,
+									      const char     *settingName)
+	{
+	    return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->getIntegratedOptionIndex (pluginName, settingName);
+	}
+
+	static Bool ccsIntegrationReadOptionIntoSetting (CCSIntegration       *integration,
+							 CCSContext           *context,
+							 CCSSetting           *setting,
+							 CCSIntegratedSetting *integrated)
+	{
+	    return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->readOptionIntoSetting (context, setting, integrated);
+	}
+
+	static void ccsIntegrationWriteSettingIntoOption  (CCSIntegration      *integration,
+							   CCSContext		*context,
+							   CCSSetting		*setting,
+							   CCSIntegratedSetting *integrated)
+	{
+	    return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->writeOptionFromSetting (context, setting, integrated);
+	}
+
+	static void ccsIntegrationUpdateIntegratedSettings (CCSIntegration           *integration,
+							    CCSContext	             *context,
+							    CCSIntegratedSettingList settingList)
+	{
+	    return reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->updateIntegratedSettings (context, settingList);
+	}
+
+	static void ccsFreeIntegration (CCSIntegration *integration)
+	{
+	    ccsMockIntegrationBackendFree (integration);
+	}
+
+	static void ccsIntegrationDisallowIntegratedWrites (CCSIntegration *integration)
+	{
+	    reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->disallowIntegratedWrites ();
+	}
+
+	static void ccsIntegrationAllowIntegratedWrites (CCSIntegration *integration)
+	{
+	    reinterpret_cast <CCSIntegrationGMockInterface *> (ccsObjectGetPrivate (integration))->allowIntegratedWrites ();
+	}
+
+    private:
+
+	CCSIntegration *mIntegration;
+};
+
+extern const CCSIntegrationInterface mockIntegrationBackendInterface;
+
+#endif

=== added file 'compizconfig/tests/CMakeLists.txt'
--- compizconfig/tests/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -0,0 +1,71 @@
+include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../libcompizconfig/include
+                     ${CMAKE_CURRENT_SOURCE_DIR}/../mocks/libcompizconfig
+                     ${CMAKE_SOURCE_DIR}/tests/shared
+                     ${CMAKE_CURRENT_SOURCE_DIR})
+
+add_library (compizconfig_ccs_item_in_list_matcher STATIC
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_item_in_list_matcher.cpp)
+
+target_link_libraries (compizconfig_ccs_item_in_list_matcher
+		       ${GTEST_BOTH_LIBRARIES}
+		       ${GMOCK_MAIN_LIBRARY}
+		       ${GMOCK_LIBRARY}
+		       compizconfig)
+
+add_library (compizconfig_ccs_list_equality STATIC
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_list_equality.cpp)
+
+target_link_libraries (compizconfig_ccs_list_equality
+		       ${GTEST_BOTH_LIBRARIES}
+		       ${GMOCK_MAIN_LIBRARY}
+		       ${GMOCK_LIBRARY}
+		       compizconfig)
+
+add_library (compizconfig_ccs_setting_value_matcher STATIC
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_setting_value_matcher.cpp)
+
+target_link_libraries (compizconfig_ccs_setting_value_matcher
+		       ${GTEST_BOTH_LIBRARIES}
+		       ${GMOCK_MAIN_LIBRARY}
+		       ${GMOCK_LIBRARY}
+		       compizconfig)
+
+add_library (compizconfig_ccs_list_wrapper STATIC
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_list_wrapper.cpp)
+
+target_link_libraries (compizconfig_ccs_list_wrapper
+		       ${GTEST_BOTH_LIBRARIES}
+		       ${GMOCK_MAIN_LIBRARY}
+		       ${GMOCK_LIBRARY}
+		       compizconfig)
+
+add_library (compizconfig_ccs_setting_value_operators STATIC
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_ccs_setting_value_operators.cpp)
+
+target_link_libraries (compizconfig_ccs_setting_value_operators
+		       ${GTEST_BOTH_LIBRARIES}
+		       ${GMOCK_MAIN_LIBRARY}
+		       ${GMOCK_LIBRARY}
+		       compizconfig)
+
+add_library (compizconfig_ccs_test_value_combinations STATIC
+	     ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_test_value_combiners.cpp)
+
+target_link_libraries (compizconfig_ccs_test_value_combinations
+		       ${GTEST_BOTH_LIBRARIES}
+		       ${GMOCK_MAIN_LIBRARY}
+		       ${GMOCK_LIBRARY}
+		       compizconfig)
+
+add_library (compizconfig_ccs_backend_conformance_test STATIC
+             ${CMAKE_CURRENT_SOURCE_DIR}/compizconfig_backend_concept_test.cpp)
+
+target_link_libraries (compizconfig_ccs_backend_conformance_test
+                       ${GTEST_BOTH_LIBRARIES}
+                       ${GMOCK_MAIN_LIBRARY}
+                       ${GMOCK_LIBRARY}
+                       compizconfig
+                       compizconfig_ccs_test_value_combinations
+                       compizconfig_ccs_setting_value_operators
+                       compizconfig_ccs_list_equality
+                       compizconfig_ccs_item_in_list_matcher)

=== added file 'compizconfig/tests/compizconfig_backend_concept_test.cpp'
--- compizconfig/tests/compizconfig_backend_concept_test.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_backend_concept_test.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,381 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <gtest_unspecified_bool_type_matcher.h>
+
+#include <compizconfig_ccs_setting_mock.h>
+
+#include <boost/function.hpp>
+#include <boost/bind.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/make_shared.hpp>
+
+#include <compizconfig_backend_concept_test_internal.h>
+#include <compizconfig_backend_concept_test_environment_interface.h>
+
+using ::testing::NiceMock;
+using ::testing::Return;
+using ::testing::ReturnNull;
+using ::testing::SetArgPointee;
+using ::testing::DoAll;
+using ::testing::AtLeast;
+using ::testing::Eq;
+
+
+namespace cct = compizconfig::test;
+
+Bool cct::boolToBool (bool v)
+{
+    return v ? TRUE : FALSE;
+}
+
+cci::SettingValueListWrapper::Ptr
+cct::CCSListConstructionExpectationsSetter (const cct::ConstructorFunc &c,
+					    CCSSettingType             type,
+					    cci::ListStorageType       storageType)
+{
+    boost::function <void (CCSSetting *)> f (boost::bind (ccsSettingUnref, _1));
+    boost::shared_ptr <CCSSetting> mockSetting (ccsNiceMockSettingNew (), f);
+    NiceMock <CCSSettingGMock>     *gmockSetting = reinterpret_cast <NiceMock <CCSSettingGMock> *> (ccsObjectGetPrivate (mockSetting.get ()));
+
+    ON_CALL (*gmockSetting, getType ()).WillByDefault (Return (TypeList));
+
+    boost::shared_ptr <CCSSettingInfo> listInfo (new CCSSettingInfo);
+
+    listInfo->forList.listType = type;
+
+    ON_CALL (*gmockSetting, getInfo ()).WillByDefault (Return (listInfo.get ()));
+    ON_CALL (*gmockSetting, getDefaultValue ()).WillByDefault (ReturnNull ());
+    return boost::make_shared <cci::SettingValueListWrapper> (c (mockSetting.get ()), storageType, type, listInfo, mockSetting);
+}
+
+CCSSettingGMock *
+cct::getSettingGMockFromSetting (const boost::shared_ptr <CCSSetting> &setting)
+{
+    return reinterpret_cast <CCSSettingGMock *> (ccsObjectGetPrivate (setting.get ()));
+}
+
+void
+cct::SetIntWriteExpectation (const std::string                                    &plugin,
+			     const std::string                                    &key,
+			     const VariantTypes                                   &value,
+			     const boost::shared_ptr <CCSSetting>                 &setting,
+			     const WriteFunc                                      &write,
+			     const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
+{
+    CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
+    EXPECT_CALL (*gmock, getInt (_)).WillRepeatedly (DoAll (
+							 SetArgPointee <0> (
+							     boost::get <int> (value)),
+							 Return (TRUE)));
+    write ();
+    EXPECT_EQ (env->ReadIntegerAtKey (plugin, key), boost::get <int> (value));
+}
+
+void
+cct::SetBoolWriteExpectation (const std::string                                    &plugin,
+			      const std::string                                    &key,
+			      const VariantTypes                                   &value,
+			      const boost::shared_ptr <CCSSetting>                 &setting,
+			      const WriteFunc                                      &write,
+			      const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
+{
+    CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
+    EXPECT_CALL (*gmock, getBool (_)).WillRepeatedly (DoAll (
+							 SetArgPointee <0> (
+							     boolToBool (boost::get <bool> (value))),
+							 Return (TRUE)));
+    write ();
+
+    bool v (boost::get <bool> (value));
+
+    if (v)
+	EXPECT_THAT (env->ReadBoolAtKey (plugin, key), IsTrue ());
+    else
+	EXPECT_THAT (env->ReadBoolAtKey (plugin, key), IsFalse ());
+}
+
+void
+cct::SetFloatWriteExpectation (const std::string                                    &plugin,
+			       const std::string                                    &key,
+			       const VariantTypes                                   &value,
+			       const boost::shared_ptr <CCSSetting>                 &setting,
+			       const WriteFunc                                      &write,
+			       const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
+{
+    CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
+    EXPECT_CALL (*gmock, getFloat (_)).WillRepeatedly (DoAll (
+							 SetArgPointee <0> (
+							     boost::get <float> (value)),
+							 Return (TRUE)));
+    write ();
+    EXPECT_EQ (env->ReadFloatAtKey (plugin, key), boost::get <float> (value));
+}
+
+void
+cct::SetStringWriteExpectation (const std::string                                    &plugin,
+				const std::string                                    &key,
+				const VariantTypes                                   &value,
+				const boost::shared_ptr <CCSSetting>                 &setting,
+				const WriteFunc                                      &write,
+				const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
+{
+    CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
+    EXPECT_CALL (*gmock, getString (_)).WillRepeatedly (DoAll (
+							 SetArgPointee <0> (
+							     const_cast <char *> (boost::get <const char *> (value))),
+							 Return (TRUE)));
+    write ();
+    EXPECT_EQ (std::string (env->ReadStringAtKey (plugin, key)), std::string (boost::get <const char *> (value)));
+}
+
+void
+cct::SetColorWriteExpectation (const std::string                                    &plugin,
+			       const std::string                                    &key,
+			       const VariantTypes                                   &value,
+			       const boost::shared_ptr <CCSSetting>                 &setting,
+			       const WriteFunc                                      &write,
+			       const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
+{
+    CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
+    EXPECT_CALL (*gmock, getColor (_)).WillRepeatedly (DoAll (
+							 SetArgPointee <0> (
+							     boost::get <CCSSettingColorValue> (value)),
+							 Return (TRUE)));
+    write ();
+
+    EXPECT_EQ (env->ReadColorAtKey (plugin, key), boost::get <CCSSettingColorValue> (value));
+}
+
+void
+cct::SetKeyWriteExpectation (const std::string                                    &plugin,
+			     const std::string                                    &key,
+			     const VariantTypes                                   &value,
+			     const boost::shared_ptr <CCSSetting>                 &setting,
+			     const WriteFunc                                      &write,
+			     const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
+{
+    CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
+    EXPECT_CALL (*gmock, getKey (_)).WillRepeatedly (DoAll (
+							 SetArgPointee <0> (
+							     boost::get <CCSSettingKeyValue> (value)),
+							 Return (TRUE)));
+    write ();
+    EXPECT_EQ (env->ReadKeyAtKey (plugin, key), boost::get <CCSSettingKeyValue> (value));
+}
+
+void
+cct::SetButtonWriteExpectation (const std::string                                    &plugin,
+				const std::string                                    &key,
+				const VariantTypes                                   &value,
+				const boost::shared_ptr <CCSSetting>                 &setting,
+				const WriteFunc                                      &write,
+				const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
+{
+    CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
+    EXPECT_CALL (*gmock, getButton (_)).WillRepeatedly (DoAll (
+							 SetArgPointee <0> (
+							     boost::get <CCSSettingButtonValue> (value)),
+							 Return (TRUE)));
+    write ();
+    EXPECT_EQ (env->ReadButtonAtKey (plugin, key), boost::get <CCSSettingButtonValue> (value));
+}
+
+void
+cct::SetEdgeWriteExpectation (const std::string                                    &plugin,
+			      const std::string                                    &key,
+			      const VariantTypes                                   &value,
+			      const boost::shared_ptr <CCSSetting>                 &setting,
+			      const WriteFunc                                      &write,
+			      const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
+{
+    CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
+    EXPECT_CALL (*gmock, getEdge (_)).WillRepeatedly (DoAll (
+							 SetArgPointee <0> (
+							     boost::get <unsigned int> (value)),
+							 Return (TRUE)));
+    write ();
+    EXPECT_EQ (env->ReadEdgeAtKey (plugin, key), boost::get <unsigned int> (value));
+}
+
+void
+cct::SetBellWriteExpectation (const std::string                                    &plugin,
+			      const std::string                                    &key,
+			      const VariantTypes                                   &value,
+			      const boost::shared_ptr <CCSSetting>                 &setting,
+			      const WriteFunc                                      &write,
+			      const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
+{
+    CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
+    EXPECT_CALL (*gmock, getBell (_)).WillRepeatedly (DoAll (
+							 SetArgPointee <0> (
+							     boolToBool (boost::get <bool> (value))),
+							 Return (TRUE)));
+    write ();
+    bool v (boost::get <bool> (value));
+
+    if (v)
+	EXPECT_THAT (env->ReadBellAtKey (plugin, key), IsTrue ());
+    else
+	EXPECT_THAT (env->ReadBellAtKey (plugin, key), IsFalse ());
+}
+
+void
+cct::SetMatchWriteExpectation (const std::string                                    &plugin,
+			       const std::string                                    &key,
+			       const VariantTypes                                   &value,
+			       const boost::shared_ptr <CCSSetting>                 &setting,
+			       const WriteFunc                                      &write,
+			       const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
+{
+    CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
+    EXPECT_CALL (*gmock, getMatch (_)).WillRepeatedly (DoAll (
+							 SetArgPointee <0> (
+							     const_cast <char *> (
+								   boost::get <const char *> (
+								       value))),
+							 Return (TRUE)));
+    write ();
+    EXPECT_EQ (std::string (env->ReadMatchAtKey (plugin, key)),
+	       std::string (boost::get <const char *> (value)));
+}
+
+void
+cct::SetListWriteExpectation (const std::string                                    &plugin,
+			      const std::string                                    &key,
+			      const VariantTypes                                   &value,
+			      const boost::shared_ptr <CCSSetting>                 &setting,
+			      const WriteFunc                                      &write,
+			      const CCSBackendConceptTestEnvironmentInterface::Ptr &env)
+{
+    CCSSettingGMock *gmock (getSettingGMockFromSetting (setting));
+    CCSSettingValueList list = *(boost::get <boost::shared_ptr <cci::SettingValueListWrapper> > (value));
+
+    EXPECT_CALL (*gmock, getInfo ());
+
+    CCSSettingInfo      *info = ccsSettingGetInfo (setting.get ());
+    info->forList.listType =
+	    (boost::get <boost::shared_ptr <cci::SettingValueListWrapper> > (value))->type ();
+
+    EXPECT_CALL (*gmock, getInfo ()).Times (AtLeast (1));
+    EXPECT_CALL (*gmock, getList (_)).WillRepeatedly (DoAll (
+							 SetArgPointee <0> (
+							     list),
+							 Return (TRUE)));
+    write ();
+
+    EXPECT_THAT (cci::SettingValueListWrapper (env->ReadListAtKey (plugin, key, setting.get ()),
+						  cci::Deep,
+						  info->forList.listType,
+						  boost::shared_ptr <CCSSettingInfo> (),
+						  setting),
+		 ListEqual (&info->forList, list));
+}
+
+void
+cct::SetIntReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
+{
+    EXPECT_CALL (*gmock, setInt (boost::get <int> (value), _));
+}
+
+void
+cct::SetBoolReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
+{
+    bool v (boost::get <bool> (value));
+
+    if (v)
+	EXPECT_CALL (*gmock, setBool (IsTrue (), _));
+    else
+	EXPECT_CALL (*gmock, setBool (IsFalse (), _));
+}
+
+void
+cct::SetBellReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
+{
+    bool v (boost::get <bool> (value));
+
+    if (v)
+	EXPECT_CALL (*gmock, setBell (IsTrue (), _));
+    else
+	EXPECT_CALL (*gmock, setBell (IsFalse (), _));
+}
+
+void
+cct::SetFloatReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
+{
+    EXPECT_CALL (*gmock, setFloat (boost::get <float> (value), _));
+}
+
+void
+cct::SetStringReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
+{
+    EXPECT_CALL (*gmock, setString (Eq (std::string (boost::get <const char *> (value))), _));
+}
+
+void
+cct::SetMatchReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
+{
+    EXPECT_CALL (*gmock, setMatch (Eq (std::string (boost::get <const char *> (value))), _));
+}
+
+void
+cct::SetColorReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
+{
+    EXPECT_CALL (*gmock, setColor (boost::get <CCSSettingColorValue> (value), _));
+}
+
+void
+cct::SetKeyReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
+{
+    EXPECT_CALL (*gmock, setKey (boost::get <CCSSettingKeyValue> (value), _));
+}
+
+void
+cct::SetButtonReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
+{
+    EXPECT_CALL (*gmock, setButton (boost::get <CCSSettingButtonValue> (value), _));
+}
+
+void
+cct::SetEdgeReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
+{
+    EXPECT_CALL (*gmock, setEdge (boost::get <unsigned int> (value), _));
+}
+
+void
+cct::SetListReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
+{
+    static CCSSettingInfo globalListInfo;
+
+    globalListInfo.forList.listType =
+	    (boost::get <boost::shared_ptr <cci::SettingValueListWrapper> > (value))->type ();
+    globalListInfo.forList.listInfo = NULL;
+
+    ON_CALL (*gmock, getInfo ()).WillByDefault (Return (&globalListInfo));
+    EXPECT_CALL (*gmock, setList (
+			    ListEqual (
+				&globalListInfo.forList,
+				*(boost::get <boost::shared_ptr <cci::SettingValueListWrapper> > (value))), _));
+}

=== modified file 'compizconfig/tests/compizconfig_backend_concept_test.h'
--- compizconfig/tests/compizconfig_backend_concept_test.h	2012-09-18 23:56:02 +0000
+++ compizconfig/tests/compizconfig_backend_concept_test.h	2012-09-25 08:42:23 +0000
@@ -45,11 +45,135 @@
 #include <compizconfig_ccs_context_mock.h>
 
 #include "gtest_shared_characterwrapper.h"
+#include "gtest_unspecified_bool_type_matcher.h"
 #include "compizconfig_test_value_combiners.h"
 #include "compizconfig_ccs_setting_value_operators.h"
 #include "compizconfig_ccs_item_in_list_matcher.h"
 #include "compizconfig_ccs_list_equality.h"
 #include "compizconfig_ccs_list_wrapper.h"
+#include "compizconfig_ccs_variant_types.h"
+#include "compizconfig_backend_concept_test_internal.h"
+#include "compizconfig_backend_concept_test_environment_interface.h"
+
+namespace cci = compiz::config::impl;
+namespace cc  = compiz::config;
+
+class CCSBackendConceptTestEnvironmentFactoryInterface
+{
+    public:
+
+	typedef boost::shared_ptr <CCSBackendConceptTestEnvironmentFactoryInterface> Ptr;
+
+	virtual ~CCSBackendConceptTestEnvironmentFactoryInterface () {}
+
+	virtual CCSBackendConceptTestEnvironmentInterface::Ptr ConstructTestEnv () = 0;
+};
+
+template <typename I>
+class CCSBackendConceptTestEnvironmentFactory :
+    public CCSBackendConceptTestEnvironmentFactoryInterface
+{
+    public:
+
+	CCSBackendConceptTestEnvironmentInterface::Ptr
+	ConstructTestEnv ()
+	{
+	    return boost::shared_static_cast <I> (boost::make_shared <I> ());
+	}
+};
+
+namespace compizconfig
+{
+    namespace test
+    {
+	typedef boost::function <void ()> WriteFunc;
+	typedef boost::function <CCSSettingValueList (CCSSetting *)> ConstructorFunc;
+
+	cci::SettingValueListWrapper::Ptr
+	CCSListConstructionExpectationsSetter (const ConstructorFunc &c,
+					       CCSSettingType        type,
+					       cci::ListStorageType  storageType);
+
+	CCSSettingGMock * getSettingGMockFromSetting (const boost::shared_ptr <CCSSetting> &setting);
+	void SetIntWriteExpectation (const std::string                                    &plugin,
+				     const std::string                                    &key,
+				     const VariantTypes                                   &value,
+				     const boost::shared_ptr <CCSSetting>                 &setting,
+				     const WriteFunc                                      &write,
+				     const CCSBackendConceptTestEnvironmentInterface::Ptr &env);
+	void SetBoolWriteExpectation (const std::string                                    &plugin,
+				      const std::string                                    &key,
+				      const VariantTypes                                   &value,
+				      const boost::shared_ptr <CCSSetting>                 &setting,
+				      const WriteFunc                                      &write,
+				      const CCSBackendConceptTestEnvironmentInterface::Ptr &env);
+	void SetFloatWriteExpectation (const std::string                                    &plugin,
+				       const std::string                                    &key,
+				       const VariantTypes                                   &value,
+				       const boost::shared_ptr <CCSSetting>                 &setting,
+				       const WriteFunc                                      &write,
+				       const CCSBackendConceptTestEnvironmentInterface::Ptr &env);
+	void SetStringWriteExpectation (const std::string                                    &plugin,
+					const std::string                                    &key,
+					const VariantTypes                                   &value,
+					const boost::shared_ptr <CCSSetting>                 &setting,
+					const WriteFunc                                      &write,
+					const CCSBackendConceptTestEnvironmentInterface::Ptr &env);
+	void SetColorWriteExpectation (const std::string                                    &plugin,
+				       const std::string                                    &key,
+				       const VariantTypes                                   &value,
+				       const boost::shared_ptr <CCSSetting>                 &setting,
+				       const WriteFunc                                      &write,
+				       const CCSBackendConceptTestEnvironmentInterface::Ptr &env);
+	void SetKeyWriteExpectation (const std::string                                    &plugin,
+				     const std::string                                    &key,
+				     const VariantTypes                                   &value,
+				     const boost::shared_ptr <CCSSetting>                 &setting,
+				     const WriteFunc                                      &write,
+				     const CCSBackendConceptTestEnvironmentInterface::Ptr &env);
+	void SetButtonWriteExpectation (const std::string                                    &plugin,
+					const std::string                                    &key,
+					const VariantTypes                                   &value,
+					const boost::shared_ptr <CCSSetting>                 &setting,
+					const WriteFunc                                      &write,
+					const CCSBackendConceptTestEnvironmentInterface::Ptr &env);
+	void SetEdgeWriteExpectation (const std::string                                    &plugin,
+				      const std::string                                    &key,
+				      const VariantTypes                                   &value,
+				      const boost::shared_ptr <CCSSetting>                 &setting,
+				      const WriteFunc                                      &write,
+				      const CCSBackendConceptTestEnvironmentInterface::Ptr &env);
+	void SetBellWriteExpectation (const std::string                                    &plugin,
+				      const std::string                                    &key,
+				      const VariantTypes                                   &value,
+				      const boost::shared_ptr <CCSSetting>                 &setting,
+				      const WriteFunc                                      &write,
+				      const CCSBackendConceptTestEnvironmentInterface::Ptr &env);
+	void SetMatchWriteExpectation (const std::string                                    &plugin,
+				       const std::string                                    &key,
+				       const VariantTypes                                   &value,
+				       const boost::shared_ptr <CCSSetting>                 &setting,
+				       const WriteFunc                                      &write,
+				       const CCSBackendConceptTestEnvironmentInterface::Ptr &env);
+	void SetListWriteExpectation (const std::string                                    &plugin,
+				      const std::string                                    &key,
+				      const VariantTypes                                   &value,
+				      const boost::shared_ptr <CCSSetting>                 &setting,
+				      const WriteFunc                                      &write,
+				      const CCSBackendConceptTestEnvironmentInterface::Ptr &env);
+	void SetIntReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetBoolReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetBellReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetFloatReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetStringReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetMatchReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetColorReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetKeyReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetButtonReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetEdgeReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetListReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+    }
+}
 
 using ::testing::Eq;
 using ::testing::IsNull;
@@ -64,9 +188,6 @@
 using ::testing::AtLeast;
 using ::testing::NiceMock;
 
-MATCHER(IsTrue, "Is True") { if (arg) return true; else return false; }
-MATCHER(IsFalse, "Is False") { if (!arg) return true; else return false; }
-
 namespace
 {
     bool ccsStringCmp (const CCSString &a, const CCSString &b)
@@ -88,160 +209,6 @@
 			unsigned int,
 			cci::SettingValueListWrapper::Ptr> VariantTypes;
 
-class CCSSettingsConceptTestEnvironmentInterface
-{
-    public:
-
-	virtual void SetUp () = 0;
-	virtual void TearDown () = 0;
-
-	virtual void WriteBoolAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value) = 0;
-	virtual void WriteIntegerAtKey (const std::string &plugin,
-					const std::string &key,
-					const VariantTypes &value) = 0;
-	virtual void WriteFloatAtKey (const std::string &plugin,
-				      const std::string &key,
-				      const VariantTypes &value) = 0;
-	virtual void WriteStringAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value) = 0;
-	virtual void WriteColorAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value) = 0;
-	virtual void WriteKeyAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value) = 0;
-	virtual void WriteButtonAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value) = 0;
-	virtual void WriteEdgeAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value) = 0;
-	virtual void WriteMatchAtKey (const std::string &plugin,
-				      const std::string &key,
-				      const VariantTypes &value) = 0;
-	virtual void WriteBellAtKey (const std::string &plugin,
-				       const std::string &key,
-				       const VariantTypes &value) = 0;
-	virtual void WriteListAtKey (const std::string &plugin,
-				     const std::string &key,
-				     const VariantTypes &value) = 0;
-
-	virtual Bool ReadBoolAtKey (const std::string &plugin,
-				       const std::string &key) = 0;
-	virtual int ReadIntegerAtKey (const std::string &plugin,
-					const std::string &key) = 0;
-	virtual float ReadFloatAtKey (const std::string &plugin,
-				      const std::string &key) = 0;
-	virtual const char * ReadStringAtKey (const std::string &plugin,
-				       const std::string &key) = 0;
-	virtual CCSSettingColorValue ReadColorAtKey (const std::string &plugin,
-				       const std::string &key) = 0;
-	virtual CCSSettingKeyValue ReadKeyAtKey (const std::string &plugin,
-				       const std::string &key) = 0;
-	virtual CCSSettingButtonValue ReadButtonAtKey (const std::string &plugin,
-				       const std::string &key) = 0;
-	virtual unsigned int ReadEdgeAtKey (const std::string &plugin,
-				       const std::string &key) = 0;
-	virtual const char * ReadMatchAtKey (const std::string &plugin,
-				      const std::string &key) = 0;
-	virtual Bool ReadBellAtKey (const std::string &plugin,
-				       const std::string &key) = 0;
-	virtual CCSSettingValueList ReadListAtKey (const std::string &plugin,
-						    const std::string &key,
-						    CCSSetting *setting) = 0;
-};
-
-class CCSBackendConceptTestEnvironmentInterface :
-    public CCSSettingsConceptTestEnvironmentInterface
-{
-    public:
-
-	typedef boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> Ptr;
-
-	virtual ~CCSBackendConceptTestEnvironmentInterface () {};
-	virtual CCSBackend * SetUp (CCSContext *context,
-				    CCSContextGMock *gmockContext) = 0;
-	virtual void TearDown (CCSBackend *) = 0;
-
-	virtual void AddProfile (const std::string &profile) = 0;
-	virtual void SetGetExistingProfilesExpectation (CCSContext *,
-							CCSContextGMock *) = 0;
-	virtual void SetDeleteProfileExpectation (const std::string &,
-						  CCSContext	    *,
-						  CCSContextGMock   *) = 0;
-
-	virtual void SetReadInitExpectation (CCSContext      *,
-					     CCSContextGMock *) = 0;
-
-	virtual void SetReadDoneExpectation (CCSContext      *,
-					     CCSContextGMock *) = 0;
-
-	virtual void SetWriteInitExpectation (CCSContext      *,
-					      CCSContextGMock *) = 0;
-
-	virtual void SetWriteDoneExpectation (CCSContext      *,
-					      CCSContextGMock *) = 0;
-
-	virtual const CCSBackendInfo * GetInfo () = 0;
-
-	virtual void PreWrite (CCSContextGMock *,
-			       CCSPluginGMock  *,
-			       CCSSettingGMock *,
-			       CCSSettingType) = 0;
-	virtual void PostWrite (CCSContextGMock *,
-				CCSPluginGMock  *,
-				CCSSettingGMock *,
-				CCSSettingType) = 0;
-
-	virtual void PreRead (CCSContextGMock *,
-			      CCSPluginGMock  *,
-			      CCSSettingGMock *,
-			      CCSSettingType) = 0;
-	virtual void PostRead (CCSContextGMock *,
-			       CCSPluginGMock  *,
-			       CCSSettingGMock *,
-			       CCSSettingType) = 0;
-
-	virtual void PreUpdate (CCSContextGMock *,
-			      CCSPluginGMock  *,
-			      CCSSettingGMock *,
-			      CCSSettingType) = 0;
-	virtual void PostUpdate (CCSContextGMock *,
-			       CCSPluginGMock  *,
-			       CCSSettingGMock *,
-			       CCSSettingType) = 0;
-
-	virtual bool UpdateSettingAtKey (const std::string &plugin,
-					 const std::string &setting) = 0;
-};
-
-class CCSBackendConceptTestEnvironmentFactoryInterface
-{
-    public:
-
-	typedef boost::shared_ptr <CCSBackendConceptTestEnvironmentFactoryInterface> Ptr;
-
-	virtual ~CCSBackendConceptTestEnvironmentFactoryInterface () {}
-
-	virtual CCSBackendConceptTestEnvironmentInterface::Ptr ConstructTestEnv () = 0;
-};
-
-template <typename I>
-class CCSBackendConceptTestEnvironmentFactory :
-    public CCSBackendConceptTestEnvironmentFactoryInterface
-{
-    public:
-
-	CCSBackendConceptTestEnvironmentInterface::Ptr
-	ConstructTestEnv ()
-	{
-	    return boost::shared_static_cast <I> (boost::make_shared <I> ());
-	}
-};
-
 namespace
 {
 
@@ -447,11 +414,11 @@
     write ();
 
     EXPECT_THAT (cci::SettingValueListWrapper (env->ReadListAtKey (plugin, key, setting.get ()),
-						  cci::Deep,
-						  info->forList.listType,
-						  boost::shared_ptr <CCSSettingInfo> (),
-						  setting),
-		 ListEqual (info->forList, list));
+								   cci::Deep,
+								   info->forList.listType,
+								   boost::shared_ptr <CCSSettingInfo> (),
+								   setting),
+		 ListEqual (&info->forList, list));
 }
 
 void SetIntReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value)
@@ -522,7 +489,10 @@
     globalListInfo.forList.listInfo = NULL;
 
     ON_CALL (*gmock, getInfo ()).WillByDefault (Return (&globalListInfo));
-    EXPECT_CALL (*gmock, setList (ListEqual (globalListInfo.forList, *(boost::get <boost::shared_ptr <cci::SettingValueListWrapper> > (value))), _));
+    EXPECT_CALL (*gmock, setList (
+			    ListEqual (
+				&globalListInfo.forList,
+				*(boost::get <boost::shared_ptr <cci::SettingValueListWrapper> > (value))), _));
 }
 
 }
@@ -539,21 +509,21 @@
 
 	typedef boost::function <void (CCSSettingGMock *,
 				       const VariantTypes &)> SetReadExpectation;
-	typedef boost::function <void (const std::string &,
-				       const std::string &,
-				       const VariantTypes &,
-				       const boost::shared_ptr <CCSSetting> &,
-				       const WriteFunc &,
-				       const CCSBackendConceptTestEnvironmentInterface::Ptr & )> SetWriteExpectation;
+	typedef boost::function <void (const std::string                                    &,
+				       const std::string                                    &,
+				       const VariantTypes                                   &,
+				       const boost::shared_ptr <CCSSetting>                 &,
+				       const compizconfig::test::WriteFunc                  &,
+				       const CCSBackendConceptTestEnvironmentInterface::Ptr &)> SetWriteExpectation;
 
 	virtual void TearDown (CCSBackend *) = 0;
 
 	virtual CCSBackendConceptTestEnvironmentInterface::Ptr testEnv () = 0;
 	virtual VariantTypes & value () = 0;
-	virtual void nativeWrite (const CCSBackendConceptTestEnvironmentInterface::Ptr &  iface,
-				  const std::string &plugin,
-				  const std::string &keyname,
-				  const VariantTypes &value) = 0;
+	virtual void nativeWrite (const CCSBackendConceptTestEnvironmentInterface::Ptr &iface,
+				  const std::string                                    &plugin,
+				  const std::string                                    &keyname,
+				  const VariantTypes                                   &value) = 0;
 	virtual CCSSettingType & type () = 0;
 	virtual std::string & keyname () = 0;
 	virtual SetWriteExpectation & setWriteExpectationAndWrite () = 0;
@@ -777,22 +747,7 @@
 cci::SettingValueListWrapper::Ptr
 CCSListConstructionExpectationsSetter (const ConstructorFunc &c,
 				       CCSSettingType        type,
-				       cci::ListStorageType  storageType)
-{
-    boost::function <void (CCSSetting *)> f (boost::bind (ccsSettingUnref, _1));
-    boost::shared_ptr <CCSSetting> mockSetting (ccsNiceMockSettingNew (), f);
-    NiceMock <CCSSettingGMock>     *gmockSetting = reinterpret_cast <NiceMock <CCSSettingGMock> *> (ccsObjectGetPrivate (mockSetting.get ()));
-
-    ON_CALL (*gmockSetting, getType ()).WillByDefault (Return (TypeList));
-
-    boost::shared_ptr <CCSSettingInfo> listInfo (new CCSSettingInfo);
-
-    listInfo->forList.listType = type;
-
-    ON_CALL (*gmockSetting, getInfo ()).WillByDefault (Return (listInfo.get ()));
-    ON_CALL (*gmockSetting, getDefaultValue ()).WillByDefault (ReturnNull ());
-    return boost::make_shared <cci::SettingValueListWrapper> (c (mockSetting.get ()), storageType, type, listInfo, mockSetting);
-}
+				       cci::ListStorageType  storageType);
 
 template <typename I>
 ::testing::internal::ParamGenerator<typename CCSBackendConceptTestParamInterface::Ptr>

=== added file 'compizconfig/tests/compizconfig_backend_concept_test_environment_interface.h'
--- compizconfig/tests/compizconfig_backend_concept_test_environment_interface.h	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_backend_concept_test_environment_interface.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,101 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_CCS_BACKEND_CONCEPT_TEST_ENVIRONMENT_INTERFACE_H
+#define _COMPIZCONFIG_CCS_BACKEND_CONCEPT_TEST_ENVIRONMENT_INTERFACE_H
+
+#include <string>
+#include <boost/shared_ptr.hpp>
+#include "compizconfig_ccs_settings_test_fixture.h"
+
+typedef struct _CCSContext CCSContext;
+typedef struct _CCSBackendInfo CCSBackendInfo;
+
+class CCSContextGMock;
+class CCSPluginGMock;
+class CCSSettingGMock;
+
+class CCSBackendConceptTestEnvironmentInterface :
+    public CCSSettingsConceptTestEnvironmentInterface
+{
+    public:
+
+	typedef boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> Ptr;
+
+	virtual ~CCSBackendConceptTestEnvironmentInterface () {};
+	virtual CCSBackend * SetUp (CCSContext *context,
+				    CCSContextGMock *gmockContext) = 0;
+	virtual void TearDown (CCSBackend *) = 0;
+
+	virtual void AddProfile (const std::string &profile) = 0;
+	virtual void SetGetExistingProfilesExpectation (CCSContext *,
+							CCSContextGMock *) = 0;
+	virtual void SetDeleteProfileExpectation (const std::string &,
+						  CCSContext	    *,
+						  CCSContextGMock   *) = 0;
+
+	virtual void SetReadInitExpectation (CCSContext      *,
+					     CCSContextGMock *) = 0;
+
+	virtual void SetReadDoneExpectation (CCSContext      *,
+					     CCSContextGMock *) = 0;
+
+	virtual void SetWriteInitExpectation (CCSContext      *,
+					      CCSContextGMock *) = 0;
+
+	virtual void SetWriteDoneExpectation (CCSContext      *,
+					      CCSContextGMock *) = 0;
+
+	virtual const CCSBackendInfo * GetInfo () = 0;
+
+	virtual void PreWrite (CCSContextGMock *,
+			       CCSPluginGMock  *,
+			       CCSSettingGMock *,
+			       CCSSettingType) = 0;
+	virtual void PostWrite (CCSContextGMock *,
+				CCSPluginGMock  *,
+				CCSSettingGMock *,
+				CCSSettingType) = 0;
+
+	virtual void PreRead (CCSContextGMock *,
+			      CCSPluginGMock  *,
+			      CCSSettingGMock *,
+			      CCSSettingType) = 0;
+	virtual void PostRead (CCSContextGMock *,
+			       CCSPluginGMock  *,
+			       CCSSettingGMock *,
+			       CCSSettingType) = 0;
+
+	virtual void PreUpdate (CCSContextGMock *,
+			      CCSPluginGMock  *,
+			      CCSSettingGMock *,
+			      CCSSettingType) = 0;
+	virtual void PostUpdate (CCSContextGMock *,
+			       CCSPluginGMock  *,
+			       CCSSettingGMock *,
+			       CCSSettingType) = 0;
+
+	virtual bool UpdateSettingAtKey (const std::string &plugin,
+					 const std::string &setting) = 0;
+};
+
+#endif

=== added file 'compizconfig/tests/compizconfig_backend_concept_test_internal.h'
--- compizconfig/tests/compizconfig_backend_concept_test_internal.h	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_backend_concept_test_internal.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,146 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_CCS_BACKEND_CONCEPT_TEST_INTERNAL_H
+#define _COMPIZCONFIG_CCS_BACKEND_CONCEPT_TEST_INTERNAL_H
+
+#include <list>
+
+#include <boost/variant.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/noncopyable.hpp>
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include <ccs.h>
+
+#include "gtest_shared_characterwrapper.h"
+#include "compizconfig_test_value_combiners.h"
+#include "compizconfig_ccs_setting_value_operators.h"
+#include "compizconfig_ccs_item_in_list_matcher.h"
+#include "compizconfig_ccs_list_equality.h"
+#include "compizconfig_ccs_list_wrapper.h"
+#include "compizconfig_ccs_variant_types.h"
+#include "compizconfig_ccs_settings_test_fixture.h"
+
+namespace cci = compiz::config::impl;
+namespace cc  = compiz::config;
+
+class CCSBackendConceptTestEnvironmentInterface;
+class CCSSettingGMock;
+
+namespace compizconfig
+{
+    namespace test
+    {
+	typedef boost::function <void ()> WriteFunc;
+	typedef boost::function <CCSSettingValueList (CCSSetting *)> ConstructorFunc;
+
+	cci::SettingValueListWrapper::Ptr
+	CCSListConstructionExpectationsSetter (const ConstructorFunc &c,
+					       CCSSettingType        type,
+					       cci::ListStorageType  storageType);
+
+	Bool boolToBool (bool v);
+	CCSSettingGMock * getSettingGMockFromSetting (const boost::shared_ptr <CCSSetting> &setting);
+	void SetIntWriteExpectation (const std::string                                                   &plugin,
+				     const std::string                                                   &key,
+				     const VariantTypes                                                  &value,
+				     const boost::shared_ptr <CCSSetting>                                &setting,
+				     const WriteFunc                                                     &write,
+				     const boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> &env);
+	void SetBoolWriteExpectation (const std::string                                                   &plugin,
+				      const std::string                                                   &key,
+				      const VariantTypes                                                  &value,
+				      const boost::shared_ptr <CCSSetting>                                &setting,
+				      const WriteFunc                                                     &write,
+				      const boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> &env);
+	void SetFloatWriteExpectation (const std::string                                                   &plugin,
+				       const std::string                                                   &key,
+				       const VariantTypes                                                  &value,
+				       const boost::shared_ptr <CCSSetting>                                &setting,
+				       const WriteFunc                                                     &write,
+				       const boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> &env);
+	void SetStringWriteExpectation (const std::string                                                   &plugin,
+					const std::string                                                   &key,
+					const VariantTypes                                                  &value,
+					const boost::shared_ptr <CCSSetting>                                &setting,
+					const WriteFunc                                                     &write,
+					const boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> &env);
+	void SetColorWriteExpectation (const std::string                                                   &plugin,
+				       const std::string                                                   &key,
+				       const VariantTypes                                                  &value,
+				       const boost::shared_ptr <CCSSetting>                                &setting,
+				       const WriteFunc                                                     &write,
+				       const boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> &env);
+	void SetKeyWriteExpectation (const std::string                                                   &plugin,
+				     const std::string                                                   &key,
+				     const VariantTypes                                                  &value,
+				     const boost::shared_ptr <CCSSetting>                                &setting,
+				     const WriteFunc                                                     &write,
+				     const boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> &env);
+	void SetButtonWriteExpectation (const std::string                                                   &plugin,
+					const std::string                                                   &key,
+					const VariantTypes                                                  &value,
+					const boost::shared_ptr <CCSSetting>                                &setting,
+					const WriteFunc                                                     &write,
+					const boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> &env);
+	void SetEdgeWriteExpectation (const std::string                                                   &plugin,
+				      const std::string                                                   &key,
+				      const VariantTypes                                                  &value,
+				      const boost::shared_ptr <CCSSetting>                                &setting,
+				      const WriteFunc                                                     &write,
+				      const boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> &env);
+	void SetBellWriteExpectation (const std::string                                                   &plugin,
+				      const std::string                                                   &key,
+				      const VariantTypes                                                  &value,
+				      const boost::shared_ptr <CCSSetting>                                &setting,
+				      const WriteFunc                                                     &write,
+				      const boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> &env);
+	void SetMatchWriteExpectation (const std::string                                                   &plugin,
+				       const std::string                                                   &key,
+				       const VariantTypes                                                  &value,
+				       const boost::shared_ptr <CCSSetting>                                &setting,
+				       const WriteFunc                                                     &write,
+				       const boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> &env);
+	void SetListWriteExpectation (const std::string                                                   &plugin,
+				      const std::string                                                   &key,
+				      const VariantTypes                                                  &value,
+				      const boost::shared_ptr <CCSSetting>                                &setting,
+				      const WriteFunc                                                     &write,
+				      const boost::shared_ptr <CCSBackendConceptTestEnvironmentInterface> &env);
+	void SetIntReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetBoolReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetBellReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetFloatReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetStringReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetMatchReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetColorReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetKeyReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetButtonReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetEdgeReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+	void SetListReadExpectation (CCSSettingGMock *gmock, const VariantTypes &value);
+    }
+}
+
+#endif
+

=== added file 'compizconfig/tests/compizconfig_ccs_item_in_list_matcher.cpp'
--- compizconfig/tests/compizconfig_ccs_item_in_list_matcher.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_ccs_item_in_list_matcher.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,36 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+
+#include <compizconfig_ccs_item_in_list_matcher.h>
+
+Matcher <CCSStringList>
+IsStringItemInStringCCSList (const Matcher <CCSString> &matcher)
+{
+    return IsItemInCCSList <CCSString, CCSStringList> (matcher);
+}
+
+Matcher <CCSSettingValueList>
+IsSettingValueInSettingValueCCSList (const Matcher <CCSSettingValue> &matcher)
+{
+    return IsItemInCCSList <CCSSettingValue, CCSSettingValueList> (matcher);
+}

=== modified file 'compizconfig/tests/compizconfig_ccs_item_in_list_matcher.h'
--- compizconfig/tests/compizconfig_ccs_item_in_list_matcher.h	2012-09-10 01:26:26 +0000
+++ compizconfig/tests/compizconfig_ccs_item_in_list_matcher.h	2012-09-25 08:42:23 +0000
@@ -23,6 +23,10 @@
 #ifndef _COMPIZCONFIG_CCS_ITEM_IN_LIST_MATCHER_H
 #define _COMPIZCONFIG_CCS_ITEM_IN_LIST_MATCHER_H
 
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include <ccs.h>
+
 using ::testing::Matcher;
 using ::testing::MatcherInterface;
 using ::testing::MatchResultListener;
@@ -88,19 +92,10 @@
 
 /* A workaround for templates inside of macros not
  * expanding correctly */
-namespace
-{
-    Matcher <CCSStringList>
-    IsStringItemInStringCCSList (const Matcher <CCSString> &matcher)
-    {
-	return IsItemInCCSList <CCSString, CCSStringList> (matcher);
-    }
+Matcher <CCSStringList>
+IsStringItemInStringCCSList (const Matcher <CCSString> &matcher);
 
-    Matcher <CCSSettingValueList>
-    IsSettingValueInSettingValueCCSList (const Matcher <CCSSettingValue> &matcher)
-    {
-	return IsItemInCCSList <CCSSettingValue, CCSSettingValueList> (matcher);
-    }
-}
+Matcher <CCSSettingValueList>
+IsSettingValueInSettingValueCCSList (const Matcher <CCSSettingValue> &matcher);
 
 #endif

=== added file 'compizconfig/tests/compizconfig_ccs_list_equality.cpp'
--- compizconfig/tests/compizconfig_ccs_list_equality.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_ccs_list_equality.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,74 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#include <gtest/gtest.h>
+#include <ccs.h>
+#include <compizconfig_ccs_list_equality.h>
+
+using ::testing::MakeMatcher;
+
+class PrivateListEqualityMatcher
+{
+    public:
+
+	PrivateListEqualityMatcher (CCSSettingListInfo *info,
+				    CCSSettingValueList cmp) :
+	    mInfo (info),
+	    mCmp (cmp)
+	{
+	}
+
+	CCSSettingListInfo  *mInfo;
+	CCSSettingValueList mCmp;
+};
+
+ListEqualityMatcher::ListEqualityMatcher (CCSSettingListInfo *info,
+					  CCSSettingValueList cmp) :
+    priv (new PrivateListEqualityMatcher (info, cmp))
+{
+}
+
+bool
+ListEqualityMatcher::MatchAndExplain (CCSSettingValueList x,
+				      MatchResultListener *listener) const
+{
+    return ccsCompareLists (x, priv->mCmp, *priv->mInfo);
+}
+
+void
+ListEqualityMatcher::DescribeTo (std::ostream *os) const
+{
+    *os << "lists are equal";
+}
+
+void
+ListEqualityMatcher::DescribeNegationTo (std::ostream *os) const
+{
+    *os << "lists are not equal";
+}
+
+Matcher<CCSSettingValueList> ListEqual (CCSSettingListInfo *info,
+					CCSSettingValueList cmp)
+{
+    return MakeMatcher (new ListEqualityMatcher (info, cmp));
+}
+

=== modified file 'compizconfig/tests/compizconfig_ccs_list_equality.h'
--- compizconfig/tests/compizconfig_ccs_list_equality.h	2012-09-10 01:26:26 +0000
+++ compizconfig/tests/compizconfig_ccs_list_equality.h	2012-09-25 08:42:23 +0000
@@ -24,51 +24,37 @@
 #define _COMPIZCONFIG_CCS_LIST_EQUALITY_H
 
 #include <iosfwd>
+#include <memory>
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
 using ::testing::MatcherInterface;
 using ::testing::MatchResultListener;
-using ::testing::MakeMatcher;
 using ::testing::Matcher;
 
+typedef struct _CCSSettingValueList * CCSSettingValueList;
+typedef struct _CCSSettingListInfo    CCSSettingListInfo;
+
+class PrivateListEqualityMatcher;
+
 class ListEqualityMatcher :
     public MatcherInterface <CCSSettingValueList>
 {
     public:
 
-	ListEqualityMatcher (CCSSettingListInfo info,
-			     CCSSettingValueList cmp) :
-	    mInfo (info),
-	    mCmp (cmp)
-	{
-	}
-
-	virtual bool MatchAndExplain (CCSSettingValueList x, MatchResultListener *listener) const
-	{
-	    return ccsCompareLists (x, mCmp, mInfo);
-	}
-
-	virtual void DescribeTo (std::ostream *os) const
-	{
-	    *os << "lists are equal";
-	}
-
-	virtual void DescribeNegationTo (std::ostream *os) const
-	{
-	    *os << "lists are not equal";
-	}
+	ListEqualityMatcher (CCSSettingListInfo  *info,
+			     CCSSettingValueList cmp);
+
+	virtual bool MatchAndExplain (CCSSettingValueList x, MatchResultListener *listener) const;
+	virtual void DescribeTo (std::ostream *os) const;
+	virtual void DescribeNegationTo (std::ostream *os) const;
 
     private:
 
-	CCSSettingListInfo mInfo;
-	CCSSettingValueList mCmp;
+	std::auto_ptr <PrivateListEqualityMatcher> priv;
 };
 
-Matcher<CCSSettingValueList> ListEqual (CCSSettingListInfo info,
-					CCSSettingValueList cmp)
-{
-    return MakeMatcher (new ListEqualityMatcher (info, cmp));
-}
+Matcher<CCSSettingValueList> ListEqual (CCSSettingListInfo *info,
+					CCSSettingValueList cmp);
 
 #endif

=== added file 'compizconfig/tests/compizconfig_ccs_list_wrapper.cpp'
--- compizconfig/tests/compizconfig_ccs_list_wrapper.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_ccs_list_wrapper.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,109 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#include <ccs.h>
+#include <compizconfig_ccs_list_wrapper.h>
+
+namespace cci = compiz::config::impl;
+namespace cc  = compiz::config;
+
+namespace compiz
+{
+    namespace config
+    {
+	namespace impl
+	{
+	    class PrivateSettingValueListWrapper
+	    {
+		public:
+
+		    PrivateSettingValueListWrapper (CCSSettingValueList                      list,
+						       cci::ListStorageType                     storageType,
+						       CCSSettingType                           type,
+						       const boost::shared_ptr <CCSSettingInfo> &listInfo,
+						       const boost::shared_ptr <CCSSetting>     &settingReference) :
+			mType (type),
+			mListInfo (listInfo),
+			mSettingReference (settingReference),
+			mListWrapper (list,
+				      ccsSettingValueListFree,
+				      ccsSettingValueListAppend,
+				      ccsSettingValueListRemove,
+				      storageType)
+		    {
+		    }
+
+		    CCSSettingType                                  mType;
+		    boost::shared_ptr <CCSSettingInfo>              mListInfo;
+		    boost::shared_ptr <CCSSetting>                  mSettingReference;
+		    SettingValueListWrapper::InternalWrapperImpl mListWrapper;
+	    };
+	}
+    }
+}
+
+cci::SettingValueListWrapper::SettingValueListWrapper (CCSSettingValueList                      list,
+							     cci::ListStorageType                     storageType,
+							     CCSSettingType                           type,
+							     const boost::shared_ptr <CCSSettingInfo> &listInfo,
+							     const boost::shared_ptr <CCSSetting>     &settingReference) :
+    priv (new cci::PrivateSettingValueListWrapper (list,
+						      storageType,
+						      type,
+						      listInfo,
+						      settingReference))
+{
+}
+
+CCSSettingType
+cci::SettingValueListWrapper::type ()
+{
+    return priv->mType;
+}
+
+cci::SettingValueListWrapper::InternalWrapper &
+cci::SettingValueListWrapper::append (CCSSettingValue * const &value)
+{
+    return priv->mListWrapper.append (value);
+}
+
+cci::SettingValueListWrapper::InternalWrapper &
+cci::SettingValueListWrapper::remove (CCSSettingValue * const &value)
+{
+    return priv->mListWrapper.remove (value);
+}
+
+cci::SettingValueListWrapper::operator const CCSSettingValueList & () const
+{
+    return priv->mListWrapper;
+}
+
+cci::SettingValueListWrapper::operator CCSSettingValueList & ()
+{
+    return priv->mListWrapper;
+}
+
+const boost::shared_ptr <CCSSetting> &
+cci::SettingValueListWrapper::setting ()
+{
+    return priv->mSettingReference;
+}

=== renamed file 'compizconfig/tests/compizconfig_ccs_list_wrapper.h.moved' => 'compizconfig/tests/compizconfig_ccs_list_wrapper.h'
--- compizconfig/tests/compizconfig_ccs_list_wrapper.h.moved	2012-09-18 23:56:02 +0000
+++ compizconfig/tests/compizconfig_ccs_list_wrapper.h	2012-09-25 08:42:23 +0000
@@ -34,10 +34,6 @@
 typedef union _CCSSettingInfo CCSSettingInfo;
 typedef struct _CCSSettingValue CCSSettingValue;
 
-CCSSettingValueList ccsSettingValueListFree (CCSSettingValueList, Bool);
-CCSSettingValueList ccsSettingValueListAppend (CCSSettingValueList, CCSSettingValue *);
-CCSSettingValueList ccsSettingValueListRemove (CCSSettingValueList, CCSSettingValue *);
-
 namespace compiz
 {
     namespace config
@@ -79,10 +75,10 @@
 		    typedef ListType (*ListTypeRemoveFunc) (ListType, DataType, Bool);
 
 		    ListWrapper (const ListType &list,
-				    ListTypeFreeFunc freeFunc,
-				    ListTypeAppendFunc appendFunc,
-				    ListTypeRemoveFunc removeFunc,
-				    ListStorageType  storageType) :
+				 ListTypeFreeFunc freeFunc,
+				 ListTypeAppendFunc appendFunc,
+				 ListTypeRemoveFunc removeFunc,
+				 ListStorageType  storageType) :
 			mList (list),
 			mFree (freeFunc),
 			mAppend (appendFunc),
@@ -130,65 +126,33 @@
 		    ListStorageType    mStorageType;
 	    };
 
+	    class PrivateSettingValueListWrapper;
 	    class SettingValueListWrapper :
 		public compiz::config::ListWrapper <CCSSettingValueList, CCSSettingValue *>
 	    {
 		public:
 
 		    typedef boost::shared_ptr <SettingValueListWrapper> Ptr;
-
-		    SettingValueListWrapper (CCSSettingValueList list,
-						ListStorageType     storageType,
-						CCSSettingType	    type,
-						const boost::shared_ptr <CCSSettingInfo> &listInfo,
-						const boost::shared_ptr <CCSSetting> &settingReference) :
-			mType (type),
-			mListInfo (listInfo),
-			mSettingReference (settingReference),
-			mListWrapper (list,
-				      ccsSettingValueListFree,
-				      ccsSettingValueListAppend,
-				      ccsSettingValueListRemove,
-				      storageType)
-		    {
-		    }
-
-		    CCSSettingType type ()
-		    {
-			return mType;
-		    }
-
-		    cc::ListWrapper <CCSSettingValueList, CCSSettingValue *> & append (CCSSettingValue * const &value)
-		    {
-			return mListWrapper.append (value);
-		    }
-
-		    cc::ListWrapper <CCSSettingValueList, CCSSettingValue *> & remove (CCSSettingValue * const &value)
-		    {
-			return mListWrapper.remove (value);
-		    }
-
-		    operator const CCSSettingValueList & () const
-		    {
-			return mListWrapper;
-		    }
-
-		    operator CCSSettingValueList & ()
-		    {
-			return mListWrapper;
-		    }
-
-		    const boost::shared_ptr <CCSSetting> & setting ()
-		    {
-			return mSettingReference;
-		    }
+		    typedef compiz::config::ListWrapper <CCSSettingValueList, CCSSettingValue *> InternalWrapper;
+		    typedef compiz::config::impl::ListWrapper <CCSSettingValueList, CCSSettingValue *> InternalWrapperImpl;
+
+		    SettingValueListWrapper (CCSSettingValueList                      list,
+					     ListStorageType                          storageType,
+					     CCSSettingType                           type,
+					     const boost::shared_ptr <CCSSettingInfo> &listInfo,
+					     const boost::shared_ptr <CCSSetting>     &settingReference);
+
+		    CCSSettingType type ();
+
+		    InternalWrapper & append (CCSSettingValue * const &value);
+		    InternalWrapper & remove (CCSSettingValue * const &value);
+		    operator const CCSSettingValueList & () const;
+		    operator CCSSettingValueList & ();
+		    const boost::shared_ptr <CCSSetting> & setting ();
 
 		private:
 
-		    CCSSettingType					         mType;
-		    boost::shared_ptr <CCSSettingInfo>			         mListInfo;
-		    boost::shared_ptr <CCSSetting>			         mSettingReference;
-		    cci::ListWrapper <CCSSettingValueList, CCSSettingValue *> mListWrapper;
+		    boost::shared_ptr <PrivateSettingValueListWrapper> priv;
 	    };
 	}
     }

=== removed file 'compizconfig/tests/compizconfig_ccs_list_wrapper.h'
--- compizconfig/tests/compizconfig_ccs_list_wrapper.h	2012-09-18 23:56:02 +0000
+++ compizconfig/tests/compizconfig_ccs_list_wrapper.h	1970-01-01 00:00:00 +0000
@@ -1,199 +0,0 @@
-/*
- * Compiz configuration system library
- *
- * Copyright (C) 2012 Canonical Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Authored By:
- * Sam Spilsbury <sam.spilsbury@canonical.com>
- */
-#ifndef _COMPIZCONFIG_CCS_LIST_WRAPPER_H
-#define _COMPIZCONFIG_CCS_LIST_WRAPPER_H
-
-#include <ccs-defs.h>
-#include <ccs-setting-types.h>
-
-#include <boost/shared_ptr.hpp>
-#include <boost/noncopyable.hpp>
-
-typedef struct _CCSSettingValueList * CCSSettingValueList;
-typedef struct _CCSSetting CCSSetting;
-typedef union _CCSSettingInfo CCSSettingInfo;
-typedef struct _CCSSettingValue CCSSettingValue;
-
-CCSSettingValueList ccsSettingValueListFree (CCSSettingValueList, Bool);
-CCSSettingValueList ccsSettingValueListAppend (CCSSettingValueList, CCSSettingValue *);
-CCSSettingValueList ccsSettingValueListRemove (CCSSettingValueList, CCSSettingValue *);
-
-namespace compiz
-{
-    namespace config
-    {
-	template <typename ListType, typename DataType>
-	class ListWrapper :
-	    boost::noncopyable
-	{
-	    public:
-
-		virtual ~ListWrapper () {}
-
-		virtual ListWrapper<ListType, DataType> & append (const DataType &) = 0;
-		virtual ListWrapper<ListType, DataType> & remove (const DataType &) = 0;
-
-		virtual operator const ListType & () const = 0;
-		virtual operator ListType & () = 0;
-	};
-
-	namespace impl
-	{
-	    namespace cc = compiz::config;
-	    namespace cci = compiz::config::impl;
-
-	    typedef enum _ListStorageType
-	    {
-		Shallow = 0,
-		Deep = 1
-	    } ListStorageType;
-
-	    template <typename ListType, typename DataType>
-	    class ListWrapper :
-		public cc::ListWrapper <ListType, DataType>
-	    {
-		public:
-
-		    typedef ListType (*ListTypeFreeFunc) (ListType, Bool);
-		    typedef ListType (*ListTypeAppendFunc) (ListType, DataType);
-		    typedef ListType (*ListTypeRemoveFunc) (ListType, DataType, Bool);
-
-		    ListWrapper (const ListType &list,
-				    ListTypeFreeFunc freeFunc,
-				    ListTypeAppendFunc appendFunc,
-				    ListTypeRemoveFunc removeFunc,
-				    ListStorageType  storageType) :
-			mList (list),
-			mFree (freeFunc),
-			mAppend (appendFunc),
-			mRemove (removeFunc),
-			mStorageType (storageType)
-		    {
-		    };
-
-		    cc::ListWrapper<ListType, DataType> & append (DataType const &data)
-		    {
-			mList = (*mAppend) (mList, data);
-			return *this;
-		    }
-
-		    cc::ListWrapper<ListType, DataType> & remove (DataType const &data)
-		    {
-			Bool freeObj = (mStorageType == Deep);
-			mList = (*mRemove) (mList, data, freeObj);
-			return *this;
-		    }
-
-		    operator const ListType & () const
-		    {
-			return mList;
-		    }
-
-		    operator ListType & ()
-		    {
-			return mList;
-		    }
-
-		    ~ListWrapper ()
-		    {
-			Bool freeObj = (mStorageType == Deep);
-
-			(*mFree) (mList, freeObj);
-		    }
-
-		private:
-
-		    ListType           mList;
-		    ListTypeFreeFunc   mFree;
-		    ListTypeAppendFunc mAppend;
-		    ListTypeRemoveFunc mRemove;
-		    ListStorageType    mStorageType;
-	    };
-
-	    class SettingValueListWrapper :
-		public compiz::config::ListWrapper <CCSSettingValueList, CCSSettingValue *>
-	    {
-		public:
-
-		    typedef boost::shared_ptr <SettingValueListWrapper> Ptr;
-
-		    SettingValueListWrapper (CCSSettingValueList list,
-						ListStorageType     storageType,
-						CCSSettingType	    type,
-						const boost::shared_ptr <CCSSettingInfo> &listInfo,
-						const boost::shared_ptr <CCSSetting> &settingReference) :
-			mType (type),
-			mListInfo (listInfo),
-			mSettingReference (settingReference),
-			mListWrapper (list,
-				      ccsSettingValueListFree,
-				      ccsSettingValueListAppend,
-				      ccsSettingValueListRemove,
-				      storageType)
-		    {
-		    }
-
-		    CCSSettingType type ()
-		    {
-			return mType;
-		    }
-
-		    cc::ListWrapper <CCSSettingValueList, CCSSettingValue *> & append (CCSSettingValue * const &value)
-		    {
-			return mListWrapper.append (value);
-		    }
-
-		    cc::ListWrapper <CCSSettingValueList, CCSSettingValue *> & remove (CCSSettingValue * const &value)
-		    {
-			return mListWrapper.remove (value);
-		    }
-
-		    operator const CCSSettingValueList & () const
-		    {
-			return mListWrapper;
-		    }
-
-		    operator CCSSettingValueList & ()
-		    {
-			return mListWrapper;
-		    }
-
-		    const boost::shared_ptr <CCSSetting> & setting ()
-		    {
-			return mSettingReference;
-		    }
-
-		private:
-
-		    CCSSettingType					         mType;
-		    boost::shared_ptr <CCSSettingInfo>			         mListInfo;
-		    boost::shared_ptr <CCSSetting>			         mSettingReference;
-		    cci::ListWrapper <CCSSettingValueList, CCSSettingValue *> mListWrapper;
-	    };
-	}
-    }
-}
-
-
-
-#endif

=== added file 'compizconfig/tests/compizconfig_ccs_setting_value_matcher.cpp'
--- compizconfig/tests/compizconfig_ccs_setting_value_matcher.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_ccs_setting_value_matcher.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,69 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <ccs.h>
+#include "compizconfig_ccs_setting_value_matcher.h"
+
+CCSSettingValueMatcher::CCSSettingValueMatcher (const CCSSettingValue &match,
+						CCSSettingType        type,
+						CCSSettingInfo        *info) :
+    mMatch (match),
+    mType  (type),
+    mInfo  (info)
+{
+}
+
+bool
+CCSSettingValueMatcher::MatchAndExplain (CCSSettingValue x, MatchResultListener *listener) const
+{
+    if (ccsCheckValueEq (&x,
+			 mType,
+			 mInfo,
+			 &mMatch,
+			 mType,
+			 mInfo))
+	return true;
+    return false;
+}
+
+void
+CCSSettingValueMatcher::DescribeTo (std::ostream *os) const
+{
+    *os << "Value Matches";
+}
+
+void
+CCSSettingValueMatcher::DescribeNegationTo (std::ostream *os) const
+{
+    *os << "Value does not Match";
+}
+
+Matcher <CCSSettingValue>
+SettingValueMatch (const CCSSettingValue &match,
+		   CCSSettingType	     type,
+		   CCSSettingInfo	     *info)
+{
+    return MakeMatcher (new CCSSettingValueMatcher (match, type, info));
+}

=== added file 'compizconfig/tests/compizconfig_ccs_setting_value_matcher.h'
--- compizconfig/tests/compizconfig_ccs_setting_value_matcher.h	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_ccs_setting_value_matcher.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,64 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_CCS_SETTING_VALUE_MATCHER_H
+#define _COMPIZCONFIG_CCS_SETTING_VALUE_MATCHER_H
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include <ccs-defs.h>
+#include <ccs-setting-types.h>
+
+using ::testing::MatcherInterface;
+using ::testing::Matcher;
+using ::testing::MatchResultListener;
+
+typedef struct _CCSSettingValue CCSSettingValue;
+typedef union  _CCSSettingInfo  CCSSettingInfo;
+
+class CCSSettingValueMatcher :
+    public ::testing::MatcherInterface <CCSSettingValue>
+{
+    public:
+
+	CCSSettingValueMatcher (const CCSSettingValue &match,
+				CCSSettingType        type,
+				CCSSettingInfo        *info);
+
+	virtual bool MatchAndExplain (CCSSettingValue x, MatchResultListener *listener) const;
+	virtual void DescribeTo (std::ostream *os) const;
+	virtual void DescribeNegationTo (std::ostream *os) const;
+
+    private:
+
+	const CCSSettingValue &mMatch;
+	CCSSettingType	  mType;
+	CCSSettingInfo	  *mInfo;
+};
+
+Matcher <CCSSettingValue>
+SettingValueMatch (const CCSSettingValue &match,
+		   CCSSettingType	 type,
+		   CCSSettingInfo	 *info);
+
+#endif

=== added file 'compizconfig/tests/compizconfig_ccs_setting_value_operators.cpp'
--- compizconfig/tests/compizconfig_ccs_setting_value_operators.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_ccs_setting_value_operators.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,103 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+
+#include <ccs.h>
+#include <compizconfig_ccs_setting_value_operators.h>
+#include <iostream>
+
+bool
+operator== (const CCSSettingColorValue &lhs,
+	    const CCSSettingColorValue &rhs)
+{
+    if (ccsIsEqualColor (lhs, rhs))
+	return true;
+    return false;
+}
+
+std::ostream &
+operator<< (std::ostream &os, const CCSSettingColorValue &v)
+{
+    return os << "Red: " << std::hex << v.color.red << "Blue: " << std::hex << v.color.blue << "Green: " << v.color.green << "Alpha: " << v.color.alpha
+       << std::dec << std::endl;
+}
+
+bool
+operator== (const CCSSettingKeyValue &lhs,
+	    const CCSSettingKeyValue &rhs)
+{
+    if (ccsIsEqualKey (lhs, rhs))
+	return true;
+    return false;
+}
+
+std::ostream &
+operator<< (std::ostream &os, const CCSSettingKeyValue &v)
+{
+    return os << "Keysym: " << v.keysym << " KeyModMask " << std::hex << v.keyModMask << std::dec << std::endl;
+}
+
+bool
+operator== (const CCSSettingButtonValue &lhs,
+	    const CCSSettingButtonValue &rhs)
+{
+    if (ccsIsEqualButton (lhs, rhs))
+	return true;
+    return false;
+}
+
+std::ostream &
+operator<< (std::ostream &os, const CCSSettingButtonValue &v)
+{
+    return os << "Button " << v.button << "Button Key Mask: " << std::hex << v.buttonModMask << "Edge Mask: " << v.edgeMask << std::dec << std::endl;
+}
+
+bool
+operator== (const CCSString &lhs,
+	    const std::string &rhs)
+{
+    if (rhs == lhs.value)
+	return true;
+
+    return false;
+}
+
+bool
+operator== (const std::string &lhs,
+	    const CCSString &rhs)
+{
+    return rhs == lhs;
+}
+
+bool
+operator== (const std::string &rhs,
+	    CCSString	      *lhs)
+{
+    return *lhs == rhs;
+}
+
+std::ostream &
+operator<< (std::ostream &os, CCSString &string)
+{
+    os << string.value << std::endl;
+    return os;
+}

=== modified file 'compizconfig/tests/compizconfig_ccs_setting_value_operators.h'
--- compizconfig/tests/compizconfig_ccs_setting_value_operators.h	2012-09-10 01:26:26 +0000
+++ compizconfig/tests/compizconfig_ccs_setting_value_operators.h	2012-09-25 08:42:23 +0000
@@ -23,83 +23,48 @@
 #ifndef _COMPIZCONFIG_CCS_SETTING_VALUE_OPERATORS_H
 #define _COMPIZCONFIG_CCS_SETTING_VALUE_OPERATORS_H
 
-#include <ccs.h>
+#include <iosfwd>
+#include <string>
+
+typedef union _CCSSettingColorValue CCSSettingColorValue;
+typedef struct _CCSSettingKeyValue CCSSettingKeyValue;
+typedef struct _CCSSettingButtonValue CCSSettingButtonValue;
+typedef struct _CCSString CCSString;
 
 bool
 operator== (const CCSSettingColorValue &lhs,
-	    const CCSSettingColorValue &rhs)
-{
-    if (ccsIsEqualColor (lhs, rhs))
-	return true;
-    return false;
-}
+	    const CCSSettingColorValue &rhs);
 
 std::ostream &
-operator<< (std::ostream &os, const CCSSettingColorValue &v)
-{
-    return os << "Red: " << std::hex << v.color.red << "Blue: " << std::hex << v.color.blue << "Green: " << v.color.green << "Alpha: " << v.color.alpha
-       << std::dec << std::endl;
-}
+operator<< (std::ostream &os, const CCSSettingColorValue &v);
 
 bool
 operator== (const CCSSettingKeyValue &lhs,
-	    const CCSSettingKeyValue &rhs)
-{
-    if (ccsIsEqualKey (lhs, rhs))
-	return true;
-    return false;
-}
+	    const CCSSettingKeyValue &rhs);
 
 std::ostream &
-operator<< (std::ostream &os, const CCSSettingKeyValue &v)
-{
-    return os << "Keysym: " << v.keysym << " KeyModMask " << std::hex << v.keyModMask << std::dec << std::endl;
-}
+operator<< (std::ostream &os, const CCSSettingKeyValue &v);
 
 bool
 operator== (const CCSSettingButtonValue &lhs,
-	    const CCSSettingButtonValue &rhs)
-{
-    if (ccsIsEqualButton (lhs, rhs))
-	return true;
-    return false;
-}
+	    const CCSSettingButtonValue &rhs);
 
 std::ostream &
-operator<< (std::ostream &os, const CCSSettingButtonValue &v)
-{
-    return os << "Button " << v.button << "Button Key Mask: " << std::hex << v.buttonModMask << "Edge Mask: " << v.edgeMask << std::dec << std::endl;
-}
+operator<< (std::ostream &os, const CCSSettingButtonValue &v);
 
 bool
 operator== (const CCSString &lhs,
-	    const std::string &rhs)
-{
-    if (rhs == lhs.value)
-	return true;
-
-    return false;
-}
+	    const std::string &rhs);
 
 bool
 operator== (const std::string &lhs,
-	    const CCSString &rhs)
-{
-    return rhs == lhs;
-}
+	    const CCSString &rhs);
 
 bool
 operator== (const std::string &rhs,
-	    CCSString	      *lhs)
-{
-    return *lhs == rhs;
-}
+	    CCSString	      *lhs);
 
 std::ostream &
-operator<< (std::ostream &os, CCSString &string)
-{
-    os << string.value << std::endl;
-    return os;
-}
+operator<< (std::ostream &os, CCSString &string);
 
 #endif

=== added file 'compizconfig/tests/compizconfig_ccs_settings_test_fixture.h'
--- compizconfig/tests/compizconfig_ccs_settings_test_fixture.h	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_ccs_settings_test_fixture.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,106 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_CCS_SETTINGS_TEST_FIXTURE_H
+#define _COMPIZCONFIG_CCS_SETTINGS_TEST_FIXTURE_H
+#include <string>
+#include <ccs-defs.h>
+#include "compizconfig_ccs_variant_types.h"
+
+typedef enum _CCSSettingType CCSSettingType;
+typedef struct _CCSSetting   CCSSetting;
+
+namespace compizconfig
+{
+    namespace test
+    {
+	Bool boolToBool (bool v);
+    }
+}
+
+class CCSSettingsConceptTestEnvironmentInterface
+{
+    public:
+
+	virtual void SetUp () = 0;
+	virtual void TearDown () = 0;
+
+	virtual void WriteBoolAtKey (const std::string  &plugin,
+				     const std::string  &key,
+				     const VariantTypes   &value) = 0;
+	virtual void WriteIntegerAtKey (const std::string &plugin,
+					const std::string &key,
+					const VariantTypes &value) = 0;
+	virtual void WriteFloatAtKey (const std::string  &plugin,
+				      const std::string  &key,
+				      const VariantTypes &value) = 0;
+	virtual void WriteStringAtKey (const std::string  &plugin,
+				       const std::string  &key,
+				       const VariantTypes &value) = 0;
+	virtual void WriteColorAtKey (const std::string  &plugin,
+				      const std::string  &key,
+				      const VariantTypes &value) = 0;
+	virtual void WriteKeyAtKey (const std::string  &plugin,
+				    const std::string  &key,
+				    const VariantTypes &value) = 0;
+	virtual void WriteButtonAtKey (const std::string  &plugin,
+				       const std::string  &key,
+				       const VariantTypes &value) = 0;
+	virtual void WriteEdgeAtKey (const std::string  &plugin,
+				     const std::string  &key,
+				     const VariantTypes &value) = 0;
+	virtual void WriteMatchAtKey (const std::string  &plugin,
+				      const std::string  &key,
+				      const VariantTypes &value) = 0;
+	virtual void WriteBellAtKey (const std::string  &plugin,
+				     const std::string  &key,
+				     const VariantTypes &value) = 0;
+	virtual void WriteListAtKey (const std::string  &plugin,
+				     const std::string  &key,
+				     const VariantTypes &value) = 0;
+
+	virtual Bool ReadBoolAtKey (const std::string  &plugin,
+				    const std::string  &key) = 0;
+	virtual int ReadIntegerAtKey (const std::string &plugin,
+				      const std::string &key) = 0;
+	virtual float ReadFloatAtKey (const std::string &plugin,
+				      const std::string &key) = 0;
+	virtual const char * ReadStringAtKey (const std::string &plugin,
+					      const std::string &key) = 0;
+	virtual CCSSettingColorValue ReadColorAtKey (const std::string &plugin,
+						     const std::string &key) = 0;
+	virtual CCSSettingKeyValue ReadKeyAtKey (const std::string &plugin,
+						 const std::string &key) = 0;
+	virtual CCSSettingButtonValue ReadButtonAtKey (const std::string &plugin,
+						       const std::string &key) = 0;
+	virtual unsigned int ReadEdgeAtKey (const std::string &plugin,
+					    const std::string &key) = 0;
+	virtual const char * ReadMatchAtKey (const std::string &plugin,
+					     const std::string &key) = 0;
+	virtual Bool ReadBellAtKey (const std::string &plugin,
+				    const std::string &key) = 0;
+	virtual CCSSettingValueList ReadListAtKey (const std::string &plugin,
+						   const std::string &key,
+						   CCSSetting        *setting) = 0;
+};
+
+#endif

=== added file 'compizconfig/tests/compizconfig_ccs_variant_types.h'
--- compizconfig/tests/compizconfig_ccs_variant_types.h	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_ccs_variant_types.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,40 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZCONFIG_CCS_VARIANT_TYPES_H
+#define _COMPIZCONFIG_CCS_VARIANT_TYPES_H
+
+#include <boost/variant.hpp>
+#include <boost/shared_ptr.hpp>
+#include "compizconfig_ccs_list_wrapper.h"
+
+typedef boost::variant <bool,
+			int,
+			float,
+			const char *,
+			CCSSettingColorValue,
+			CCSSettingKeyValue,
+			CCSSettingButtonValue,
+			unsigned int,
+			compiz::config::impl::SettingValueListWrapper::Ptr> VariantTypes;
+
+#endif

=== added file 'compizconfig/tests/compizconfig_test_value_combiners.cpp'
--- compizconfig/tests/compizconfig_test_value_combiners.cpp	1970-01-01 00:00:00 +0000
+++ compizconfig/tests/compizconfig_test_value_combiners.cpp	2012-09-25 08:42:23 +0000
@@ -0,0 +1,147 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#include <limits>
+#include <X11/keysym.h>
+#include <ccs.h>
+#include <gtest_shared_characterwrapper.h>
+#include <compizconfig_test_value_combiners.h>
+
+namespace compizconfig
+{
+    namespace test
+    {
+	namespace impl
+	{
+	    Bool boolValues[] = { TRUE, FALSE, TRUE };
+	    int intValues[] = { 1, 2, 3 };
+	    float floatValues[] = { 1.0, 2.0, 3.0 };
+	    const char * stringValues[] = { "foo", "grill", "bar" };
+	    const char * matchValues[] = { "type=foo", "class=bar", "xid=42" };
+
+	    const unsigned int NUM_COLOR_VALUES = 3;
+
+	    CCSSettingKeyValue keyValue = { XK_A,
+					    (1 << 0)};
+
+	    CCSSettingButtonValue buttonValue = { 1,
+						  (1 << 0),
+						  (1 << 1) };
+
+	    CCSSettingColorValue *
+	    getColorValueList ();
+	}
+    }
+}
+
+namespace cctesti = compizconfig::test::impl;
+namespace cclistpopulatorsi = compizconfig::test::impl::populators::list;
+
+CCSSettingColorValue *
+cctesti::getColorValueList ()
+{
+    static const unsigned short max = std::numeric_limits <unsigned short>::max ();
+    static const unsigned short maxD2 = max / 2;
+    static const unsigned short maxD4 = max / 4;
+    static const unsigned short maxD8 = max / 8;
+
+    static bool colorValueListInitialized = false;
+
+    static CCSSettingColorValue colorValues[NUM_COLOR_VALUES];
+
+    if (!colorValueListInitialized)
+    {
+	colorValues[0].color.red = maxD2;
+	colorValues[0].color.blue = maxD4;
+	colorValues[0].color.green = maxD8;
+	colorValues[0].color.alpha = max;
+
+	colorValues[1].color.red = maxD8;
+	colorValues[1].color.blue = maxD4;
+	colorValues[1].color.green = maxD2;
+	colorValues[1].color.alpha = max;
+
+	colorValues[1].color.red = max;
+	colorValues[1].color.blue = maxD4;
+	colorValues[1].color.green = maxD2;
+	colorValues[1].color.alpha = maxD8;
+
+	for (unsigned int i = 0; i < NUM_COLOR_VALUES; i++)
+	{
+	    CharacterWrapper s (ccsColorToString (&colorValues[i]));
+
+	    ccsStringToColor (s, &colorValues[i]);
+	}
+
+	colorValueListInitialized = true;
+    }
+
+    return colorValues;
+}
+
+CCSSettingValueList
+cclistpopulatorsi::boolean (CCSSetting *setting)
+{
+    return ccsGetValueListFromBoolArray (cctesti::boolValues,
+					 sizeof (cctesti::boolValues) / sizeof (cctesti::boolValues[0]),
+					 setting);
+}
+
+CCSSettingValueList
+cclistpopulatorsi::integer (CCSSetting *setting)
+{
+    return ccsGetValueListFromIntArray (cctesti::intValues,
+					sizeof (cctesti::intValues) / sizeof (cctesti::intValues[0]),
+					setting);
+}
+
+CCSSettingValueList
+cclistpopulatorsi::doubleprecision (CCSSetting *setting)
+{
+    return ccsGetValueListFromFloatArray (cctesti::floatValues,
+					  sizeof (cctesti::floatValues) / sizeof (cctesti::floatValues[0]),
+					  setting);
+}
+
+CCSSettingValueList
+cclistpopulatorsi::string (CCSSetting *setting)
+{
+    return ccsGetValueListFromStringArray (cctesti::stringValues,
+					   sizeof (cctesti::stringValues) / sizeof (cctesti::stringValues[0]),
+					   setting);
+}
+
+CCSSettingValueList
+cclistpopulatorsi::match (CCSSetting *setting)
+{
+    return ccsGetValueListFromMatchArray (cctesti::matchValues,
+					  sizeof (cctesti::matchValues) / sizeof (cctesti::matchValues[0]),
+					  setting);
+}
+
+CCSSettingValueList
+cclistpopulatorsi::color (CCSSetting *setting)
+{
+    return ccsGetValueListFromColorArray (cctesti::getColorValueList (),
+					  cctesti::NUM_COLOR_VALUES,
+					  setting);
+}

=== modified file 'compizconfig/tests/compizconfig_test_value_combiners.h'
--- compizconfig/tests/compizconfig_test_value_combiners.h	2012-09-10 01:06:55 +0000
+++ compizconfig/tests/compizconfig_test_value_combiners.h	2012-09-25 08:42:23 +0000
@@ -33,95 +33,30 @@
     {
 	namespace impl
 	{
-	    Bool boolValues[] = { TRUE, FALSE, TRUE };
-	    int intValues[] = { 1, 2, 3 };
-	    float floatValues[] = { 1.0, 2.0, 3.0 };
-	    const char * stringValues[] = { "foo", "grill", "bar" };
-	    const char * matchValues[] = { "type=foo", "class=bar", "xid=42" };
-
-	    const unsigned int NUM_COLOR_VALUES = 3;
+	    extern Bool boolValues[];
+	    extern int intValues[];
+	    extern float floatValues[];
+	    extern const char * stringValues[];
+	    extern const char * matchValues[];
+
+	    extern CCSSettingKeyValue keyValue;
+	    extern CCSSettingButtonValue buttonValue;
+
+	    extern const unsigned int NUM_COLOR_VALUES;
 
 	    CCSSettingColorValue *
-	    getColorValueList ()
-	    {
-		static const unsigned short max = std::numeric_limits <unsigned short>::max ();
-		static const unsigned short maxD2 = max / 2;
-		static const unsigned short maxD4 = max / 4;
-		static const unsigned short maxD8 = max / 8;
-
-		static bool colorValueListInitialized = false;
-
-		static CCSSettingColorValue colorValues[NUM_COLOR_VALUES];
-
-		if (!colorValueListInitialized)
-		{
-		    colorValues[0].color.red = maxD2;
-		    colorValues[0].color.blue = maxD4;
-		    colorValues[0].color.green = maxD8;
-		    colorValues[0].color.alpha = max;
-
-		    colorValues[1].color.red = maxD8;
-		    colorValues[1].color.blue = maxD4;
-		    colorValues[1].color.green = maxD2;
-		    colorValues[1].color.alpha = max;
-
-		    colorValues[1].color.red = max;
-		    colorValues[1].color.blue = maxD4;
-		    colorValues[1].color.green = maxD2;
-		    colorValues[1].color.alpha = maxD8;
-
-		    for (unsigned int i = 0; i < NUM_COLOR_VALUES; i++)
-		    {
-			CharacterWrapper s (ccsColorToString (&colorValues[i]));
-
-			ccsStringToColor (s, &colorValues[i]);
-		    }
-
-		    colorValueListInitialized = true;
-		}
-
-		return colorValues;
-	    }
-	    CCSSettingKeyValue keyValue = { XK_A,
-					    (1 << 0)};
-
-	    CCSSettingButtonValue buttonValue = { 1,
-						  (1 << 0),
-						  (1 << 1) };
+	    getColorValueList ();
 
 	    namespace populators
 	    {
 		namespace list
 		{
-		    CCSSettingValueList boolean (CCSSetting *setting)
-		    {
-			return ccsGetValueListFromBoolArray (boolValues, sizeof (boolValues) / sizeof (boolValues[0]), setting);
-		    }
-
-		    CCSSettingValueList integer (CCSSetting *setting)
-		    {
-			return ccsGetValueListFromIntArray (intValues, sizeof (intValues) / sizeof (intValues[0]), setting);
-		    }
-
-		    CCSSettingValueList doubleprecision (CCSSetting *setting)
-		    {
-			return ccsGetValueListFromFloatArray (floatValues, sizeof (floatValues) / sizeof (floatValues[0]), setting);
-		    }
-
-		    CCSSettingValueList string (CCSSetting *setting)
-		    {
-			return ccsGetValueListFromStringArray (stringValues, sizeof (stringValues) / sizeof (stringValues[0]), setting);
-		    }
-
-		    CCSSettingValueList match (CCSSetting *setting)
-		    {
-			return ccsGetValueListFromMatchArray (matchValues, sizeof (matchValues) / sizeof (matchValues[0]), setting);
-		    }
-
-		    CCSSettingValueList color (CCSSetting *setting)
-		    {
-			return ccsGetValueListFromColorArray (getColorValueList (), 3, setting);
-		    }
+		    CCSSettingValueList boolean (CCSSetting *setting);
+		    CCSSettingValueList integer (CCSSetting *setting);
+		    CCSSettingValueList doubleprecision (CCSSetting *setting);
+		    CCSSettingValueList string (CCSSetting *setting);
+		    CCSSettingValueList match (CCSSetting *setting);
+		    CCSSettingValueList color (CCSSetting *setting);
 		}
 	    }
 	}

=== modified file 'gtk/window-decorator/tests/CMakeLists.txt'
--- gtk/window-decorator/tests/CMakeLists.txt	2012-09-06 10:12:08 +0000
+++ gtk/window-decorator/tests/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -2,7 +2,9 @@
 
 include_directories (${CMAKE_CURRENT_SOURCE_DIR}
 		     ${CMAKE_CURRENT_SOURCE_DIR}/../
-		     ${CMAKE_CURRENT_BINARY_DIR})
+                     ${CMAKE_CURRENT_BINARY_DIR}
+                     ${CMAKE_SOURCE_DIR}/tests/shared
+                     ${CMAKE_SOURCE_DIR}/tests/shared/glib)
 
 configure_file (${CMAKE_CURRENT_SOURCE_DIR}/compiz_gwd_tests.h.in
 		${CMAKE_CURRENT_BINARY_DIR}/compiz_gwd_tests.h)

=== modified file 'gtk/window-decorator/tests/test_gwd_metacity_decorations.cpp'
--- gtk/window-decorator/tests/test_gwd_metacity_decorations.cpp	2012-09-05 14:25:35 +0000
+++ gtk/window-decorator/tests/test_gwd_metacity_decorations.cpp	2012-09-25 08:42:23 +0000
@@ -21,6 +21,8 @@
 #include <string>
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
+
+#include "gtest_unspecified_bool_type_matcher.h"
 #include "gwd-metacity-window-decoration-util.h"
 
 class GWDMetacityDecorationUtilTest :
@@ -28,9 +30,6 @@
 {
 };
 
-MATCHER(IsTrue, "Is TRUE") { if (arg) return true; else return false; }
-MATCHER(IsFalse, "Is FALSE") { if (!arg) return true; else return false; }
-
 namespace
 {
     MetaTheme * get_current_returns_null ()

=== modified file 'gtk/window-decorator/tests/test_gwd_settings.cpp'
--- gtk/window-decorator/tests/test_gwd_settings.cpp	2012-09-06 10:12:08 +0000
+++ gtk/window-decorator/tests/test_gwd_settings.cpp	2012-09-25 08:42:23 +0000
@@ -34,6 +34,11 @@
 
 #include <gio/gio.h>
 
+#include <glib_gslice_off_env.h>
+#include <glib_gsettings_memory_backend_env.h>
+
+#include <gtest_unspecified_bool_type_matcher.h>
+
 #include "compiz_gwd_tests.h"
 
 #include "gwd-settings-interface.h"
@@ -172,22 +177,6 @@
 	typename GValueCmp<ValueCType>::GetFunc mGetFunc;
 };
 
-MATCHER (GBooleanTrue, "gboolean TRUE")
-{
-    if (arg)
-	return true;
-    else
-	return false;
-}
-
-MATCHER (GBooleanFalse, "gboolean FALSE")
-{
-    if (!arg)
-	return true;
-    else
-	return false;
-}
-
 namespace testing_values
 {
     const gdouble ACTIVE_SHADOW_OPACITY_VALUE = 1.0;
@@ -252,13 +241,16 @@
     public:
 	virtual void SetUp ()
 	{
-	    g_setenv ("G_SLICE", "always-malloc", TRUE);
+	    env.SetUpEnv ();
 	    g_type_init ();
 	}
 	virtual void TearDown ()
 	{
-	    g_unsetenv ("G_SLICE");
+	    env.TearDownEnv ();
 	}
+    private:
+
+	CompizGLibGSliceOffEnv env;
 };
 
 class GWDMockSettingsWritableTest :
@@ -372,29 +364,29 @@
 								testing_values::INACTIVE_SHADOW_OPACITY_VALUE,
 								testing_values::INACTIVE_SHADOW_OFFSET_X_VALUE,
 								testing_values::INACTIVE_SHADOW_OFFSET_Y_VALUE,
-								testing_values::INACTIVE_SHADOW_COLOR_STR_VALUE.c_str ()), GBooleanTrue ());
-    EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (writableMock.get (), testing_values::USE_TOOLTIPS_VALUE), GBooleanTrue ());
-    EXPECT_THAT (gwd_settings_writable_draggable_border_width_changed (writableMock.get (), testing_values::DRAGGABLE_BORDER_WIDTH_VALUE), GBooleanTrue ());
-    EXPECT_THAT (gwd_settings_writable_attach_modal_dialogs_changed (writableMock.get (), testing_values::ATTACH_MODAL_DIALOGS_VALUE), GBooleanTrue ());
-    EXPECT_THAT (gwd_settings_writable_blur_changed (writableMock.get (), testing_values::BLUR_TYPE_TITLEBAR_VALUE.c_str ()), GBooleanTrue ());
+								testing_values::INACTIVE_SHADOW_COLOR_STR_VALUE.c_str ()), IsTrue ());
+    EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (writableMock.get (), testing_values::USE_TOOLTIPS_VALUE), IsTrue ());
+    EXPECT_THAT (gwd_settings_writable_draggable_border_width_changed (writableMock.get (), testing_values::DRAGGABLE_BORDER_WIDTH_VALUE), IsTrue ());
+    EXPECT_THAT (gwd_settings_writable_attach_modal_dialogs_changed (writableMock.get (), testing_values::ATTACH_MODAL_DIALOGS_VALUE), IsTrue ());
+    EXPECT_THAT (gwd_settings_writable_blur_changed (writableMock.get (), testing_values::BLUR_TYPE_TITLEBAR_VALUE.c_str ()), IsTrue ());
     EXPECT_THAT (gwd_settings_writable_metacity_theme_changed (writableMock.get (),
 							       testing_values::USE_METACITY_THEME_VALUE,
-							       testing_values::METACITY_THEME_VALUE.c_str ()), GBooleanTrue ());
+							       testing_values::METACITY_THEME_VALUE.c_str ()), IsTrue ());
     EXPECT_THAT (gwd_settings_writable_opacity_changed (writableMock.get (),
 							testing_values::ACTIVE_OPACITY_VALUE,
 							testing_values::INACTIVE_OPACITY_VALUE,
 							testing_values::ACTIVE_SHADE_OPACITY_VALUE,
-							testing_values::INACTIVE_SHADE_OPACITY_VALUE), GBooleanTrue ());
+							testing_values::INACTIVE_SHADE_OPACITY_VALUE), IsTrue ());
     EXPECT_THAT (gwd_settings_writable_button_layout_changed (writableMock.get (),
-							      testing_values::BUTTON_LAYOUT_VALUE.c_str ()), GBooleanTrue ());
+							      testing_values::BUTTON_LAYOUT_VALUE.c_str ()), IsTrue ());
     EXPECT_THAT (gwd_settings_writable_font_changed (writableMock.get (),
 						     testing_values::USE_SYSTEM_FONT_VALUE,
-						     testing_values::TITLEBAR_FONT_VALUE.c_str ()), GBooleanTrue ());
+						     testing_values::TITLEBAR_FONT_VALUE.c_str ()), IsTrue ());
     EXPECT_THAT (gwd_settings_writable_titlebar_actions_changed (writableMock.get (),
 								 testing_values::TITLEBAR_ACTION_MAX.c_str (),
 								 testing_values::TITLEBAR_ACTION_MENU.c_str (),
 								 testing_values::TITLEBAR_ACTION_LOWER.c_str (),
-								 testing_values::TITLEBAR_ACTION_SHADE.c_str ()), GBooleanTrue ());
+								 testing_values::TITLEBAR_ACTION_SHADE.c_str ()), IsTrue ());
 }
 
 class GWDMockSettingsTest :
@@ -604,7 +596,7 @@
 {
     gwd_settings_writable_freeze_updates (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()));
     EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-							     testing_values::USE_TOOLTIPS_VALUE), GBooleanTrue ());
+							     testing_values::USE_TOOLTIPS_VALUE), IsTrue ());
 }
 
 /* We're just using use_tooltips here as an example */
@@ -612,7 +604,7 @@
 {
     gwd_settings_writable_freeze_updates (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()));
     EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-							     testing_values::USE_TOOLTIPS_VALUE), GBooleanTrue ());
+							     testing_values::USE_TOOLTIPS_VALUE), IsTrue ());
 
     EXPECT_CALL (*mGMockNotified, updateDecorations ());
     gwd_settings_writable_thaw_updates (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()));
@@ -623,11 +615,11 @@
 {
     gwd_settings_writable_freeze_updates (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()));
     EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-							     testing_values::USE_TOOLTIPS_VALUE), GBooleanTrue ());
-    EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-							     !testing_values::USE_TOOLTIPS_VALUE), GBooleanTrue ());
-    EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-							     testing_values::USE_TOOLTIPS_VALUE), GBooleanTrue ());
+							     testing_values::USE_TOOLTIPS_VALUE), IsTrue ());
+    EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
+							     !testing_values::USE_TOOLTIPS_VALUE), IsTrue ());
+    EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
+							     testing_values::USE_TOOLTIPS_VALUE), IsTrue ());
 
     EXPECT_CALL (*mGMockNotified, updateDecorations ()).Times (1);
     gwd_settings_writable_thaw_updates (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()));
@@ -646,7 +638,7 @@
 								testing_values::INACTIVE_SHADOW_RADIUS_VALUE,
 								testing_values::INACTIVE_SHADOW_OFFSET_X_VALUE,
 								testing_values::INACTIVE_SHADOW_OFFSET_Y_VALUE,
-								testing_values::INACTIVE_SHADOW_COLOR_STR_VALUE.c_str ()), GBooleanTrue ());
+								testing_values::INACTIVE_SHADOW_COLOR_STR_VALUE.c_str ()), IsTrue ());
 
     AutoUnsetGValue activeShadowValue (G_TYPE_POINTER);
     AutoUnsetGValue inactiveShadowValue (G_TYPE_POINTER);
@@ -700,14 +692,14 @@
 								INACTIVE_SHADOW_OPACITY_DEFAULT,
 								INACTIVE_SHADOW_OFFSET_X_DEFAULT,
 								INACTIVE_SHADOW_OFFSET_Y_DEFAULT,
-								INACTIVE_SHADOW_COLOR_DEFAULT), GBooleanFalse ());
+								INACTIVE_SHADOW_COLOR_DEFAULT), IsFalse ());
 }
 
 TEST_F(GWDSettingsTest, TestUseTooltipsChanged)
 {
     EXPECT_CALL (*mGMockNotified, updateDecorations ());
     EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-							     testing_values::USE_TOOLTIPS_VALUE), GBooleanTrue ());
+							     testing_values::USE_TOOLTIPS_VALUE), IsTrue ());
 
     AutoUnsetGValue useTooltipsValue (G_TYPE_BOOLEAN);
     GValue &useTooltipsGValue = useTooltipsValue;
@@ -723,14 +715,14 @@
 TEST_F(GWDSettingsTest, TestUseTooltipsChangedIsDefault)
 {
     EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-							     USE_TOOLTIPS_DEFAULT), GBooleanFalse ());
+							     USE_TOOLTIPS_DEFAULT), IsFalse ());
 }
 
 TEST_F(GWDSettingsTest, TestDraggableBorderWidthChanged)
 {
     EXPECT_CALL (*mGMockNotified, updateDecorations ());
     EXPECT_THAT (gwd_settings_writable_draggable_border_width_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-								       testing_values::DRAGGABLE_BORDER_WIDTH_VALUE), GBooleanTrue ());
+								       testing_values::DRAGGABLE_BORDER_WIDTH_VALUE), IsTrue ());
 
     AutoUnsetGValue draggableBorderWidthValue (G_TYPE_INT);
     GValue &draggableBorderWidthGValue = draggableBorderWidthValue;
@@ -746,14 +738,14 @@
 TEST_F(GWDSettingsTest, TestDraggableBorderWidthChangedIsDefault)
 {
     EXPECT_THAT (gwd_settings_writable_draggable_border_width_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-								       DRAGGABLE_BORDER_WIDTH_DEFAULT), GBooleanFalse ());
+								       DRAGGABLE_BORDER_WIDTH_DEFAULT), IsFalse ());
 }
 
 TEST_F(GWDSettingsTest, TestAttachModalDialogsChanged)
 {
     EXPECT_CALL (*mGMockNotified, updateDecorations ());
     EXPECT_THAT (gwd_settings_writable_attach_modal_dialogs_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-								     testing_values::ATTACH_MODAL_DIALOGS_VALUE), GBooleanTrue ());
+								     testing_values::ATTACH_MODAL_DIALOGS_VALUE), IsTrue ());
 
     AutoUnsetGValue attachModalDialogsValue (G_TYPE_BOOLEAN);
     GValue &attachModalDialogsGValue = attachModalDialogsValue;
@@ -769,14 +761,14 @@
 TEST_F(GWDSettingsTest, TestAttachModalDialogsChangedIsDefault)
 {
     EXPECT_THAT (gwd_settings_writable_attach_modal_dialogs_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-								     ATTACH_MODAL_DIALOGS_DEFAULT), GBooleanFalse ());
+								     ATTACH_MODAL_DIALOGS_DEFAULT), IsFalse ());
 }
 
 TEST_F(GWDSettingsTest, TestBlurChangedTitlebar)
 {
     EXPECT_CALL (*mGMockNotified, updateDecorations ());
     EXPECT_THAT (gwd_settings_writable_blur_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-						     testing_values::BLUR_TYPE_TITLEBAR_VALUE.c_str ()), GBooleanTrue ());
+						     testing_values::BLUR_TYPE_TITLEBAR_VALUE.c_str ()), IsTrue ());
 
     AutoUnsetGValue blurValue (G_TYPE_INT);
     GValue &blurGValue = blurValue;
@@ -793,7 +785,7 @@
 {
     EXPECT_CALL (*mGMockNotified, updateDecorations ());
     EXPECT_THAT (gwd_settings_writable_blur_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-						     testing_values::BLUR_TYPE_ALL_VALUE.c_str ()), GBooleanTrue ());
+						     testing_values::BLUR_TYPE_ALL_VALUE.c_str ()), IsTrue ());
 
     AutoUnsetGValue blurValue (G_TYPE_INT);
     GValue &blurGValue = blurValue;
@@ -809,7 +801,7 @@
 TEST_F(GWDSettingsTest, TestBlurChangedNone)
 {
     EXPECT_THAT (gwd_settings_writable_blur_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-						     testing_values::BLUR_TYPE_NONE_VALUE.c_str ()), GBooleanFalse ());
+						     testing_values::BLUR_TYPE_NONE_VALUE.c_str ()), IsFalse ());
 
     AutoUnsetGValue blurValue (G_TYPE_INT);
     GValue &blurGValue = blurValue;
@@ -835,7 +827,7 @@
 		     boost::bind (gwd_settings_unref, _1));
 
     EXPECT_THAT (gwd_settings_writable_blur_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-						     testing_values::BLUR_TYPE_NONE_VALUE.c_str ()), GBooleanFalse ());
+						     testing_values::BLUR_TYPE_NONE_VALUE.c_str ()), IsFalse ());
 
     AutoUnsetGValue blurValue (G_TYPE_INT);
     GValue &blurGValue = blurValue;
@@ -854,7 +846,7 @@
     EXPECT_CALL (*mGMockNotified, updateDecorations ());
     EXPECT_THAT (gwd_settings_writable_metacity_theme_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
 							       testing_values::USE_METACITY_THEME_VALUE,
-							       testing_values::METACITY_THEME_VALUE.c_str ()), GBooleanTrue ());
+							       testing_values::METACITY_THEME_VALUE.c_str ()), IsTrue ());
 
     AutoUnsetGValue metacityThemeValue (G_TYPE_STRING);
     GValue &metacityThemeGValue = metacityThemeValue;
@@ -873,7 +865,7 @@
     EXPECT_CALL (*mGMockNotified, updateDecorations ());
     EXPECT_THAT (gwd_settings_writable_metacity_theme_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
 							       testing_values::NO_USE_METACITY_THEME_VALUE,
-							       testing_values::METACITY_THEME_VALUE.c_str ()), GBooleanTrue ());
+							       testing_values::METACITY_THEME_VALUE.c_str ()), IsTrue ());
 
     AutoUnsetGValue metacityThemeValue (G_TYPE_STRING);
     GValue &metacityThemeGValue = metacityThemeValue;
@@ -890,7 +882,7 @@
 {
     EXPECT_THAT (gwd_settings_writable_metacity_theme_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
 							       testing_values::USE_METACITY_THEME_VALUE,
-							       METACITY_THEME_DEFAULT), GBooleanFalse ());
+							       METACITY_THEME_DEFAULT), IsFalse ());
 }
 
 TEST_F(GWDSettingsTest, TestMetacityThemeSetCommandLine)
@@ -905,7 +897,7 @@
 
     EXPECT_THAT (gwd_settings_writable_metacity_theme_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
 							       testing_values::USE_METACITY_THEME_VALUE,
-							       testing_values::METACITY_THEME_VALUE.c_str ()), GBooleanFalse ());
+							       testing_values::METACITY_THEME_VALUE.c_str ()), IsFalse ());
 
     AutoUnsetGValue metacityThemeValue (G_TYPE_STRING);
     GValue &metacityThemeGValue = metacityThemeValue;
@@ -925,7 +917,7 @@
 							testing_values::ACTIVE_OPACITY_VALUE,
 							testing_values::INACTIVE_OPACITY_VALUE,
 							testing_values::ACTIVE_SHADE_OPACITY_VALUE,
-							testing_values::INACTIVE_SHADE_OPACITY_VALUE), GBooleanTrue ());
+							testing_values::INACTIVE_SHADE_OPACITY_VALUE), IsTrue ());
 
     AutoUnsetGValue metacityInactiveOpacityValue (G_TYPE_DOUBLE);
     AutoUnsetGValue metacityActiveOpacityValue (G_TYPE_DOUBLE);
@@ -966,7 +958,7 @@
 							METACITY_ACTIVE_OPACITY_DEFAULT,
 							METACITY_INACTIVE_OPACITY_DEFAULT,
 							METACITY_ACTIVE_SHADE_OPACITY_DEFAULT,
-							METACITY_INACTIVE_SHADE_OPACITY_DEFAULT), GBooleanFalse ());
+							METACITY_INACTIVE_SHADE_OPACITY_DEFAULT), IsFalse ());
 }
 
 TEST_F(GWDSettingsTest, TestButtonLayoutChanged)
@@ -974,7 +966,7 @@
     EXPECT_CALL (*mGMockNotified, updateMetacityButtonLayout ());
     EXPECT_CALL (*mGMockNotified, updateDecorations ());
     EXPECT_THAT (gwd_settings_writable_button_layout_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-							      testing_values::BUTTON_LAYOUT_VALUE.c_str ()), GBooleanTrue ());
+							      testing_values::BUTTON_LAYOUT_VALUE.c_str ()), IsTrue ());
 
     AutoUnsetGValue buttonLayoutValue (G_TYPE_STRING);
     GValue &buttonLayoutGValue = buttonLayoutValue;
@@ -990,7 +982,7 @@
 TEST_F(GWDSettingsTest, TestButtonLayoutChangedIsDefault)
 {
     EXPECT_THAT (gwd_settings_writable_button_layout_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
-							      METACITY_BUTTON_LAYOUT_DEFAULT), GBooleanFalse ());
+							      METACITY_BUTTON_LAYOUT_DEFAULT), IsFalse ());
 }
 
 TEST_F(GWDSettingsTest, TestTitlebarFontChanged)
@@ -999,7 +991,7 @@
     EXPECT_CALL (*mGMockNotified, updateDecorations ());
     EXPECT_THAT (gwd_settings_writable_font_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
 						     testing_values::NO_USE_SYSTEM_FONT_VALUE,
-						     testing_values::TITLEBAR_FONT_VALUE.c_str ()), GBooleanTrue ());
+						     testing_values::TITLEBAR_FONT_VALUE.c_str ()), IsTrue ());
 
     AutoUnsetGValue fontValue (G_TYPE_STRING);
     GValue	    &fontGValue = fontValue;
@@ -1018,7 +1010,7 @@
     EXPECT_CALL (*mGMockNotified, updateDecorations ());
     EXPECT_THAT (gwd_settings_writable_font_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
 						     testing_values::USE_SYSTEM_FONT_VALUE,
-						     testing_values::TITLEBAR_FONT_VALUE.c_str ()), GBooleanTrue ());
+						     testing_values::TITLEBAR_FONT_VALUE.c_str ()), IsTrue ());
 
     AutoUnsetGValue fontValue (G_TYPE_STRING);
     GValue	    &fontGValue = fontValue;
@@ -1036,7 +1028,7 @@
 {
     EXPECT_THAT (gwd_settings_writable_font_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()),
 						     testing_values::NO_USE_SYSTEM_FONT_VALUE,
-						     TITLEBAR_FONT_DEFAULT), GBooleanFalse ());
+						     TITLEBAR_FONT_DEFAULT), IsFalse ());
 }
 
 namespace
@@ -1071,14 +1063,14 @@
 }
 
 class GWDSettingsTestClickActions :
-    public ::testing::TestWithParam <GWDTitlebarActionInfo>
+    public GWDSettingsTestCommon,
+    public ::testing::WithParamInterface <GWDTitlebarActionInfo>
 {
     public:
 
 	virtual void SetUp ()
 	{
-	    g_setenv ("G_SLICE", "always-malloc", TRUE);
-	    g_type_init ();
+	    GWDSettingsTestCommon::SetUp ();
 	    mGMockNotified.reset (new GWDMockSettingsNotifiedGMock ());
 	    mMockNotified.reset (gwd_mock_settings_notified_new (mGMockNotified.get ()),
 				 boost::bind (gwd_settings_notified_do_nothing, _1));
@@ -1093,7 +1085,7 @@
 	    EXPECT_CALL (*mGMockNotified, dispose ());
 	    EXPECT_CALL (*mGMockNotified, finalize ());
 
-	    g_unsetenv ("G_SLICE");
+	    GWDSettingsTestCommon::TearDown ();
 	}
 
     protected:
@@ -1202,14 +1194,14 @@
 };
 
 class GWDSettingsTestStorageUpdates :
-    public ::testing::TestWithParam <GWDSettingsStorageFactoryWrapperInterface::Ptr>
+    public GWDSettingsTestCommon,
+    public ::testing::WithParamInterface <GWDSettingsStorageFactoryWrapperInterface::Ptr>
 {
     public:
 
 	virtual void SetUp ()
 	{
-	    g_setenv ("G_SLICE", "always-malloc", TRUE);
-	    g_type_init ();
+	    GWDSettingsTestCommon::SetUp ();
 	    mSettingsMock.reset (new GWDMockSettingsWritableGMock ());
 	    mSettings.reset (gwd_mock_settings_writable_new (mSettingsMock.get ()),
 			     boost::bind (gwd_settings_writable_unref, _1));
@@ -1223,7 +1215,7 @@
 	    EXPECT_CALL (*mSettingsMock, finalize ());
 
 	    GetParam ()->TearDown ();
-	    g_unsetenv ("G_SLICE");
+	    GWDSettingsTestCommon::TearDown ();
 	}
 
     protected:
@@ -1490,20 +1482,8 @@
 
 #ifdef USE_GSETTINGS
 class GWDSettingsStorageGSettingsTest :
-    public ::testing::Test
+    public GWDSettingsTestCommon
 {
-    public:
-
-	void SetUp ()
-	{
-	    g_setenv ("G_SLICE", "always-malloc", TRUE);
-	    g_type_init ();
-	}
-
-	void TearDown ()
-	{
-	    g_unsetenv ("G_SLICE");
-	}
 };
 
 TEST_F (GWDSettingsStorageGSettingsTest, TestNoDeathOnConnectingSignalToNULLObject)
@@ -1527,8 +1507,8 @@
 
 	virtual void SetUp (GWDSettingsWritable *writable)
 	{
-	    g_setenv ("GSETTINGS_SCHEMA_DIR", MOCK_PATH.c_str (), true);
-	    g_setenv ("GSETTINGS_BACKEND", "memory", 1);
+	    gsliceEnv.SetUpEnv ();
+	    gsettingsEnv.SetUpEnv (MOCK_PATH);
 
 	    /* We do not need to keep a reference to these */
 	    mGWDSettings = gwd_get_org_compiz_gwd_settings ();
@@ -1635,8 +1615,8 @@
 	    mGWDSettings = NULL;
 	    mMutterSettings = NULL;
 	    mDesktopSettings = NULL;
-	    g_unsetenv ("GSETTINGS_BACKEND");
-	    g_unsetenv ("GSETTINGS_SCHEMA_DIR");
+	    gsettingsEnv.TearDownEnv ();
+	    gsliceEnv.TearDownEnv ();
 	}
 
     private:
@@ -1645,6 +1625,8 @@
 	GSettings			       *mMutterSettings;
 	GSettings			       *mDesktopSettings;
 	boost::shared_ptr <GWDSettingsStorage> mStorage;
+	CompizGLibGSliceOffEnv                 gsliceEnv;
+	CompizGLibGSettingsMemoryBackendTestingEnv gsettingsEnv;
 };
 
 INSTANTIATE_TEST_CASE_P (GSettingsStorageUpdates, GWDSettingsTestStorageUpdates,

=== modified file 'plugins/wall/CMakeLists.txt'
--- plugins/wall/CMakeLists.txt	2012-05-21 06:43:20 +0000
+++ plugins/wall/CMakeLists.txt	2012-09-25 08:42:23 +0000
@@ -3,7 +3,9 @@
 include (CompizPlugin)
 include (CompizDefaults)
 
-add_subdirectory (src/offset_movement)
-include_directories (src/offset_movement/include)
+if (NOT COMPIZ_DISABLE_PLUGIN_WALL)
+    add_subdirectory (src/offset_movement)
+    include_directories (src/offset_movement/include)
+endif (NOT COMPIZ_DISABLE_PLUGIN_WALL)
 
 compiz_plugin (wall PLUGINDEPS composite opengl mousepoll PKGDEPS cairo cairo-xlib-xrender LIBRARIES compiz_wall_offset_movement dl)

=== added directory 'tests/shared/glib'
=== added file 'tests/shared/glib/glib_gsettings_memory_backend_env.h'
--- tests/shared/glib/glib_gsettings_memory_backend_env.h	1970-01-01 00:00:00 +0000
+++ tests/shared/glib/glib_gsettings_memory_backend_env.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,45 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZ_GLIB_GSETTINGS_MEMORY_BACKEND_TEST_ENV_H
+#define _COMPIZ_GLIB_GSETTINGS_MEMORY_BACKEND_TEST_ENV_H
+
+#include <glib.h>
+
+class CompizGLibGSettingsMemoryBackendTestingEnv
+{
+    public:
+
+	virtual void SetUpEnv (const std::string &MOCK_PATH)
+	{
+	    g_setenv ("GSETTINGS_SCHEMA_DIR", MOCK_PATH.c_str (), true);
+	    g_setenv ("GSETTINGS_BACKEND", "memory", 1);
+	}
+
+	virtual void TearDownEnv ()
+	{
+	    g_unsetenv ("GSETTINGS_BACKEND");
+	    g_unsetenv ("GSETTINGS_SCHEMA_DIR");
+	}
+};
+
+#endif

=== added file 'tests/shared/glib/glib_gslice_off_env.h'
--- tests/shared/glib/glib_gslice_off_env.h	1970-01-01 00:00:00 +0000
+++ tests/shared/glib/glib_gslice_off_env.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,43 @@
+/*
+ * Compiz configuration system library
+ *
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZ_GLIB_GSLICE_OFF_ENV_H
+#define _COMPIZ_GLIB_GSLICE_OFF_ENV_H
+
+#include <glib.h>
+
+class CompizGLibGSliceOffEnv
+{
+    public:
+
+	virtual void SetUpEnv ()
+	{
+	    g_setenv ("G_SLICE", "always-malloc", 1);
+	}
+
+	virtual void TearDownEnv ()
+	{
+	    g_unsetenv ("G_SLICE");
+	}
+};
+
+#endif

=== modified file 'tests/shared/gtest_shared_autodestroy.h'
--- tests/shared/gtest_shared_autodestroy.h	2012-08-17 08:33:45 +0000
+++ tests/shared/gtest_shared_autodestroy.h	2012-09-25 08:42:23 +0000
@@ -1,3 +1,23 @@
+/*
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
 #ifndef _COMPIZ_GTEST_SHARED_AUTODESTROY_H
 #define _COMPIZ_GTEST_SHARED_AUTODESTROY_H
 

=== modified file 'tests/shared/gtest_shared_characterwrapper.h'
--- tests/shared/gtest_shared_characterwrapper.h	2012-07-31 13:05:00 +0000
+++ tests/shared/gtest_shared_characterwrapper.h	2012-09-25 08:42:23 +0000
@@ -1,6 +1,27 @@
+/*
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
 #ifndef _COMPIZ_GTEST_SHARED_CHARACTERWRAPPER
 #define _COMPIZ_GTEST_SHARED_CHARACTERWRAPPER
 
+#include <cstdlib>
 #include <boost/noncopyable.hpp>
 
 class CharacterWrapper :

=== added file 'tests/shared/gtest_unspecified_bool_type_matcher.h'
--- tests/shared/gtest_unspecified_bool_type_matcher.h	1970-01-01 00:00:00 +0000
+++ tests/shared/gtest_unspecified_bool_type_matcher.h	2012-09-25 08:42:23 +0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2012 Canonical Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Authored By:
+ * Sam Spilsbury <sam.spilsbury@canonical.com>
+ */
+#ifndef _COMPIZ_GTEST_UNSPECIFIED_BOOL_TYPE_MATCHER_H
+#define _COMPIZ_GTEST_UNSPECIFIED_BOOL_TYPE_MATCHER_H
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+MATCHER (IsTrue, "Is True") { if (arg) return true; else return false; }
+MATCHER (IsFalse, "Is False") { if (!arg) return true; else return false; }
+
+#endif

