QAR-1651
svn merge -r126784:126785 svn+ssh://svn.lindenlab.com/svn/linden/branches/mock-3 into trunkmaster
parent
a05617a654
commit
c2e425e539
|
|
@ -0,0 +1,27 @@
|
|||
# -*- cmake -*-
|
||||
include(Prebuilt)
|
||||
include(Linking)
|
||||
|
||||
use_prebuilt_binary(googlemock)
|
||||
|
||||
set(GOOGLEMOCK_INCLUDE_DIRS
|
||||
${LIBS_PREBUILT_DIR}/include)
|
||||
|
||||
if (LINUX)
|
||||
set(GOOGLEMOCK_LIBRARIES
|
||||
gmock
|
||||
gtest)
|
||||
elseif(WINDOWS)
|
||||
set(GOOGLEMOCK_LIBRARIES
|
||||
gmock)
|
||||
set(GOOGLEMOCK_INCLUDE_DIRS
|
||||
${LIBS_PREBUILT_DIR}/include
|
||||
${LIBS_PREBUILT_DIR}/include/gmock
|
||||
${LIBS_PREBUILT_DIR}/include/gmock/boost/tr1/tr1)
|
||||
elseif(DARWIN)
|
||||
set(GOOGLEMOCK_LIBRARIES
|
||||
gmock
|
||||
gtest)
|
||||
endif(LINUX)
|
||||
|
||||
|
||||
|
|
@ -13,6 +13,8 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
|
|||
#
|
||||
# WARNING: do NOT modify this code without working with poppy or daveh -
|
||||
# there is another branch that will conflict heavily with any changes here.
|
||||
INCLUDE(GoogleMock)
|
||||
|
||||
|
||||
IF(LL_TEST_VERBOSE)
|
||||
MESSAGE("LL_ADD_PROJECT_UNIT_TESTS UNITTEST_PROJECT_${project} sources: ${sources}")
|
||||
|
|
@ -32,8 +34,10 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
|
|||
${LLMATH_INCLUDE_DIRS}
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
${LIBS_OPEN_DIR}/test
|
||||
${GOOGLEMOCK_INCLUDE_DIRS}
|
||||
)
|
||||
SET(alltest_LIBRARIES
|
||||
${GOOGLEMOCK_LIBRARIES}
|
||||
${PTHREAD_LIBRARY}
|
||||
${WINDOWS_LIBRARIES}
|
||||
)
|
||||
|
|
@ -42,6 +46,11 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
|
|||
${CMAKE_SOURCE_DIR}/test/test.h
|
||||
)
|
||||
|
||||
# Use the default flags
|
||||
if (LINUX)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "")
|
||||
endif (LINUX)
|
||||
|
||||
# start the source test executable definitions
|
||||
SET(${project}_TEST_OUTPUT "")
|
||||
FOREACH (source ${sources})
|
||||
|
|
@ -84,9 +93,9 @@ MACRO(LL_ADD_PROJECT_UNIT_TESTS project sources)
|
|||
MESSAGE("LL_ADD_PROJECT_UNIT_TESTS ${name}_test_additional_INCLUDE_DIRS ${${name}_test_additional_INCLUDE_DIRS}")
|
||||
ENDIF(LL_TEST_VERBOSE)
|
||||
|
||||
|
||||
# Setup target
|
||||
ADD_EXECUTABLE(PROJECT_${project}_TEST_${name} ${${name}_test_SOURCE_FILES})
|
||||
|
||||
#
|
||||
# Per-codefile additional / external project dep and lib dep property extraction
|
||||
#
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* @file
|
||||
* @brief
|
||||
*
|
||||
* $LicenseInfo:firstyear=2008&license=internal$
|
||||
*
|
||||
* Copyright (c) 2008, Linden Research, Inc.
|
||||
*
|
||||
* The following source code is PROPRIETARY AND CONFIDENTIAL. Use of
|
||||
* this source code is governed by the Linden Lab Source Code Disclosure
|
||||
* Agreement ("Agreement") previously entered between you and Linden
|
||||
* Lab. By accessing, using, copying, modifying or distributing this
|
||||
* software, you acknowledge that you have been informed of your
|
||||
* obligations under the Agreement and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
/* Macro Definitions */
|
||||
#ifndef LL_LLMOCKHTTPCLIENT_H
|
||||
#define LL_LLMOCKHTTPCLIENT_H
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llhttpclientinterface.h"
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
class LLMockHTTPClient : public LLHTTPClientInterface
|
||||
{
|
||||
public:
|
||||
MOCK_METHOD2(get, void(const std::string& url, LLCurl::ResponderPtr responder));
|
||||
MOCK_METHOD3(get, void(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers));
|
||||
MOCK_METHOD3(put, void(const std::string& url, const LLSD& body, LLCurl::ResponderPtr responder));
|
||||
};
|
||||
|
||||
// A helper to match responder types
|
||||
template<typename T>
|
||||
struct ResponderType
|
||||
{
|
||||
bool operator()(LLCurl::ResponderPtr ptr) const
|
||||
{
|
||||
T* p = dynamic_cast<T*>(ptr.get());
|
||||
return p != NULL;
|
||||
}
|
||||
};
|
||||
|
||||
inline bool operator==(const LLSD& l, const LLSD& r)
|
||||
{
|
||||
std::ostringstream ls, rs;
|
||||
ls << l;
|
||||
rs << r;
|
||||
return ls.str() == rs.str();
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif //LL_LLMOCKHTTPCLIENT_H
|
||||
|
||||
|
|
@ -14,6 +14,7 @@ include(LScript)
|
|||
include(Linking)
|
||||
include(Tut)
|
||||
include(Boost)
|
||||
include(GoogleMock)
|
||||
|
||||
include_directories(
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
|
|
@ -24,6 +25,7 @@ include_directories(
|
|||
${LLVFS_INCLUDE_DIRS}
|
||||
${LLXML_INCLUDE_DIRS}
|
||||
${LSCRIPT_INCLUDE_DIRS}
|
||||
${GOOGLEMOCK_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(test_SOURCE_FILES
|
||||
|
|
@ -121,6 +123,7 @@ target_link_libraries(test
|
|||
${LLXML_LIBRARIES}
|
||||
${LSCRIPT_LIBRARIES}
|
||||
${LLCOMMON_LIBRARIES}
|
||||
${GOOGLEMOCK_LIBRARIES}
|
||||
${APRICONV_LIBRARIES}
|
||||
${PTHREAD_LIBRARY}
|
||||
${WINDOWS_LIBRARIES}
|
||||
|
|
@ -137,12 +140,18 @@ endif (WINDOWS)
|
|||
|
||||
get_target_property(TEST_EXE test LOCATION)
|
||||
|
||||
SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
SET(TEST_LD_CMD
|
||||
${CMAKE_COMMAND}
|
||||
-DLD_LIBRARY_PATH=${ARCH_PREBUILT_DIRS}:/usr/lib
|
||||
-DTEST_CMD:STRING="${TEST_CMD}"
|
||||
-P ${CMAKE_SOURCE_DIR}/cmake/RunBuildTest.cmake
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
|
||||
COMMAND ${TEST_EXE}
|
||||
ARGS
|
||||
--output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt
|
||||
--touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
|
||||
COMMAND ${TEST_LD_CMD}
|
||||
DEPENDS test
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
COMMENT "C++ unit tests"
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@
|
|||
# include "ctype_workaround.h"
|
||||
#endif
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace tut
|
||||
{
|
||||
std::string sSourceDir;
|
||||
|
|
@ -238,6 +241,9 @@ void wouldHaveCrashed(const std::string& message)
|
|||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// The following line must be executed to initialize Google Mock
|
||||
// (and Google Test) before running the tests.
|
||||
::testing::InitGoogleMock(&argc, argv);
|
||||
LLError::initForApplication(".");
|
||||
LLError::setFatalFunction(wouldHaveCrashed);
|
||||
LLError::setDefaultLevel(LLError::LEVEL_ERROR);
|
||||
|
|
|
|||
33
install.xml
33
install.xml
|
|
@ -541,6 +541,39 @@
|
|||
</map>
|
||||
</map>
|
||||
</map>
|
||||
<key>googlemock</key>
|
||||
<map>
|
||||
<key>copyright</key>
|
||||
<string>Copyright 2008, Google Inc.</string>
|
||||
<key>description</key>
|
||||
<string>Google C++ Mocking Framework (or Google Mock for short) is a library for writing and using C++ mock classes.</string>
|
||||
<key>license</key>
|
||||
<string>bsd</string>
|
||||
<key>packages</key>
|
||||
<map>
|
||||
<key>darwin</key>
|
||||
<map>
|
||||
<key>md5sum</key>
|
||||
<string>4863e9fea433d0a4be761ea5d3e8346a</string>
|
||||
<key>url</key>
|
||||
<uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/googlemock-1.1.0-darwin-20090626.tar.bz2</uri>
|
||||
</map>
|
||||
<key>linux</key>
|
||||
<map>
|
||||
<key>md5sum</key>
|
||||
<string>877dabecf84339690191c6115c76366e</string>
|
||||
<key>url</key>
|
||||
<uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/googlemock-1.1.0-linux32-20090527.tar.bz2</uri>
|
||||
</map>
|
||||
<key>windows</key>
|
||||
<map>
|
||||
<key>md5sum</key>
|
||||
<string>be37695d9f26552aec81c8e97ded0212</string>
|
||||
<key>url</key>
|
||||
<uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/googlemock-1.1.0-windows-20090529.tar.bz2</uri>
|
||||
</map>
|
||||
</map>
|
||||
</map>
|
||||
<key>gstreamer</key>
|
||||
<map>
|
||||
<key>license</key>
|
||||
|
|
|
|||
Loading…
Reference in New Issue