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

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

Issue 19790011: Fix a defect on a test runner for ppapi tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a build error Created 7 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 test_to_run_(test_to_run), 180 test_to_run_(test_to_run),
181 loop_(loop) { 181 loop_(loop) {
182 } 182 }
183 const std::string& result() { return result_; } 183 const std::string& result() { return result_; }
184 static void ThreadFunction(void* runner) { 184 static void ThreadFunction(void* runner) {
185 static_cast<ThreadedTestRunner<T>*>(runner)->Run(); 185 static_cast<ThreadedTestRunner<T>*>(runner)->Run();
186 } 186 }
187 187
188 private: 188 private:
189 void Run() { 189 void Run() {
190 PP_DCHECK(PP_OK == loop_.AttachToCurrentThread()); 190 int32_t result = loop_.AttachToCurrentThread();
191 static_cast<void>(result); // result is not used in the RELEASE build.
192 PP_DCHECK(PP_OK == result);
191 result_ = (test_case_->*test_to_run_)(); 193 result_ = (test_case_->*test_to_run_)();
192 // Now give the loop a chance to clean up. 194 // Now give the loop a chance to clean up.
193 loop_.PostQuit(true /* should_destroy */); 195 loop_.PostQuit(true /* should_destroy */);
194 loop_.Run(); 196 loop_.Run();
195 // Tell the main thread to quit its nested message loop, now that the test 197 // Tell the main thread to quit its nested message loop, now that the test
196 // is complete. 198 // is complete.
197 TestCase::QuitMainMessageLoop(instance_); 199 TestCase::QuitMainMessageLoop(instance_);
198 } 200 }
199 201
200 std::string result_; 202 std::string result_;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 #define ASSERT_SUBTEST_SUCCESS(function) \ 384 #define ASSERT_SUBTEST_SUCCESS(function) \
383 do { \ 385 do { \
384 std::string result = (function); \ 386 std::string result = (function); \
385 if (!result.empty()) \ 387 if (!result.empty()) \
386 return result; \ 388 return result; \
387 } while (false) 389 } while (false)
388 390
389 #define PASS() return std::string() 391 #define PASS() return std::string()
390 392
391 #endif // PPAPI_TESTS_TEST_CASE_H_ 393 #endif // PPAPI_TESTS_TEST_CASE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698