Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: ppapi/tests/test_case.h

Issue 21833005: Fix PPAPI TestCase so individual tests can be run more than once. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Robustify. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ppapi/tests/test_case.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_TESTS_TEST_CASE_H_ 5 #ifndef PPAPI_TESTS_TEST_CASE_H_
6 #define PPAPI_TESTS_TEST_CASE_H_ 6 #define PPAPI_TESTS_TEST_CASE_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 static void DoQuitMainMessageLoop(void* pp_instance, int32_t result); 218 static void DoQuitMainMessageLoop(void* pp_instance, int32_t result);
219 219
220 // Passed when creating completion callbacks in some tests. This determines 220 // Passed when creating completion callbacks in some tests. This determines
221 // what kind of callback we use for the test. 221 // what kind of callback we use for the test.
222 CallbackType callback_type_; 222 CallbackType callback_type_;
223 223
224 // Var ids that should be ignored when checking for leaks on shutdown. 224 // Var ids that should be ignored when checking for leaks on shutdown.
225 std::set<int64_t> ignored_leaked_vars_; 225 std::set<int64_t> ignored_leaked_vars_;
226 226
227 // The tests that were found in test_filter but have not yet been run. The 227 // The tests that were found in test_filter. The bool indicates whether the
228 // bool indicates whether the test should be run (i.e., it will be false if 228 // test should be run (i.e., it will be false if the test name was prefixed in
229 // the test name was prefixed in the test_filter string). 229 // the test_filter string).
230 // 230 //
231 // This is initialized lazily the first time that ShouldRunTest is called by 231 // This is initialized lazily the first time that ShouldRunTest is called.
232 // RunTests. When RunTests is finished, this should be empty. Any remaining 232 std::map<std::string, bool> filter_tests_;
233 // tests are tests that were listed in the test_filter but didn't match 233 // Flag indicating whether we have populated filter_tests_ yet.
234 // any calls to ShouldRunTest, meaning it was probably a typo. TestingInstance 234 bool have_populated_filter_tests_;
235 // should log this and consider it a failure. 235 // This is initialized with the contents of filter_tests_. As each test is
236 // run, it is removed from remaining_tests_. When RunTests is finished,
237 // remaining_tests_ should be empty. Any remaining tests are tests that were
238 // listed in the test_filter but didn't match any calls to ShouldRunTest,
239 // meaning it was probably a typo. TestingInstance should log this and
240 // consider it a failure.
236 std::map<std::string, bool> remaining_tests_; 241 std::map<std::string, bool> remaining_tests_;
237 // Flag indicating whether we have populated remaining_tests_ yet.
238 bool have_populated_remaining_tests_;
239 242
240 // If ShouldRunTest is called but the given test name doesn't match anything 243 // If ShouldRunTest is called but the given test name doesn't match anything
241 // in the test_filter, the test name will be added here. This allows 244 // in the test_filter, the test name will be added here. This allows
242 // TestingInstance to detect when not all tests were listed. 245 // TestingInstance to detect when not all tests were listed.
243 std::set<std::string> skipped_tests_; 246 std::set<std::string> skipped_tests_;
244 247
245 #if !(defined __native_client__) 248 #if !(defined __native_client__)
246 // Holds the test object, if any was retrieved from CreateTestObject. 249 // Holds the test object, if any was retrieved from CreateTestObject.
247 pp::VarPrivate test_object_; 250 pp::VarPrivate test_object_;
248 #endif 251 #endif
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 #define ASSERT_SUBTEST_SUCCESS(function) \ 387 #define ASSERT_SUBTEST_SUCCESS(function) \
385 do { \ 388 do { \
386 std::string result = (function); \ 389 std::string result = (function); \
387 if (!result.empty()) \ 390 if (!result.empty()) \
388 return result; \ 391 return result; \
389 } while (false) 392 } while (false)
390 393
391 #define PASS() return std::string() 394 #define PASS() return std::string()
392 395
393 #endif // PPAPI_TESTS_TEST_CASE_H_ 396 #endif // PPAPI_TESTS_TEST_CASE_H_
OLDNEW
« no previous file with comments | « no previous file | ppapi/tests/test_case.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698