OLD | NEW |
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 #ifndef skiatest_Test_DEFINED | 8 #ifndef skiatest_Test_DEFINED |
9 #define skiatest_Test_DEFINED | 9 #define skiatest_Test_DEFINED |
10 | 10 |
11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
12 #include "SkString.h" | 12 #include "SkString.h" |
13 #include "SkTRegistry.h" | 13 #include "SkTRegistry.h" |
14 #include "SkThread.h" | 14 #include "SkThread.h" |
| 15 #include "SkTypes.h" |
15 | 16 |
16 class GrContextFactory; | 17 class GrContextFactory; |
17 | 18 |
18 namespace skiatest { | 19 namespace skiatest { |
19 | 20 |
20 class Test; | 21 class Test; |
21 | 22 |
22 class Reporter : public SkRefCnt { | 23 class Reporter : public SkRefCnt { |
23 public: | 24 public: |
24 SK_DECLARE_INST_COUNT(Reporter) | 25 SK_DECLARE_INST_COUNT(Reporter) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 public: | 64 public: |
64 Test(); | 65 Test(); |
65 virtual ~Test(); | 66 virtual ~Test(); |
66 | 67 |
67 Reporter* getReporter() const { return fReporter; } | 68 Reporter* getReporter() const { return fReporter; } |
68 void setReporter(Reporter*); | 69 void setReporter(Reporter*); |
69 | 70 |
70 const char* getName(); | 71 const char* getName(); |
71 void run(); | 72 void run(); |
72 bool passed() const { return fPassed; } | 73 bool passed() const { return fPassed; } |
| 74 SkMSec elapsedMs() const { return fElapsed; } |
73 | 75 |
74 static const SkString& GetTmpDir(); | 76 static const SkString& GetTmpDir(); |
75 | 77 |
76 static const SkString& GetResourcePath(); | 78 static const SkString& GetResourcePath(); |
77 | 79 |
78 virtual bool isThreadsafe() const { return true; } | 80 virtual bool isThreadsafe() const { return true; } |
79 | 81 |
80 protected: | 82 protected: |
81 virtual void onGetName(SkString*) = 0; | 83 virtual void onGetName(SkString*) = 0; |
82 virtual void onRun(Reporter*) = 0; | 84 virtual void onRun(Reporter*) = 0; |
83 | 85 |
84 private: | 86 private: |
85 Reporter* fReporter; | 87 Reporter* fReporter; |
86 SkString fName; | 88 SkString fName; |
87 bool fPassed; | 89 bool fPassed; |
| 90 SkMSec fElapsed; |
88 }; | 91 }; |
89 | 92 |
90 class GpuTest : public Test{ | 93 class GpuTest : public Test{ |
91 public: | 94 public: |
92 GpuTest() : Test() {} | 95 GpuTest() : Test() {} |
93 static GrContextFactory* GetGrContextFactory(); | 96 static GrContextFactory* GetGrContextFactory(); |
94 static void DestroyContexts(); | 97 static void DestroyContexts(); |
95 virtual bool isThreadsafe() const { return false; } | 98 virtual bool isThreadsafe() const { return false; } |
96 private: | 99 private: |
97 }; | 100 }; |
(...skipping 14 matching lines...) Expand all Loading... |
112 do { \ | 115 do { \ |
113 if (!(cond)) { \ | 116 if (!(cond)) { \ |
114 SkString desc; \ | 117 SkString desc; \ |
115 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \ | 118 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \ |
116 r->reportFailed(desc); \ | 119 r->reportFailed(desc); \ |
117 } \ | 120 } \ |
118 } while(0) | 121 } while(0) |
119 | 122 |
120 | 123 |
121 #endif | 124 #endif |
OLD | NEW |