201 {
202 std::vector<std::string> events;
205
206 UnitTest::GetInstance()->listeners().Append(
207 new EventRecordingListener("1st"));
208 UnitTest::GetInstance()->listeners().Append(
209 new EventRecordingListener("2nd"));
210
212
214 << "AddGlobalTestEnvironment should not generate any events itself.";
215
216 ::testing::GTEST_FLAG(repeat) = 2;
218
219 const char* const expected_events[] = {
220 "1st.OnTestProgramStart",
221 "2nd.OnTestProgramStart",
222 "1st.OnTestIterationStart(0)",
223 "2nd.OnTestIterationStart(0)",
224 "1st.OnEnvironmentsSetUpStart",
225 "2nd.OnEnvironmentsSetUpStart",
226 "Environment::SetUp",
227 "2nd.OnEnvironmentsSetUpEnd",
228 "1st.OnEnvironmentsSetUpEnd",
229 "1st.OnTestCaseStart",
230 "2nd.OnTestCaseStart",
231 "ListenerTest::SetUpTestCase",
232 "1st.OnTestStart",
233 "2nd.OnTestStart",
234 "ListenerTest::SetUp",
235 "ListenerTest::* Test Body",
236 "1st.OnTestPartResult",
237 "2nd.OnTestPartResult",
238 "ListenerTest::TearDown",
239 "2nd.OnTestEnd",
240 "1st.OnTestEnd",
241 "1st.OnTestStart",
242 "2nd.OnTestStart",
243 "ListenerTest::SetUp",
244 "ListenerTest::* Test Body",
245 "1st.OnTestPartResult",
246 "2nd.OnTestPartResult",
247 "ListenerTest::TearDown",
248 "2nd.OnTestEnd",
249 "1st.OnTestEnd",
250 "ListenerTest::TearDownTestCase",
251 "2nd.OnTestCaseEnd",
252 "1st.OnTestCaseEnd",
253 "1st.OnEnvironmentsTearDownStart",
254 "2nd.OnEnvironmentsTearDownStart",
255 "Environment::TearDown",
256 "2nd.OnEnvironmentsTearDownEnd",
257 "1st.OnEnvironmentsTearDownEnd",
258 "2nd.OnTestIterationEnd(0)",
259 "1st.OnTestIterationEnd(0)",
260 "1st.OnTestIterationStart(1)",
261 "2nd.OnTestIterationStart(1)",
262 "1st.OnEnvironmentsSetUpStart",
263 "2nd.OnEnvironmentsSetUpStart",
264 "Environment::SetUp",
265 "2nd.OnEnvironmentsSetUpEnd",
266 "1st.OnEnvironmentsSetUpEnd",
267 "1st.OnTestCaseStart",
268 "2nd.OnTestCaseStart",
269 "ListenerTest::SetUpTestCase",
270 "1st.OnTestStart",
271 "2nd.OnTestStart",
272 "ListenerTest::SetUp",
273 "ListenerTest::* Test Body",
274 "1st.OnTestPartResult",
275 "2nd.OnTestPartResult",
276 "ListenerTest::TearDown",
277 "2nd.OnTestEnd",
278 "1st.OnTestEnd",
279 "1st.OnTestStart",
280 "2nd.OnTestStart",
281 "ListenerTest::SetUp",
282 "ListenerTest::* Test Body",
283 "1st.OnTestPartResult",
284 "2nd.OnTestPartResult",
285 "ListenerTest::TearDown",
286 "2nd.OnTestEnd",
287 "1st.OnTestEnd",
288 "ListenerTest::TearDownTestCase",
289 "2nd.OnTestCaseEnd",
290 "1st.OnTestCaseEnd",
291 "1st.OnEnvironmentsTearDownStart",
292 "2nd.OnEnvironmentsTearDownStart",
293 "Environment::TearDown",
294 "2nd.OnEnvironmentsTearDownEnd",
295 "1st.OnEnvironmentsTearDownEnd",
296 "2nd.OnTestIterationEnd(1)",
297 "1st.OnTestIterationEnd(1)",
298 "2nd.OnTestProgramEnd",
299 "1st.OnTestProgramEnd"
300 };
302 expected_events,
303 sizeof(expected_events)/sizeof(expected_events[0]));
304
305
306
307 if (UnitTest::GetInstance()->Failed())
308 ret_val = 1;
309
310 return ret_val;
311}
std::vector< std::string > * g_events
void VerifyResults(const std::vector< std::string > &data, const char *const *expected_data, size_t expected_data_size)
#define GTEST_CHECK_(condition)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Environment * AddGlobalTestEnvironment(Environment *env)
GTEST_API_ void InitGoogleTest(int *argc, char **argv)