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 #include "Test.h" | 8 #include "Test.h" |
9 | 9 |
| 10 #include "SkCommandLineFlags.h" |
10 #include "SkError.h" | 11 #include "SkError.h" |
11 #include "SkString.h" | 12 #include "SkString.h" |
12 #include "SkTArray.h" | 13 #include "SkTArray.h" |
13 #include "SkTime.h" | 14 #include "SkTime.h" |
14 | 15 |
15 #if SK_SUPPORT_GPU | 16 #if SK_SUPPORT_GPU |
16 #include "GrContext.h" | 17 #include "GrContext.h" |
17 #include "gl/SkNativeGLContext.h" | 18 #include "gl/SkNativeGLContext.h" |
18 #else | 19 #else |
19 class GrContext; | 20 class GrContext; |
20 #endif | 21 #endif |
21 | 22 |
| 23 DEFINE_string2(tmpDir, t, NULL, "tmp directory for tests to use."); |
| 24 |
22 using namespace skiatest; | 25 using namespace skiatest; |
23 | 26 |
24 Reporter::Reporter() : fTestCount(0) { | 27 Reporter::Reporter() : fTestCount(0) { |
25 } | 28 } |
26 | 29 |
27 void Reporter::startTest(Test* test) { | 30 void Reporter::startTest(Test* test) { |
28 this->bumpTestCount(); | 31 this->bumpTestCount(); |
29 this->onStart(test); | 32 this->onStart(test); |
30 } | 33 } |
31 | 34 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 fElapsed = SkTime::GetMSecs() - start; | 110 fElapsed = SkTime::GetMSecs() - start; |
108 | 111 |
109 // Now tell fReporter about any failures and wrap up. | 112 // Now tell fReporter about any failures and wrap up. |
110 for (int i = 0; i < local.numFailures(); i++) { | 113 for (int i = 0; i < local.numFailures(); i++) { |
111 fReporter->reportFailed(local.failure(i)); | 114 fReporter->reportFailed(local.failure(i)); |
112 } | 115 } |
113 fReporter->endTest(this); | 116 fReporter->endTest(this); |
114 | 117 |
115 } | 118 } |
116 | 119 |
117 /////////////////////////////////////////////////////////////////////////////// | 120 SkString Test::GetTmpDir() { |
118 | 121 const char* tmpDir = FLAGS_tmpDir.isEmpty() ? NULL : FLAGS_tmpDir[0]; |
119 #if SK_SUPPORT_GPU | 122 return SkString(tmpDir); |
120 #include "GrContextFactory.h" | |
121 GrContextFactory gGrContextFactory; | |
122 #endif | |
123 | |
124 GrContextFactory* GpuTest::GetGrContextFactory() { | |
125 #if SK_SUPPORT_GPU | |
126 return &gGrContextFactory; | |
127 #else | |
128 return NULL; | |
129 #endif | |
130 } | 123 } |
131 | 124 |
132 void GpuTest::DestroyContexts() { | 125 static const char* gResourcePath = NULL; |
133 #if SK_SUPPORT_GPU | 126 void Test::SetResourcePath(const char* resourcePath) { gResourcePath = resourceP
ath; } |
134 gGrContextFactory.destroyContexts(); | 127 |
135 #endif | 128 SkString Test::GetResourcePath() { |
| 129 return SkString(gResourcePath); |
136 } | 130 } |
| 131 |
OLD | NEW |