Changing the namespace of TestSuite to webrtc::test.

Adding gmock initialization into main test runner class

Review URL: http://webrtc-codereview.appspot.com/254004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@885 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kjellander@webrtc.org 2011-11-04 01:19:16 +00:00
parent 1a8d08ad76
commit 20a370e875
8 changed files with 13 additions and 27 deletions

View File

@ -20,13 +20,12 @@
'target_name': 'common_audio_unittests', 'target_name': 'common_audio_unittests',
'type': 'executable', 'type': 'executable',
'dependencies': [ 'dependencies': [
'<(webrtc_root)/../test/test.gyp:test_support', '<(webrtc_root)/../test/test.gyp:test_support_main',
'<(webrtc_root)/../testing/gtest.gyp:gtest', '<(webrtc_root)/../testing/gtest.gyp:gtest',
'resampler', 'resampler',
'vad', 'vad',
], ],
'sources': [ 'sources': [
'<(webrtc_root)/../test/run_all_unittests.cc',
'resampler/main/source/resampler_unittest.cc', 'resampler/main/source/resampler_unittest.cc',
'vad/test/vad_unittest.cc', 'vad/test/vad_unittest.cc',
], ],

View File

@ -1,17 +0,0 @@
/*
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "gmock/gmock.h"
#include "test/test_suite.h"
int main(int argc, char** argv) {
::testing::InitGoogleMock(&argc, argv);
webrtc::TestSuite test_suite(argc, argv);
return test_suite.Run();
}

View File

@ -55,12 +55,12 @@
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers', '<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
'<(webrtc_root)/common_video/common_video.gyp:webrtc_vplib', '<(webrtc_root)/common_video/common_video.gyp:webrtc_vplib',
'<(webrtc_root)/../testing/gmock.gyp:gmock', '<(webrtc_root)/../testing/gmock.gyp:gmock',
'<(webrtc_root)/../test/test.gyp:test_support', '<(webrtc_root)/../test/test.gyp:test_support_main',
], ],
'include_dirs': [ 'include_dirs': [
'<(webrtc_root)/common_video/interface', '<(webrtc_root)/common_video/interface',
], ],
'sources': [ 'sources': [
# header files # header files
'mocks.h', 'mocks.h',
@ -68,8 +68,6 @@
'file_handler_unittest.cc', 'file_handler_unittest.cc',
'packet_manipulator_unittest.cc', 'packet_manipulator_unittest.cc',
'packet_reader_unittest.cc', 'packet_reader_unittest.cc',
# cannot use the global run all file until it supports gmock:
'run_all_unittests.cc',
'stats_unittest.cc', 'stats_unittest.cc',
'videoprocessor_unittest.cc', 'videoprocessor_unittest.cc',
], ],

View File

@ -11,6 +11,6 @@
#include "test/test_suite.h" #include "test/test_suite.h"
int main(int argc, char** argv) { int main(int argc, char** argv) {
webrtc::TestSuite test_suite(argc, argv); webrtc::test::TestSuite test_suite(argc, argv);
return test_suite.Run(); return test_suite.Run();
} }

View File

@ -17,6 +17,7 @@
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'dependencies': [
'<(webrtc_root)/../testing/gtest.gyp:gtest', '<(webrtc_root)/../testing/gtest.gyp:gtest',
'<(webrtc_root)/../testing/gmock.gyp:gmock',
], ],
'all_dependent_settings': { 'all_dependent_settings': {
'include_dirs': [ 'include_dirs': [

View File

@ -10,11 +10,13 @@
#include "test/test_suite.h" #include "test/test_suite.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
namespace webrtc { namespace webrtc {
namespace test {
TestSuite::TestSuite(int argc, char** argv) { TestSuite::TestSuite(int argc, char** argv) {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleMock(&argc, argv); // Runs InitGoogleTest() internally.
} }
TestSuite::~TestSuite() { TestSuite::~TestSuite() {
@ -33,4 +35,5 @@ void TestSuite::Initialize() {
void TestSuite::Shutdown() { void TestSuite::Shutdown() {
} }
} // namespace test
} // namespace webrtc } // namespace webrtc

View File

@ -20,6 +20,7 @@
#include "src/system_wrappers/interface/constructor_magic.h" #include "src/system_wrappers/interface/constructor_magic.h"
namespace webrtc { namespace webrtc {
namespace test {
class TestSuite { class TestSuite {
public: public:
TestSuite(int argc, char** argv); TestSuite(int argc, char** argv);
@ -35,6 +36,7 @@ class TestSuite {
DISALLOW_COPY_AND_ASSIGN(TestSuite); DISALLOW_COPY_AND_ASSIGN(TestSuite);
}; };
} // namespace test
} // namespace webrtc } // namespace webrtc
#endif // TEST_TEST_SUITE_H_ #endif // TEST_TEST_SUITE_H_

View File

@ -19,7 +19,7 @@
// //
// Example use: // Example use:
// Assume we have the following code being used in a test source file: // Assume we have the following code being used in a test source file:
// const std::string kInputFile = webrtc::testing::GetProjectRootPath() + // const std::string kInputFile = webrtc::test::GetProjectRootPath() +
// "test/data/voice_engine/audio_long16.wav"; // "test/data/voice_engine/audio_long16.wav";
// // Use the kInputFile for the tests... // // Use the kInputFile for the tests...
// //