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