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

Side by Side Diff: tests/OnceTest.cpp

Issue 138563004: Move macros from TestClassDef.h to Test.h (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: upload Created 6 years, 11 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 | « tests/OSPathTest.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkOnce.h" 8 #include "SkOnce.h"
9 #include "SkThreadPool.h" 9 #include "SkThreadPool.h"
10 #include "Test.h" 10 #include "Test.h"
11 #include "TestClassDef.h"
12 11
13 static void add_five(int* x) { 12 static void add_five(int* x) {
14 *x += 5; 13 *x += 5;
15 } 14 }
16 15
17 DEF_TEST(SkOnce_Singlethreaded, r) { 16 DEF_TEST(SkOnce_Singlethreaded, r) {
18 int x = 0; 17 int x = 0;
19 18
20 SK_DECLARE_STATIC_ONCE(once); 19 SK_DECLARE_STATIC_ONCE(once);
21 // No matter how many times we do this, x will be 5. 20 // No matter how many times we do this, x will be 5.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // Let them race. 70 // Let them race.
72 SkThreadPool pool(kThreads); 71 SkThreadPool pool(kThreads);
73 for (int i = 0; i < kTasks; i++) { 72 for (int i = 0; i < kTasks; i++) {
74 pool.add(&racers[i]); 73 pool.add(&racers[i]);
75 } 74 }
76 pool.wait(); 75 pool.wait();
77 76
78 // Only one should have done the +=. 77 // Only one should have done the +=.
79 REPORTER_ASSERT(r, 6 == x); 78 REPORTER_ASSERT(r, 6 == x);
80 } 79 }
OLDNEW
« no previous file with comments | « tests/OSPathTest.cpp ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698