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

Side by Side Diff: tests/UtilsTest.cpp

Issue 98703002: Fix compilation with SK_ENABLE_INST_COUNT=1 (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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/Test.cpp ('k') | 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 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Test.h" 8 #include "Test.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 #include "SkRefCnt.h" 10 #include "SkRefCnt.h"
11 #include "SkTSearch.h" 11 #include "SkTSearch.h"
12 #include "SkTSort.h" 12 #include "SkTSort.h"
13 #include "SkUtils.h" 13 #include "SkUtils.h"
14 14
15 class RefClass : public SkRefCnt { 15 class RefClass : public SkRefCnt {
16 public: 16 public:
17 SK_DECLARE_INST_COUNT(RefClass) 17 SK_DECLARE_INST_COUNT(RefClass)
18 18
19 RefClass(int n) : fN(n) {} 19 RefClass(int n) : fN(n) {}
20 int get() const { return fN; } 20 int get() const { return fN; }
21 21
22 private: 22 private:
23 int fN; 23 int fN;
24 24
25 typedef SkRefCnt INHERITED; 25 typedef SkRefCnt INHERITED;
26 }; 26 };
27 27
28 SK_DEFINE_INST_COUNT(RefClass)
29
30 static void test_autounref(skiatest::Reporter* reporter) { 28 static void test_autounref(skiatest::Reporter* reporter) {
31 RefClass obj(0); 29 RefClass obj(0);
32 REPORTER_ASSERT(reporter, 1 == obj.getRefCnt()); 30 REPORTER_ASSERT(reporter, 1 == obj.getRefCnt());
33 31
34 SkAutoTUnref<RefClass> tmp(&obj); 32 SkAutoTUnref<RefClass> tmp(&obj);
35 REPORTER_ASSERT(reporter, &obj == tmp.get()); 33 REPORTER_ASSERT(reporter, &obj == tmp.get());
36 REPORTER_ASSERT(reporter, 1 == obj.getRefCnt()); 34 REPORTER_ASSERT(reporter, 1 == obj.getRefCnt());
37 35
38 REPORTER_ASSERT(reporter, &obj == tmp.detach()); 36 REPORTER_ASSERT(reporter, &obj == tmp.detach());
39 REPORTER_ASSERT(reporter, 1 == obj.getRefCnt()); 37 REPORTER_ASSERT(reporter, 1 == obj.getRefCnt());
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 215 }
218 216
219 test_utf16(reporter); 217 test_utf16(reporter);
220 test_search(reporter); 218 test_search(reporter);
221 test_autounref(reporter); 219 test_autounref(reporter);
222 test_autostarray(reporter); 220 test_autostarray(reporter);
223 } 221 }
224 222
225 #include "TestClassDef.h" 223 #include "TestClassDef.h"
226 DEFINE_TESTCLASS("Utils", UtfTestClass, TestUTF) 224 DEFINE_TESTCLASS("Utils", UtfTestClass, TestUTF)
OLDNEW
« no previous file with comments | « tests/Test.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698