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 "SkString.h" | 10 #include "SkString.h" |
11 #include "SkTArray.h" | 11 #include "SkTArray.h" |
| 12 #include "SkTime.h" |
12 | 13 |
13 #if SK_SUPPORT_GPU | 14 #if SK_SUPPORT_GPU |
14 #include "GrContext.h" | 15 #include "GrContext.h" |
15 #include "gl/SkNativeGLContext.h" | 16 #include "gl/SkNativeGLContext.h" |
16 #else | 17 #else |
17 class GrContext; | 18 class GrContext; |
18 #endif | 19 #endif |
19 | 20 |
20 SK_DEFINE_INST_COUNT(skiatest::Reporter) | 21 SK_DEFINE_INST_COUNT(skiatest::Reporter) |
21 | 22 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 74 |
74 private: | 75 private: |
75 SkTArray<SkString> fFailures; | 76 SkTArray<SkString> fFailures; |
76 }; | 77 }; |
77 } // namespace | 78 } // namespace |
78 | 79 |
79 void Test::run() { | 80 void Test::run() { |
80 // Tell (likely shared) fReporter that this test has started. | 81 // Tell (likely shared) fReporter that this test has started. |
81 fReporter->startTest(this); | 82 fReporter->startTest(this); |
82 | 83 |
| 84 const SkMSec start = SkTime::GetMSecs(); |
83 // Run the test into a LocalReporter so we know if it's passed or failed wit
hout interference | 85 // Run the test into a LocalReporter so we know if it's passed or failed wit
hout interference |
84 // from other tests that might share fReporter. | 86 // from other tests that might share fReporter. |
85 LocalReporter local; | 87 LocalReporter local; |
86 this->onRun(&local); | 88 this->onRun(&local); |
87 fPassed = local.failure_size() == 0; | 89 fPassed = local.failure_size() == 0; |
| 90 fElapsed = SkTime::GetMSecs() - start; |
88 | 91 |
89 // Now tell fReporter about any failures and wrap up. | 92 // Now tell fReporter about any failures and wrap up. |
90 for (int i = 0; i < local.failure_size(); i++) { | 93 for (int i = 0; i < local.failure_size(); i++) { |
91 fReporter->report(local.failure(i), Reporter::kFailed); | 94 fReporter->report(local.failure(i), Reporter::kFailed); |
92 } | 95 } |
93 fReporter->endTest(this); | 96 fReporter->endTest(this); |
94 } | 97 } |
95 | 98 |
96 /////////////////////////////////////////////////////////////////////////////// | 99 /////////////////////////////////////////////////////////////////////////////// |
97 | 100 |
98 #if SK_SUPPORT_GPU | 101 #if SK_SUPPORT_GPU |
99 #include "GrContextFactory.h" | 102 #include "GrContextFactory.h" |
100 GrContextFactory gGrContextFactory; | 103 GrContextFactory gGrContextFactory; |
101 #endif | 104 #endif |
102 | 105 |
103 GrContextFactory* GpuTest::GetGrContextFactory() { | 106 GrContextFactory* GpuTest::GetGrContextFactory() { |
104 #if SK_SUPPORT_GPU | 107 #if SK_SUPPORT_GPU |
105 return &gGrContextFactory; | 108 return &gGrContextFactory; |
106 #else | 109 #else |
107 return NULL; | 110 return NULL; |
108 #endif | 111 #endif |
109 } | 112 } |
110 | 113 |
111 void GpuTest::DestroyContexts() { | 114 void GpuTest::DestroyContexts() { |
112 #if SK_SUPPORT_GPU | 115 #if SK_SUPPORT_GPU |
113 gGrContextFactory.destroyContexts(); | 116 gGrContextFactory.destroyContexts(); |
114 #endif | 117 #endif |
115 } | 118 } |
OLD | NEW |