andrew@webrtc.org | 19eefdc | 2011-09-14 17:02:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
andrew@webrtc.org | b87cc85 | 2013-03-25 16:23:37 +0000 | [diff] [blame^] | 11 | #include "webrtc/test/test_suite.h" |
andrew@webrtc.org | c1ffd33 | 2013-03-22 17:13:23 +0000 | [diff] [blame] | 12 | |
| 13 | #include "testing/gmock/include/gmock/gmock.h" |
| 14 | #include "testing/gtest/include/gtest/gtest.h" |
andrew@webrtc.org | b87cc85 | 2013-03-25 16:23:37 +0000 | [diff] [blame^] | 15 | #include "webrtc/test/testsupport/fileutils.h" |
| 16 | #include "webrtc/test/testsupport/trace_to_stderr.h" |
andrew@webrtc.org | 19eefdc | 2011-09-14 17:02:44 +0000 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
kjellander@webrtc.org | 20a370e | 2011-11-04 01:19:16 +0000 | [diff] [blame] | 19 | namespace test { |
kjellander@webrtc.org | 83b767b | 2012-10-15 18:14:12 +0000 | [diff] [blame] | 20 | |
andrew@webrtc.org | c1ffd33 | 2013-03-22 17:13:23 +0000 | [diff] [blame] | 21 | TestSuite::TestSuite(int argc, char** argv) |
andrew@webrtc.org | b87cc85 | 2013-03-25 16:23:37 +0000 | [diff] [blame^] | 22 | : trace_to_stderr_(NULL) { |
kjellander@webrtc.org | 193600b | 2012-10-17 04:39:44 +0000 | [diff] [blame] | 23 | SetExecutablePath(argv[0]); |
kjellander@webrtc.org | 20a370e | 2011-11-04 01:19:16 +0000 | [diff] [blame] | 24 | testing::InitGoogleMock(&argc, argv); // Runs InitGoogleTest() internally. |
andrew@webrtc.org | 19eefdc | 2011-09-14 17:02:44 +0000 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | TestSuite::~TestSuite() { |
| 28 | } |
| 29 | |
| 30 | int TestSuite::Run() { |
| 31 | Initialize(); |
| 32 | int result = RUN_ALL_TESTS(); |
| 33 | Shutdown(); |
| 34 | return result; |
| 35 | } |
| 36 | |
| 37 | void TestSuite::Initialize() { |
andrew@webrtc.org | b87cc85 | 2013-03-25 16:23:37 +0000 | [diff] [blame^] | 38 | // Create TraceToStderr here so the behavior can be overridden. |
| 39 | trace_to_stderr_.reset(new TraceToStderr); |
andrew@webrtc.org | 19eefdc | 2011-09-14 17:02:44 +0000 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | void TestSuite::Shutdown() { |
| 43 | } |
andrew@webrtc.org | c1ffd33 | 2013-03-22 17:13:23 +0000 | [diff] [blame] | 44 | |
kjellander@webrtc.org | 20a370e | 2011-11-04 01:19:16 +0000 | [diff] [blame] | 45 | } // namespace test |
andrew@webrtc.org | 19eefdc | 2011-09-14 17:02:44 +0000 | [diff] [blame] | 46 | } // namespace webrtc |